Compare commits

..

No commits in common. "master" and "CI-c382d0f" have entirely different histories.

380 changed files with 65593 additions and 77798 deletions

View File

@ -8,6 +8,7 @@ skip_commits:
- .github/* - .github/*
- .github/*/* - .github/*/*
- .azure-pipelines.yml - .azure-pipelines.yml
- .travis.yml
- CONTRIBUTORS - CONTRIBUTORS
- COPYING - COPYING
- README.md - README.md
@ -15,17 +16,13 @@ skip_commits:
- setup.bat - setup.bat
init: init:
- ps: |- - ps: Update-AppveyorBuild -Version "$env:appveyor_repo_commit"
echo "This CI isn't tested against master, and therefore, isn't guaranteed to work. Pull requests are welcome."
echo "If it doesn't work and you'd rather not fix it, it's recommended to use GitHub Actions CI instead."
Update-AppveyorBuild -Version "$env:appveyor_repo_commit"
image: # If this is modified, please also update the build script image: # If this is modified, please also update the build script
- Visual Studio 2019 - Visual Studio 2019
configuration: # The builds will be run in this order configuration: # The builds will be run in this order
- Release - Release
- Debug
before_build: before_build:
- |- - |-
@ -39,8 +36,8 @@ build_script:
on_success: on_success:
- ps: |- - ps: |-
If ($env:configuration -eq 'Release') { cd bin\$env:configuration
cmake --install . --config $env:configuration --prefix artifacts 7z u "$env:configuration.zip" ..\..\..\COPYING ..\..\..\README.md
7z a "$env:configuration.zip" ./artifacts/bin/* 7z u "$env:configuration.zip" Cxbx.exe glew32.dll subhook.dll SDL2.dll
Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } 7z u "$env:configuration.zip" cxbxr-debugger.exe capstone.dll cs_x86.dll
} Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

View File

@ -3,13 +3,18 @@ trigger:
include: include:
- '*' - '*'
paths: paths:
exclude: # Azure Pipelines doesn't support recursive wildcards, see exclude:
- '.github/*' # https://developercommunity.visualstudio.com/t/support-wildcards-in-trigger-path-filters-1/366363 - doc/*
- '.github/*/*' - doc/*/*
- '*.bat' - .github/*
- '.appveyor.yml' - .github/*/*
- 'doc/*/*' - .appveyor.yml
- 'doc/*' - .travis.yml
- CONTRIBUTORS
- COPYING
- README.md
- gen-msvc-project.bat
- setup.bat
pr: pr:
branches: branches:
@ -17,44 +22,61 @@ pr:
- '*' - '*'
paths: paths:
exclude: exclude:
- '.github/*' - doc/*
- '.github/*/*' - doc/*/*
- '*.bat' - .github/*
- '.appveyor.yml' - .github/*/*
- 'doc/*/*' - .appveyor.yml
- 'doc/*' - .travis.yml
- CONTRIBUTORS
- COPYING
- README.md
- gen-msvc-project.bat
- setup.bat
pool: jobs:
vmImage: windows-latest - job:
strategy: pool:
matrix: vmImage: windows-latest
Release: strategy:
configuration: Release matrix:
Debug: Release:
configuration: Debug configuration: Release
Debug:
configuration: Debug
steps: steps:
- pwsh: | - checkout: self
echo "This CI isn't tested against master, and therefore, isn't guaranteed to work. Pull requests are welcome." submodules: recursive
echo "If it doesn't work and you'd rather not fix it, it's recommended to use GitHub Actions CI instead."
displayName: Third-Party CI Warning
- checkout: self - script: |
submodules: recursive mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A Win32
displayName: 'Before build'
- pwsh: cmake -B build -A Win32 - script: cmake --build . --config %configuration%
displayName: Before build workingDirectory: build
displayName: 'Build'
- pwsh: cmake --build . --config $env:configuration - task: CopyFiles@2
workingDirectory: build displayName: 'Copy files to $(Build.ArtifactStagingDirectory)'
displayName: Build condition: and(succeeded(), eq(variables['Agent.JobName'], 'Release'))
inputs:
Contents: |
COPYING
README.md
build\bin\$(configuration)\Cxbx.exe
build\bin\$(configuration)\glew32.dll
build\bin\$(configuration)\subhook.dll
build\bin\$(configuration)\SDL2.dll
build\bin\$(configuration)\cxbxr-debugger.exe
build\bin\$(configuration)\capstone.dll
build\bin\$(configuration)\cx_x86.dll
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- pwsh: cmake --install . --config $env:configuration --prefix $(Build.ArtifactStagingDirectory) - publish: $(Build.ArtifactStagingDirectory)
workingDirectory: build artifact: $(configuration)
condition: and(succeeded(), eq(variables['configuration'], 'Release')) condition: and(succeeded(), eq(variables['Agent.JobName'], 'Release'))
displayName: Prepare artifacts displayName: Publish artifact(s)
- publish: $(Build.ArtifactStagingDirectory)
artifact: $(configuration)
condition: and(succeeded(), eq(variables['configuration'], 'Release'))
displayName: Publish artifacts

23
.gitattributes vendored
View File

@ -1,3 +1,11 @@
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit # Standard to msysgit
*.doc diff=astextplain *.doc diff=astextplain
*.DOC diff=astextplain *.DOC diff=astextplain
@ -10,16 +18,5 @@
*.rtf diff=astextplain *.rtf diff=astextplain
*.RTF diff=astextplain *.RTF diff=astextplain
* text=auto [Cc][Mm]ake[Ll]ists.txt text=lf
*.bat text=lf
[Cc][Mm]ake[Ll]ists.txt text eol=lf
*.bat text eol=lf
*.c text eol=lf
*.h text eol=lf
*.cpp text eol=lf
*.hpp text eol=lf
*.unused-patches text eol=lf
*.rc text eol=lf
# All module imports are vendor, remove them from linguist stats chart for accurate stats.
import/* linguist-vendored

View File

@ -8,38 +8,7 @@ assignees: ''
--- ---
<!-- <!--
ISSUES NOT UTILIZING THE TEMPLATE BELOW WILL BE CLOSED! Questions can be asked on Discord: https://discord.gg/26Xjx23
--> If this is an issue specifically related to one game, please report it at https://github.com/Cxbx-Reloaded/game-compatibility
<!-- Any emulation/general issues like crashes when a controller is connected, or regressions across several titles can be reported here.
Please read https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/README.md and https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/wiki/Frequently-Asked-Questions-(FAQ) before opening an issue.
Remember, the GitHub Issue Tracker is not the place to ask for support. You must use our forum on Discord https://discord.gg/26Xjx23 for that.
Compatibility Reports should be submitted at the website: https://cxbx-reloaded.co.uk
Otherwise, for any other emulation/general issues like crashes when a controller is connected, or regressions across several titles, feel free to report your issue here.
-->
## Quick summary
<!--
Please briefly describe what is not working correctly.
-->
## Details
<!--
Please describe the problem as accurately as possible.
-->
### System Configuration:
<!--
Please provide your system configuration
-->
* OS
* CPU
* GPU
* etc.
### Additional Information (if any):
<!--
Anything else you deem to be important
--> -->

111
.github/labeler.yml vendored
View File

@ -1,111 +0,0 @@
# Labels are in alphabetical order.
cmake:
- changed-files:
- any-glob-to-any-file:
- 'CMake*'
- '**/CMakeLists.txt'
- '**/*.cmake'
cpu-emulation:
- changed-files:
- any-glob-to-any-file:
- 'src/devices/x86/**'
deployment:
- changed-files:
- any-glob-to-any-file:
- '*.yml'
- '.github/workflows/CI.yml'
file-system:
- changed-files:
- any-glob-to-any-file:
- 'src/core/kernel/support/EmuFile*'
graphics:
- changed-files:
- any-glob-to-any-file:
- 'src/core/hle/D3D8/**'
- 'src/core/hle/XGRAPHIC/**'
- 'src/devices/video/**'
- 'src/gui/*Video*'
HLE:
- changed-files:
- any-glob-to-any-file:
- 'src/core/hle/**'
- 'src/core/kernel/**'
informational:
- changed-files:
- any-glob-to-any-file:
- '**/*Logging*'
- '**/*Logging*/**'
- '**/README.md'
input:
- changed-files:
- any-glob-to-any-file:
- 'src/common/input/**'
- 'src/core/hle/XAPI/input/**'
- 'src/devices/usb/**'
- 'src/gui/controllers/**'
- 'src/gui/*Input*'
kernel:
- changed-files:
- any-glob-to-any-file:
- 'src/core/kernel/**'
LLE:
- changed-files:
- any-glob-to-any-file:
- 'src/devices/**'
memory:
- changed-files:
- any-glob-to-any-file:
- 'src/core/kernel/memory-manager/**'
networking:
- changed-files:
- any-glob-to-any-file:
- 'src/core/hle/XONLINE/**'
- 'src/devices/network/**'
- 'src/gui/*Network*'
sound:
- changed-files:
- any-glob-to-any-file:
- 'src/common/audio/**'
- 'src/core/hle/DSOUND/**'
- 'src/core/hle/XACTENG/**'
- 'src/devices/audio/**'
- 'src/gui/*Audio*'
modules:
- changed-files:
- any-glob-to-any-file:
- 'import/**'
threading:
- changed-files:
- any-glob-to-any-file:
- 'src/core/kernel/support/EmuFS*'
timing:
- changed-files:
- any-glob-to-any-file:
- 'src/common/Timer*'
user interface:
- changed-files:
- any-glob-to-any-file:
- 'src/core/common/imgui/*'
- 'src/gui/**'
xbdm:
- changed-files:
- any-glob-to-any-file:
- 'src/common/xbdm/**'

View File

@ -3,76 +3,117 @@ name: GitHub CI
on: on:
push: push:
paths-ignore: paths-ignore:
- '.gitattributes' - '.github/CONTRIBUTING.md'
- '.github/*' - '.github/FUNDING.md'
- '.github/*_TEMPLATE/**' - '.github/ISSUE_TEMPLATE/*'
- '.gitignore' - 'doc/*'
- '*.bat' - 'doc/*/*'
- '*.yml' - '.appveyor.yml'
- 'doc/**' - '.azure-pipelines.yml'
- '.travis.yml'
- 'gen-msvc-project.bat'
- 'setup.bat'
pull_request: pull_request:
paths-ignore: paths-ignore:
- '.gitattributes' - '.github/CONTRIBUTING.md'
- '.github/*' - '.github/FUNDING.md'
- '.github/*_TEMPLATE/**' - '.github/ISSUE_TEMPLATE/*'
- '.gitignore' - 'doc/*'
- '*.bat' - 'doc/*/*'
- '*.yml' - '.appveyor.yml'
- 'doc/**' - '.azure-pipelines.yml'
- '.travis.yml'
- 'gen-msvc-project.bat'
- 'setup.bat'
jobs: jobs:
build-windows: build-windows:
name: Build (Windows, ${{ matrix.configuration }}) # runner.os doesn't work here runs-on: ${{ matrix.os }}
runs-on: windows-2025
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
configuration: [Release, Debug] configuration: [Release, Debug]
vsver: [VS2019, VS2017]
include:
- vsver: VS2019
os: windows-latest
- vsver: VS2017 # TODO: Remove VS2017 once WINE supports VS2019 runtimes;
os: windows-2016 # https://github.com/actions/virtual-environments/issues/68#issuecomment-602652021
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- name: Generate CMake files - name: Generate cmake files
run: cmake -B build -A Win32 -DBUILD_CXBXR_DEBUGGER=ON -DCMAKE_SYSTEM_VERSION=7 run: |
mkdir build && cd build
cmake .. -A Win32
- name: Build - name: Build
run: cmake --build build --config ${{ matrix.configuration }} -j $env:NUMBER_OF_PROCESSORS working-directory: build
run: cmake --build . --config ${{ matrix.configuration }} -j $env:NUMBER_OF_PROCESSORS
- name: Prepare artifacts - name: Prepare artifacts
if: matrix.configuration == 'Release' if: matrix.configuration == 'Release'
run: cmake --install build --config ${{ matrix.configuration }} --prefix artifacts run: |
- uses: actions/upload-artifact@v4 robocopy . artifacts COPYING README.md /r:0 /w:0
robocopy build\bin\${{ matrix.configuration }} artifacts `
Cxbx.exe glew32.dll subhook.dll SDL2.dll `
cxbxr-debugger.exe capstone.dll cs_x86.dll /r:0 /w:0
If ($LastExitCode -le 7) { $LastExitCode = 0 }
- uses: actions/upload-artifact@v1
if: matrix.configuration == 'Release' if: matrix.configuration == 'Release'
with: with:
name: CxbxReloaded-${{ matrix.configuration }} name: CxbxReloaded-${{ matrix.configuration }}-${{ matrix.vsver }}
path: artifacts/bin path: artifacts
if-no-files-found: error
release: release:
if: | if: | # TODO: Remove develop once rebased
github.event.action != 'pull_request' && github.event.action != 'pull_request' &&
github.ref == 'refs/heads/master' && (github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/master') &&
github.repository == 'Cxbx-Reloaded/Cxbx-Reloaded' github.repository == 'Cxbx-Reloaded/Cxbx-Reloaded'
needs: build-windows needs: build-windows
runs-on: ubuntu-latest env:
artifact_1: CxbxReloaded-Release-VS2019
artifact_2: CxbxReloaded-Release-VS2017
runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- name: Download artifacts - name: Download artifacts (1)
uses: actions/download-artifact@v4 uses: actions/download-artifact@v1
with: with:
path: artifacts name: ${{ env.artifact_1 }}
- name: Re-zip artifacts - name: Download artifacts (2)
id: zip uses: actions/download-artifact@v1
run: | with:
for artifact in artifacts/*; do name: ${{ env.artifact_2 }}
7z a ${artifact}.zip "./${artifact}/*" - name: Prepare artifacts for release
if [ $(stat -c %s ${artifact}.zip) -le 100000 ]; then run: | # download-artifact doesn't download a zip, so rezip it
echo "Error: Archive ${artifact}.zip too small!" echo "::set-env name=short_commit_sha::$(git rev-parse --short HEAD)"
exit 1 7z a -mx1 "$env:artifact_1.zip" ".\$env:artifact_1\*"
fi 7z a -mx1 "$env:artifact_2.zip" ".\$env:artifact_2\*"
done
echo "tag_name=CI-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
- name: Create Release - name: Create Release
id: create_release
uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.zip.outputs.tag_name }} artifacts/*.zip -p --target $GITHUB_SHA --title '${{ steps.zip.outputs.tag_name }}' with:
tag_name: CI-${{ env.short_commit_sha }}
release_name: CI-${{ env.short_commit_sha }}
prerelease: true
- name: Upload Release Asset (1)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.artifact_1 }}.zip
asset_name: ${{ env.artifact_1 }}.zip
asset_content_type: application/zip
- name: Upload Release Asset (2)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.artifact_2 }}.zip
asset_name: ${{ env.artifact_2 }}.zip
asset_content_type: application/zip

View File

@ -1,16 +0,0 @@
on:
issues:
types: opened
jobs:
auto_close_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Automatically close issues that don't follow the issue template
uses: ergo720/auto-close-issues@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-close-message: "@${issue.user.login}: your issue has been automatically closed because it does not follow the issue template." # optional property
closed-issues-label: "invalid" # optional property

View File

@ -1,13 +0,0 @@
name: Pull Request Manager
on: pull_request_target
jobs:
pr_manager:
runs-on: ubuntu-latest
steps:
- name: Labeler
uses: actions/labeler@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true

4
.gitignore vendored
View File

@ -2,10 +2,6 @@
[Bb]uild/ [Bb]uild/
[Bb]uild-*/ [Bb]uild-*/
# CLion
.idea/
cmake-build-*/
# Visual Studio Cache # Visual Studio Cache
.vs/ .vs/

40
.gitmodules vendored
View File

@ -1,49 +1,23 @@
[submodule "import/subhook"] [submodule "import/subhook"]
path = import/subhook path = import/subhook
url = https://github.com/Cxbx-Reloaded/subhook.git url = https://github.com/Zeex/subhook.git
shallow = true
[submodule "import/cs_x86"] [submodule "import/cs_x86"]
path = import/cs_x86 path = import/cs_x86
url = https://github.com/x1nixmzeng/cs_x86.git url = https://github.com/x1nixmzeng/cs_x86
[submodule "import/XbSymbolDatabase"] [submodule "import/XbSymbolDatabase"]
path = import/XbSymbolDatabase path = import/XbSymbolDatabase
url = https://github.com/Cxbx-Reloaded/XbSymbolDatabase.git url = https://github.com/Cxbx-Reloaded/XbSymbolDatabase
[submodule "import/simpleini"] [submodule "import/simpleini"]
path = import/simpleini path = import/simpleini
url = https://github.com/brofield/simpleini.git url = https://github.com/brofield/simpleini
shallow = true
[submodule "import/libtommath"] [submodule "import/libtommath"]
path = import/libtommath path = import/libtommath
url = https://github.com/libtom/libtommath.git url = https://github.com/libtom/libtommath
branch = master branch = master
shallow = true
[submodule "import/libtomcrypt"] [submodule "import/libtomcrypt"]
path = import/libtomcrypt path = import/libtomcrypt
url = https://github.com/libtom/libtomcrypt.git url = https://github.com/libtom/libtomcrypt
branch = master branch = master
shallow = true
[submodule "import/xxHash"]
path = import/xxHash
url = https://github.com/Cyan4973/xxHash.git
branch = release
shallow = true
[submodule "import/imgui"]
path = import/imgui
url = https://github.com/ocornut/imgui.git
shadow = true
[submodule "import/SDL2"] [submodule "import/SDL2"]
path = import/SDL2 path = import/SDL2
url = https://github.com/libsdl-org/SDL url = https://github.com/SDL-mirror/SDL
shallow = true
[submodule "import/libusb"]
path = import/libusb
url = https://github.com/Cxbx-Reloaded/libusb
branch = deadlock_fix
shallow = true
[submodule "import/nv2a_vsh_cpu"]
path = import/nv2a_vsh_cpu
url = https://github.com/abaire/nv2a_vsh_cpu.git
[submodule "import/mio"]
path = import/mio
url = https://github.com/mandreyel/mio.git
shadow = true

20
.travis.yml Normal file
View File

@ -0,0 +1,20 @@
language: cpp
matrix:
include:
- os: windows
env: configuration=Debug
- os: windows
env: configuration=Release
before_script:
- if [ $TRAVIS_OS_NAME == 'windows' ]; then
mkdir build;
cd build;
cmake .. -G "Visual Studio 15 2017" -A Win32;
fi
script:
- if [ $TRAVIS_OS_NAME == 'windows' ]; then
cmake --build . --config $configuration;
fi

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.12) cmake_minimum_required (VERSION 3.8)
project(Cxbx-Reloaded) project(Cxbx-Reloaded)
@ -13,36 +13,48 @@ endif()
set(SUBHOOK_TESTS OFF) set(SUBHOOK_TESTS OFF)
set(SUBHOOK_INSTALL OFF) set(SUBHOOK_INSTALL OFF)
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/subhook" EXCLUDE_FROM_ALL) add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/subhook")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/XbSymbolDatabase") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/XbSymbolDatabase")
# Not require since only include a header file # Not require since only include a header file
#add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/simpleini") #add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/simpleini")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/SDL2" EXCLUDE_FROM_ALL) add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/SDL2")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/mio" EXCLUDE_FROM_ALL) if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/cs_x86")
endif()
# Cxbx-Reloaded projects # Cxbx-Reloaded projects
set(CXBXR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}) set(CXBXR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
add_custom_target(misc-batch
${CMAKE_COMMAND} -DTargetRunTimeDir=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>
-P ${CXBXR_ROOT_DIR}/projects/misc/batch.cmake
WORKING_DIRECTORY ${CXBXR_ROOT_DIR}
)
# Custom CMake projects since some import libraries doesn't have it.
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/libtom") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/libtom")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/imgui") find_package(Git)
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/libusb") if(Git_FOUND)
message("Git found: ${GIT_EXECUTABLE}")
set(nv2a_vsh_cpu_UNIT_TEST OFF) execute_process(
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/nv2a_vsh_cpu" EXCLUDE_FROM_ALL) COMMAND git describe --always --tags --first-parent
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Git version: " ${_GIT_VERSION})
else()
set(_GIT_VERSION "unknown")
endif()
# Appears to update whenever define has changed.
configure_file(
"${CXBXR_ROOT_DIR}/src/version.h.in" "${CXBXR_ROOT_DIR}/src/version.h" @ONLY
NEWLINE_STYLE LF
)
#add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/vsbc")
# Split the files into group for which project is likely # Split the files into group for which project is likely
# going to be used for both header and source files. # going to be used for both header and source files.
@ -54,52 +66,39 @@ add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/import/nv2a_vsh_cpu" EXCLUDE_FROM_AL
# Common (GUI and Emulator) # Common (GUI and Emulator)
file (GLOB CXBXR_HEADER_COMMON file (GLOB CXBXR_HEADER_COMMON
"${CXBXR_ROOT_DIR}/src/common/AddressRanges.h"
"${CXBXR_ROOT_DIR}/src/common/crypto/EmuDes.h" "${CXBXR_ROOT_DIR}/src/common/crypto/EmuDes.h"
"${CXBXR_ROOT_DIR}/src/common/crypto/EmuRsa.h" "${CXBXR_ROOT_DIR}/src/common/crypto/EmuRsa.h"
"${CXBXR_ROOT_DIR}/src/common/crypto/EmuSha.h" "${CXBXR_ROOT_DIR}/src/common/crypto/EmuSha.h"
"${CXBXR_ROOT_DIR}/src/common/crypto/LibRc4.h" "${CXBXR_ROOT_DIR}/src/common/crypto/LibRc4.h"
"${CXBXR_ROOT_DIR}/src/common/CxbxDebugger.h" "${CXBXR_ROOT_DIR}/src/common/CxbxDebugger.h"
"${CXBXR_ROOT_DIR}/src/common/cxbxr.hpp"
"${CXBXR_ROOT_DIR}/src/common/EmuEEPROM.h" "${CXBXR_ROOT_DIR}/src/common/EmuEEPROM.h"
"${CXBXR_ROOT_DIR}/src/common/Error.h" "${CXBXR_ROOT_DIR}/src/common/Error.h"
"${CXBXR_ROOT_DIR}/src/common/FilePaths.hpp"
"${CXBXR_ROOT_DIR}/src/common/input/DInputKeyboardCodes.h" "${CXBXR_ROOT_DIR}/src/common/input/DInputKeyboardCodes.h"
"${CXBXR_ROOT_DIR}/src/common/input/DInputKeyboardMouse.h" "${CXBXR_ROOT_DIR}/src/common/input/DInputKeyboardMouse.h"
"${CXBXR_ROOT_DIR}/src/common/input/layout_xbox_device.h" "${CXBXR_ROOT_DIR}/src/common/input/layout_xbox_controller.h"
"${CXBXR_ROOT_DIR}/src/common/input/LibusbDevice.h"
"${CXBXR_ROOT_DIR}/src/common/input/InputDevice.h" "${CXBXR_ROOT_DIR}/src/common/input/InputDevice.h"
"${CXBXR_ROOT_DIR}/src/common/input/InputManager.h" "${CXBXR_ROOT_DIR}/src/common/input/InputManager.h"
"${CXBXR_ROOT_DIR}/src/common/input/SdlJoystick.h" "${CXBXR_ROOT_DIR}/src/common/input/SdlJoystick.h"
"${CXBXR_ROOT_DIR}/src/common/input/XInputPad.h" "${CXBXR_ROOT_DIR}/src/common/input/XInputPad.h"
"${CXBXR_ROOT_DIR}/src/common/input/RawDevice.h"
"${CXBXR_ROOT_DIR}/src/common/IPCHybrid.hpp" "${CXBXR_ROOT_DIR}/src/common/IPCHybrid.hpp"
"${CXBXR_ROOT_DIR}/src/common/Logging.h" "${CXBXR_ROOT_DIR}/src/common/Logging.h"
"${CXBXR_ROOT_DIR}/src/common/ReservedMemory.h"
"${CXBXR_ROOT_DIR}/src/common/Settings.hpp" "${CXBXR_ROOT_DIR}/src/common/Settings.hpp"
"${CXBXR_ROOT_DIR}/src/common/util/cliConfig.hpp" "${CXBXR_ROOT_DIR}/src/common/Timer.h"
"${CXBXR_ROOT_DIR}/src/common/util/cliConverter.hpp"
"${CXBXR_ROOT_DIR}/src/common/util/CPUID.h" "${CXBXR_ROOT_DIR}/src/common/util/CPUID.h"
"${CXBXR_ROOT_DIR}/src/common/util/crc32c.h"
"${CXBXR_ROOT_DIR}/src/common/util/CxbxUtil.h" "${CXBXR_ROOT_DIR}/src/common/util/CxbxUtil.h"
"${CXBXR_ROOT_DIR}/src/common/util/std_extend.hpp"
"${CXBXR_ROOT_DIR}/src/common/util/strConverter.hpp" "${CXBXR_ROOT_DIR}/src/common/util/strConverter.hpp"
"${CXBXR_ROOT_DIR}/src/common/win32/AlignPosfix1.h" "${CXBXR_ROOT_DIR}/src/common/win32/AlignPosfix1.h"
"${CXBXR_ROOT_DIR}/src/common/win32/AlignPrefix1.h" "${CXBXR_ROOT_DIR}/src/common/win32/AlignPrefix1.h"
"${CXBXR_ROOT_DIR}/src/common/win32/EmuShared.h" "${CXBXR_ROOT_DIR}/src/common/win32/EmuShared.h"
"${CXBXR_ROOT_DIR}/src/common/win32/Mutex.h" "${CXBXR_ROOT_DIR}/src/common/win32/Mutex.h"
"${CXBXR_ROOT_DIR}/src/common/win32/Util.h" "${CXBXR_ROOT_DIR}/src/common/win32/Threads.h"
"${CXBXR_ROOT_DIR}/src/common/win32/WineEnv.h"
"${CXBXR_ROOT_DIR}/src/common/xbdm/CxbxXbdm.h" "${CXBXR_ROOT_DIR}/src/common/xbdm/CxbxXbdm.h"
"${CXBXR_ROOT_DIR}/src/common/xbe/Xbe.h" "${CXBXR_ROOT_DIR}/src/common/xbe/Xbe.h"
"${CXBXR_ROOT_DIR}/src/common/xbe/XbePrinter.h" "${CXBXR_ROOT_DIR}/src/common/xbe/XbePrinter.h"
"${CXBXR_ROOT_DIR}/src/common/xbox/Logging.hpp"
"${CXBXR_ROOT_DIR}/src/common/xbox/Types.hpp"
"${CXBXR_ROOT_DIR}/src/common/xbox_types.h"
"${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/buffered_io.h" "${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/buffered_io.h"
"${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/xdvdfs.h" "${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/xdvdfs.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbConvert.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbD3D8Types.h"
"${CXBXR_ROOT_DIR}/src/core/hle/XAPI/Xapi.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlLogging.h"
"${CXBXR_ROOT_DIR}/src/Cxbx.h" "${CXBXR_ROOT_DIR}/src/Cxbx.h"
"${CXBXR_ROOT_DIR}/src/CxbxVersion.h" "${CXBXR_ROOT_DIR}/src/CxbxVersion.h"
"${CXBXR_ROOT_DIR}/src/version.h" "${CXBXR_ROOT_DIR}/src/version.h"
@ -110,55 +109,33 @@ file (GLOB CXBXR_HEADER_GUIv1
"${CXBXR_ROOT_DIR}/src/common/input/Button.h" "${CXBXR_ROOT_DIR}/src/common/input/Button.h"
"${CXBXR_ROOT_DIR}/src/common/input/EmuDevice.h" "${CXBXR_ROOT_DIR}/src/common/input/EmuDevice.h"
"${CXBXR_ROOT_DIR}/src/common/input/InputWindow.h" "${CXBXR_ROOT_DIR}/src/common/input/InputWindow.h"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgDukeControllerConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DbgConsole.h"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgLibusbControllerConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgLightgunConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgSBControllerConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgAbout.h" "${CXBXR_ROOT_DIR}/src/gui/DlgAbout.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgAudioConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DlgAudioConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgInputConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DlgInputConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgDukeControllerConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgEepromConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DlgEepromConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgLoggingConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DlgLoggingConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgNetworkConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DlgNetworkConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/DlgVideoConfig.h" "${CXBXR_ROOT_DIR}/src/gui/DlgVideoConfig.h"
"${CXBXR_ROOT_DIR}/src/gui/ResCxbx.h"
"${CXBXR_ROOT_DIR}/src/gui/Wnd.h" "${CXBXR_ROOT_DIR}/src/gui/Wnd.h"
"${CXBXR_ROOT_DIR}/src/gui/WndMain.h" "${CXBXR_ROOT_DIR}/src/gui/WndMain.h"
) )
# Emulator (module) # Emulator (module)
file (GLOB CXBXR_HEADER_EMU_IMPORT
"${CXBXR_ROOT_DIR}/import/imgui/backends/imgui_impl_dx9.h"
"${CXBXR_ROOT_DIR}/import/imgui/backends/imgui_impl_opengl3.h"
"${CXBXR_ROOT_DIR}/import/imgui/backends/imgui_impl_win32.h"
)
file (GLOB CXBXR_HEADER_EMU file (GLOB CXBXR_HEADER_EMU
"${CXBXR_ROOT_DIR}/src/common/audio/converter.hpp"
"${CXBXR_ROOT_DIR}/src/common/audio/XADPCM.h"
"${CXBXR_ROOT_DIR}/src/common/Timer.h"
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/glextensions.h" "${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/glextensions.h"
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen.h" "${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen.h"
"${CXBXR_ROOT_DIR}/src/common/win32/Threads.h" "${CXBXR_ROOT_DIR}/src/common/XADPCM.h"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/audio.hpp"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/ui.hpp"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/settings.h"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/video.hpp"
"${CXBXR_ROOT_DIR}/src/core/common/video/RenderBase.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/CxbxPixelShaderTemplate.hlsl"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/CxbxVertexShaderTemplate.hlsl"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/CxbxVertexShaderPassthrough.hlsl"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/Direct3D9.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/Direct3D9.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionPixelShader.hlsl"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionPixelShader.hlsli"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionVertexShader.hlsl"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/FixedFunctionVertexShaderState.hlsli"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/PixelShader.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/Shader.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShader.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShader.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShaderCache.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShaderSource.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/WalkIndexBuffer.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/WalkIndexBuffer.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/FixedFunctionState.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/ResourceTracker.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/ResourceTracker.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbConvert.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbD3D8Logging.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbD3D8Logging.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbD3D8Types.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPixelShader.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPixelShader.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPushBuffer.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPushBuffer.h"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbState.h" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbState.h"
@ -170,22 +147,21 @@ file (GLOB CXBXR_HEADER_EMU
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSoundLogging.hpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DirectSoundLogging.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.hpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundFuncs.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundLogging.hpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundLogging.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundTypes.h" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundTypes.h"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/common/XbInternalStruct.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/Intercept.hpp" "${CXBXR_ROOT_DIR}/src/core/hle/Intercept.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/Patches.hpp" "${CXBXR_ROOT_DIR}/src/core/hle/Patches.hpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XACTENG/XactEng.h" "${CXBXR_ROOT_DIR}/src/core/hle/XACTENG/XactEng.h"
"${CXBXR_ROOT_DIR}/src/core/hle/XAPI/Xapi.h"
"${CXBXR_ROOT_DIR}/src/core/hle/XAPI/XapiCxbxr.h"
"${CXBXR_ROOT_DIR}/src/core/hle/XGRAPHIC/XGraphic.h" "${CXBXR_ROOT_DIR}/src/core/hle/XGRAPHIC/XGraphic.h"
"${CXBXR_ROOT_DIR}/src/core/hle/XONLINE/XOnline.h" "${CXBXR_ROOT_DIR}/src/core/hle/XONLINE/XOnline.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/common/strings.hpp" "${CXBXR_ROOT_DIR}/src/core/kernel/common/strings.hpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlAvModes.h" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlAvModes.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKe.h" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKe.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKi.h" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKi.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlPs.hpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlLogging.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/init/CxbxKrnl.h" "${CXBXR_ROOT_DIR}/src/core/kernel/init/CxbxKrnl.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/init/KrnlPatches.hpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PhysicalMemory.h" "${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PhysicalMemory.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PoolManager.h" "${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PoolManager.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/VMManager.h" "${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/VMManager.h"
@ -193,11 +169,9 @@ file (GLOB CXBXR_HEADER_EMU
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFile.h" "${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFile.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFS.h" "${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFS.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuNtDll.h" "${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuNtDll.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/NativeHandle.h"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/PatchRdtsc.hpp"
"${CXBXR_ROOT_DIR}/src/devices/ADM1032Device.h" "${CXBXR_ROOT_DIR}/src/devices/ADM1032Device.h"
"${CXBXR_ROOT_DIR}/src/devices/EEPROMDevice.h" "${CXBXR_ROOT_DIR}/src/devices/EEPROMDevice.h"
"${CXBXR_ROOT_DIR}/src/devices/network/NVNetDevice.h" "${CXBXR_ROOT_DIR}/src/devices/EmuNVNet.h"
"${CXBXR_ROOT_DIR}/src/devices/LED.h" "${CXBXR_ROOT_DIR}/src/devices/LED.h"
"${CXBXR_ROOT_DIR}/src/devices/MCPXDevice.h" "${CXBXR_ROOT_DIR}/src/devices/MCPXDevice.h"
"${CXBXR_ROOT_DIR}/src/devices/PCIBus.h" "${CXBXR_ROOT_DIR}/src/devices/PCIBus.h"
@ -226,55 +200,38 @@ file (GLOB CXBXR_HEADER_EMU
"${CXBXR_ROOT_DIR}/src/devices/Xbox.h" "${CXBXR_ROOT_DIR}/src/devices/Xbox.h"
) )
# filter hlsl files into its own list
# excluding hlsli file(s)
set(CXBXR_HEADER_HLSL ${CXBXR_HEADER_EMU})
list(FILTER CXBXR_HEADER_HLSL INCLUDE REGEX ".*\\.hlsl$")
# Common (GUI and Emulator) # Common (GUI and Emulator)
file (GLOB CXBXR_SOURCE_COMMON file (GLOB CXBXR_SOURCE_COMMON
"${CXBXR_ROOT_DIR}/src/common/AddressRanges.cpp"
"${CXBXR_ROOT_DIR}/src/common/crypto/EmuDes.cpp" "${CXBXR_ROOT_DIR}/src/common/crypto/EmuDes.cpp"
"${CXBXR_ROOT_DIR}/src/common/crypto/EmuRsa.cpp" "${CXBXR_ROOT_DIR}/src/common/crypto/EmuRsa.cpp"
"${CXBXR_ROOT_DIR}/src/common/crypto/EmuSha.cpp" "${CXBXR_ROOT_DIR}/src/common/crypto/EmuSha.cpp"
"${CXBXR_ROOT_DIR}/src/common/crypto/LibRc4.cpp" "${CXBXR_ROOT_DIR}/src/common/crypto/LibRc4.cpp"
"${CXBXR_ROOT_DIR}/src/common/CxbxDebugger.cpp" "${CXBXR_ROOT_DIR}/src/common/CxbxDebugger.cpp"
"${CXBXR_ROOT_DIR}/src/common/cxbxr.cpp"
"${CXBXR_ROOT_DIR}/src/common/EmuEEPROM.cpp" "${CXBXR_ROOT_DIR}/src/common/EmuEEPROM.cpp"
"${CXBXR_ROOT_DIR}/src/common/Error.cpp" "${CXBXR_ROOT_DIR}/src/common/Error.cpp"
"${CXBXR_ROOT_DIR}/src/common/FilePaths.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/DInputKeyboardMouse.cpp" "${CXBXR_ROOT_DIR}/src/common/input/DInputKeyboardMouse.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/InputDevice.cpp" "${CXBXR_ROOT_DIR}/src/common/input/InputDevice.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/InputManager.cpp" "${CXBXR_ROOT_DIR}/src/common/input/InputManager.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/LibusbDevice.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/SdlJoystick.cpp" "${CXBXR_ROOT_DIR}/src/common/input/SdlJoystick.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/XInputPad.cpp" "${CXBXR_ROOT_DIR}/src/common/input/XInputPad.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/RawDevice.cpp"
"${CXBXR_ROOT_DIR}/src/common/Logging.cpp" "${CXBXR_ROOT_DIR}/src/common/Logging.cpp"
"${CXBXR_ROOT_DIR}/src/common/Settings.cpp" "${CXBXR_ROOT_DIR}/src/common/Settings.cpp"
"${CXBXR_ROOT_DIR}/src/common/util/cliConfig.cpp" "${CXBXR_ROOT_DIR}/src/common/Timer.cpp"
"${CXBXR_ROOT_DIR}/src/common/util/cliConverter.cpp" "${CXBXR_ROOT_DIR}/src/common/util/crc32c.cpp"
"${CXBXR_ROOT_DIR}/src/common/util/CxbxUtil.cpp" "${CXBXR_ROOT_DIR}/src/common/util/CxbxUtil.cpp"
"${CXBXR_ROOT_DIR}/src/common/util/hasher.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/EmuShared.cpp" "${CXBXR_ROOT_DIR}/src/common/win32/EmuShared.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/InlineFunc.cpp" "${CXBXR_ROOT_DIR}/src/common/win32/InlineFunc.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/IPCWindows.cpp" "${CXBXR_ROOT_DIR}/src/common/win32/IPCWindows.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/Mutex.cpp" "${CXBXR_ROOT_DIR}/src/common/win32/Mutex.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/Util.cpp" "${CXBXR_ROOT_DIR}/src/common/win32/Threads.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/WineEnv.cpp"
"${CXBXR_ROOT_DIR}/src/common/xbdm/CxbxXbdm.cpp" "${CXBXR_ROOT_DIR}/src/common/xbdm/CxbxXbdm.cpp"
"${CXBXR_ROOT_DIR}/src/common/xbe/Xbe.cpp" "${CXBXR_ROOT_DIR}/src/common/xbe/Xbe.cpp"
"${CXBXR_ROOT_DIR}/src/common/xbe/XbePrinter.cpp" "${CXBXR_ROOT_DIR}/src/common/xbe/XbePrinter.cpp"
"${CXBXR_ROOT_DIR}/src/common/xbox/Logging.cpp"
"${CXBXR_ROOT_DIR}/src/common/xbox/Types.cpp"
"${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/buffered_io.cpp" "${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/buffered_io.cpp"
"${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/xdvdfs.cpp" "${CXBXR_ROOT_DIR}/src/common/xdvdfs-tools/xdvdfs.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbConvert.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XAPI/Xapi.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlLogging.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlXbox.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlXc.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlXe.cpp"
"${CXBXR_ROOT_DIR}/src/CxbxVersion.cpp" "${CXBXR_ROOT_DIR}/src/CxbxVersion.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DbgConsole.cpp"
"${CXBXR_ROOT_DIR}/src/HighPerformanceGraphicsEnabler.c" "${CXBXR_ROOT_DIR}/src/HighPerformanceGraphicsEnabler.c"
) )
@ -283,13 +240,10 @@ file (GLOB CXBXR_SOURCE_GUIv1
"${CXBXR_ROOT_DIR}/src/common/input/Button.cpp" "${CXBXR_ROOT_DIR}/src/common/input/Button.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/EmuDevice.cpp" "${CXBXR_ROOT_DIR}/src/common/input/EmuDevice.cpp"
"${CXBXR_ROOT_DIR}/src/common/input/InputWindow.cpp" "${CXBXR_ROOT_DIR}/src/common/input/InputWindow.cpp"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgDukeControllerConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgLibusbControllerConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgLightgunConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/input/DlgSBControllerConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgAbout.cpp" "${CXBXR_ROOT_DIR}/src/gui/DlgAbout.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgAudioConfig.cpp" "${CXBXR_ROOT_DIR}/src/gui/DlgAudioConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgInputConfig.cpp" "${CXBXR_ROOT_DIR}/src/gui/DlgInputConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgDukeControllerConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgEepromConfig.cpp" "${CXBXR_ROOT_DIR}/src/gui/DlgEepromConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgLoggingConfig.cpp" "${CXBXR_ROOT_DIR}/src/gui/DlgLoggingConfig.cpp"
"${CXBXR_ROOT_DIR}/src/gui/DlgNetworkConfig.cpp" "${CXBXR_ROOT_DIR}/src/gui/DlgNetworkConfig.cpp"
@ -304,33 +258,20 @@ file (GLOB CXBXR_SOURCE_GUIv1
file (GLOB CXBXR_KRNL_CPP file (GLOB CXBXR_KRNL_CPP
"${CXBXR_ROOT_DIR}/src/core/kernel/init/CxbxKrnl.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/init/CxbxKrnl.cpp"
) )
file (GLOB CXBXR_SOURCE_EMU_IMPORT
"${CXBXR_ROOT_DIR}/import/imgui/backends/imgui_impl_dx9.cpp"
"${CXBXR_ROOT_DIR}/import/imgui/backends/imgui_impl_opengl3.cpp"
"${CXBXR_ROOT_DIR}/import/imgui/backends/imgui_impl_win32.cpp"
)
file (GLOB CXBXR_SOURCE_EMU file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_KRNL_CPP}" "${CXBXR_KRNL_CPP}"
"${CXBXR_ROOT_DIR}/src/common/Timer.cpp" "${CXBXR_ROOT_DIR}/HighPerformanceGraphicsEnabler.c"
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/glextensions.cpp" "${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/glextensions.cpp"
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_common.cpp" "${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_common.cpp"
"${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_wgl.cpp" "${CXBXR_ROOT_DIR}/src/common/util/gloffscreen/gloffscreen_wgl.cpp"
"${CXBXR_ROOT_DIR}/src/common/VerifyAddressRanges.cpp"
"${CXBXR_ROOT_DIR}/src/common/win32/Threads.cpp"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/audio.cpp"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/ui.cpp"
"${CXBXR_ROOT_DIR}/src/core/common/imgui/video.cpp"
"${CXBXR_ROOT_DIR}/src/core/common/video/RenderBase.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/PixelShader.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/RenderStates.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/RenderStates.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/Shader.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/TextureStates.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/TextureStates.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShader.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShader.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShaderCache.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/VertexShaderSource.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/WalkIndexBuffer.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/Direct3D9/WalkIndexBuffer.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/FixedFunctionState.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/ResourceTracker.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/ResourceTracker.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbConvert.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbD3D8Logging.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbD3D8Logging.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPixelShader.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPixelShader.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPushBuffer.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/D3D8/XbPushBuffer.cpp"
@ -345,12 +286,10 @@ file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/XFileMediaObject.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/DirectSound/XFileMediaObject.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundLogging.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/XbDSoundLogging.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/DSOUND/common/XbInternalStruct.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/Intercept.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/Intercept.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/JVS/JVS.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/Patches.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/Patches.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XACTENG/XactEng.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/XACTENG/XactEng.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XAPI/Xapi.cpp"
"${CXBXR_ROOT_DIR}/src/core/hle/XGRAPHIC/XGraphic.cpp" "${CXBXR_ROOT_DIR}/src/core/hle/XGRAPHIC/XGraphic.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnl.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnl.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlAv.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlAv.cpp"
@ -362,12 +301,16 @@ file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKd.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKd.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKe.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKe.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKi.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlKi.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlLogging.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlMm.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlMm.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlNt.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlNt.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlOb.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlOb.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlPhy.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlPhy.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlPs.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlPs.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlRtl.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlRtl.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlXbox.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlXc.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/EmuKrnlXe.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/exports/KernelThunk.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/exports/KernelThunk.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PhysicalMemory.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PhysicalMemory.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PoolManager.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/memory-manager/PoolManager.cpp"
@ -376,13 +319,9 @@ file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFile.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFile.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFS.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuFS.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuNtDll.cpp" "${CXBXR_ROOT_DIR}/src/core/kernel/support/EmuNtDll.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/NativeHandle.cpp"
"${CXBXR_ROOT_DIR}/src/core/kernel/support/PatchRdtsc.cpp"
"${CXBXR_ROOT_DIR}/src/devices/ADM1032Device.cpp" "${CXBXR_ROOT_DIR}/src/devices/ADM1032Device.cpp"
"${CXBXR_ROOT_DIR}/src/devices/Chihiro/JvsIO.cpp"
"${CXBXR_ROOT_DIR}/src/devices/Chihiro/MediaBoard.cpp"
"${CXBXR_ROOT_DIR}/src/devices/EEPROMDevice.cpp" "${CXBXR_ROOT_DIR}/src/devices/EEPROMDevice.cpp"
"${CXBXR_ROOT_DIR}/src/devices/network/NVNetDevice.cpp" "${CXBXR_ROOT_DIR}/src/devices/EmuNVNet.cpp"
"${CXBXR_ROOT_DIR}/src/devices/MCPXDevice.cpp" "${CXBXR_ROOT_DIR}/src/devices/MCPXDevice.cpp"
"${CXBXR_ROOT_DIR}/src/devices/PCIBus.cpp" "${CXBXR_ROOT_DIR}/src/devices/PCIBus.cpp"
"${CXBXR_ROOT_DIR}/src/devices/PCIDevice.cpp" "${CXBXR_ROOT_DIR}/src/devices/PCIDevice.cpp"
@ -393,8 +332,6 @@ file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_ROOT_DIR}/src/devices/usb/OHCI.cpp" "${CXBXR_ROOT_DIR}/src/devices/usb/OHCI.cpp"
"${CXBXR_ROOT_DIR}/src/devices/usb/USBDevice.cpp" "${CXBXR_ROOT_DIR}/src/devices/usb/USBDevice.cpp"
"${CXBXR_ROOT_DIR}/src/devices/usb/XidGamepad.cpp" "${CXBXR_ROOT_DIR}/src/devices/usb/XidGamepad.cpp"
#NOTE: These files are direct includes inside nv2a.cpp file. If we comment them out, we will have compile errors.
#"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_DEBUG.cpp" #"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_DEBUG.cpp"
#"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PBUS.cpp" #"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PBUS.cpp"
#"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PCOUNTER.cpp" #"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PCOUNTER.cpp"
@ -416,7 +353,6 @@ file (GLOB CXBXR_SOURCE_EMU
#"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PVIDEO.cpp" #"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PVIDEO.cpp"
#"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PVPE.cpp" #"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_PVPE.cpp"
#"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_USER.cpp" #"${CXBXR_ROOT_DIR}/src/devices/video/EmuNV2A_USER.cpp"
"${CXBXR_ROOT_DIR}/src/devices/video/nv2a.cpp" "${CXBXR_ROOT_DIR}/src/devices/video/nv2a.cpp"
"${CXBXR_ROOT_DIR}/src/devices/video/nv2a_debug.cpp" "${CXBXR_ROOT_DIR}/src/devices/video/nv2a_debug.cpp"
"${CXBXR_ROOT_DIR}/src/devices/video/nv2a_psh.cpp" "${CXBXR_ROOT_DIR}/src/devices/video/nv2a_psh.cpp"
@ -426,84 +362,39 @@ file (GLOB CXBXR_SOURCE_EMU
"${CXBXR_ROOT_DIR}/src/devices/video/swizzle.cpp" "${CXBXR_ROOT_DIR}/src/devices/video/swizzle.cpp"
"${CXBXR_ROOT_DIR}/src/devices/x86/EmuX86.cpp" "${CXBXR_ROOT_DIR}/src/devices/x86/EmuX86.cpp"
"${CXBXR_ROOT_DIR}/src/devices/Xbox.cpp" "${CXBXR_ROOT_DIR}/src/devices/Xbox.cpp"
# Temporary usage for need ReserveAddressRanges func with cxbx.exe's emulation.
"${CXBXR_ROOT_DIR}/src/common/ReserveAddressRanges.cpp"
) )
option(BUILD_CXBXR_DEBUGGER "Build cxbxr-debugger tool (with cheat table support)")
if(BUILD_CXBXR_DEBUGGER)
message(DEPRECATION "The Cxbxr-Debugger tool will eventually be removed from the upstream branch.")
endif()
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbx") add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbx")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-ldr") # Issues with compile (the same with develop branch) and
# for some reason did not put the files into virtual folder?
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/cxbxr-emu") # Might need to put the list in the source folder for workaround fix.
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
set(cxbxr_INSTALL_files "COPYING" "README.md") #add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/projects/debugger")
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src/CxbxDebugger")
# Cxbx-Reloaded project with third-party libraries endif()
set_target_properties(cxbx cxbxr-ldr cxbxr-emu misc-batch SDL2 subhook libXbSymbolDatabase libtommath libtomcrypt imgui libusb
PROPERTIES FOLDER Cxbx-Reloaded
)
set_target_properties(nv2a_vsh_emulator nv2a_vsh_disassembler nv2a_vsh_cpu
PROPERTIES FOLDER Cxbx-Reloaded/nv2a_vsh
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Configure startup project # Configure startup project
set_property(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PROPERTY VS_STARTUP_PROJECT cxbx) set_property(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" PROPERTY VS_STARTUP_PROJECT cxbx)
endif() endif()
# Check if generator is Visual Studio then enable Cxbxr-Debugger project. if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
# Since C# is currently supported with Visual Studio for now. # Refuse to exclude due to install is not set to optional
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])" AND BUILD_CXBXR_DEBUGGER) #set_target_properties(cstool
# Issues with compile (the same with develop branch) and # PROPERTIES EXCLUDE_FROM_ALL TRUE
# for some reason did not put the files into virtual folder? #)
# Might need to put the list in the source folder for workaround fix. set_target_properties(Tests_cs_x86
add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/src/CxbxDebugger") PROPERTIES EXCLUDE_FROM_ALL TRUE
)
set_target_properties(Tests_cs_x86 # Cxbx-Debugger project with third-party libraries
PROPERTIES EXCLUDE_FROM_ALL TRUE set_target_properties(cxbxr-debugger cs_x86 Tests_cs_x86 capstone-shared cstool
) PROPERTIES FOLDER Cxbx-Reloaded/debugger
)
# Cxbx-Debugger project with third-party libraries
set_target_properties(cxbxr-debugger cs_x86 Tests_cs_x86 capstone-shared
PROPERTIES FOLDER Cxbx-Reloaded/debugger
)
endif() endif()
install(FILES ${cxbxr_INSTALL_files} # Cxbx-Reloaded project with third-party libraries
DESTINATION bin set_target_properties(cxbx subhook XbSymbolDatabase libtommath libtomcrypt
) PROPERTIES FOLDER Cxbx-Reloaded
# Copy HLSL files to the output directory, which are loaded at runtime
set(CXBXR_HLSL_FILES ${CXBXR_HEADER_EMU})
list(FILTER CXBXR_HLSL_FILES INCLUDE REGEX ".*/src/core/hle/D3D8/Direct3D9/[^/]+\.hlsli?")
add_custom_command(
TARGET misc-batch POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/hlsl
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/hlsl"
# These files can be edited.
# Create backup copies for convenience of restoring original shader behaviour.
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/hlsl/backup
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CXBXR_HLSL_FILES} "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/hlsl/backup"
)
install(DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/hlsl DESTINATION bin)
set(cxbxr_GLEW_DLL "${CMAKE_SOURCE_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll")
install(PROGRAMS ${cxbxr_GLEW_DLL}
DESTINATION bin
)
install(PROGRAMS $<TARGET_FILE_DIR:cxbx>/${CMAKE_SHARED_LIBRARY_PREFIX}subhook${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION bin
)
install(PROGRAMS $<TARGET_FILE_DIR:cxbx>/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION bin
) )

View File

@ -7,7 +7,7 @@ Cxbx was initiated by Caustik. Dxbx was initiated by shadowtj.
The following contributors are grouped per project and listed in alphabetical order, The following contributors are grouped per project and listed in alphabetical order,
based on sources like https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/graphs/contributors , based on sources like https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/graphs/contributors ,
http://www.caustik.com/cxbx/about.htm , https://emulation.gametechwiki.com/index.php/Cxbx , http://www.caustik.com/cxbx/about.htm , http://emulation.gametechwiki.com/index.php/Cxbx ,
and https://github.com/PatrickvL/Dxbx/graphs/contributors . and https://github.com/PatrickvL/Dxbx/graphs/contributors .
@ -52,7 +52,6 @@ PatrickvL (Patrick van Logchem)
phire (Scott Mansell) phire (Scott Mansell)
RadWolfie RadWolfie
revel8n revel8n
Silent (CookiePLMonster)
StrikerX3 (Ivan Roberto de Oliveira) StrikerX3 (Ivan Roberto de Oliveira)
TotalCaesar659 TotalCaesar659
Voxel9 (Voxel) Voxel9 (Voxel)
@ -62,7 +61,7 @@ x1nixmzeng
Cxbx-Reloaded Supporters: Cxbx-Reloaded Supporters:
Cedric Wilson Cedric Wilson
Cisco Martinez Cisco Martinez
Cody Dale Barton Cody Dale Barton
Elijah Chondropoulos Elijah Chondropoulos
Jacob Kelly Jacob Kelly
@ -73,7 +72,7 @@ Kenneth Edmonds
Kyle Lenhardt Kyle Lenhardt
Manny Calavera Manny Calavera
Mark Knasiak Mark Knasiak
Marko V. Marko V.
Matt Coady Matt Coady
Roman Guivan Roman Guivan
Taylor Stock Taylor Stock

View File

@ -1,57 +1,47 @@
# Cxbx-Reloaded - Original Xbox Emulator # Cxbx-Reloaded - Original Xbox Emulator
[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/COPYING) [![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://img.shields.io/badge/License-GPL%20v2-blue.svg)
[![GitHub Actions](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/workflows/GitHub%20CI/badge.svg?event=push)](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/actions?query=event%3Apush+workflow%3A%22GitHub+CI%22) [![GitHub Actions](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/workflows/GitHub%20CI/badge.svg)](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/actions)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/iao43irxl3umbp33?svg=true)](https://ci.appveyor.com/project/SoullessSentinel/cxbx-reloaded)
[![Azure](https://Cxbx-Reloaded.visualstudio.com/Cxbx-Reloaded/_apis/build/status/Cxbx-Reloaded.Cxbx-Reloaded?branchName=develop)](https://Cxbx-Reloaded.visualstudio.com/Cxbx-Reloaded/_build/latest?definitionId=7&branchName=develop)
[![Travis](https://travis-ci.org/Cxbx-Reloaded/Cxbx-Reloaded.svg?branch=develop)](https://travis-ci.org/Cxbx-Reloaded/Cxbx-Reloaded)
[![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?logo=discord)](https://discord.gg/26Xjx23) [![Discord](https://img.shields.io/badge/chat-on%20discord-7289da.svg?logo=discord)](https://discord.gg/26Xjx23)
Cxbx-Reloaded is an emulator for running Microsoft Xbox (and eventually, Chihiro) games on Microsoft Windows and Wine. Cxbx-Reloaded is an emulator for running Microsoft Xbox (and eventually, Chihiro) games on Microsoft Windows.
## System Requirements ## System Requirements
### Minimum ### Minimum
* OS: Windows 7+ x64, or x86-64 Linux with Wine. 32-bit is not supported. * OS: Windows 7+ x64. 32-bit is not supported.
* MacOS with Wine is known not to work, and BSD-based systems are untested.
* Also note that Wine is relatively unstable, and it might break compatibility with Cxbx-Reloaded at any time without warning.
* GPU: Direct3D 9.0c with Pixel Shader Model 2.x, and Vertex Shader Model 3.0. * GPU: Direct3D 9.0c with Pixel Shader Model 2.x, and Vertex Shader Model 3.0.
## Prerequisites ### Prerequisites
### Windows * [32-bit (x86) Visual C++ 2019 Redistributable](https://aka.ms/vs/16/release/vc_redist.x86.exe)
* [32-bit (x86) Visual C++ 2022 Redistributable](https://aka.ms/vs/17/release/vc_redist.x86.exe)
* [Npcap *(used for network emulation)*](https://nmap.org/npcap/#download) * [Npcap *(used for network emulation)*](https://nmap.org/npcap/#download)
* Make sure to enable winpcap compatibility mode. * Make sure to enable winpcap compatibility mode!
* [WinUSB compliant driver](https://github.com/libusb/libusb/wiki/Windows#Driver_Installation)
* *Optional, only needed for USB pass-through of original Xbox and Steel Battalion controllers.*
### Wine
**Please use the latest stable release version of Wine. If it does not work for you, then roll back to Wine 7.0 which is the last known working version.**<br/>
**There also exists this known [issue](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/2314) which currently prevents savings in some games with the most recent Wine 6.8 and later versions.**
* Winetricks
* `vcrun2019`
* Requires the latest winetricks script.
* `d3dcompiler_47`
* This may be subject to change.
* Winpcap is built-in, no installation is required.
## Automated Builds ## Automated Builds
Cxbx-Reloaded doesn't currently have stable builds, but you can obtain pre-release builds from our official website's download page, or the links below: Cxbx-Reloaded is not yet ready for general release, but the latest development builds can be downloaded using the links below:
* **[Release Builds](https://cxbx-reloaded.co.uk/download)** * **[Latest Development Build](https://ci.appveyor.com/api/projects/SoullessSentinel/cxbx-reloaded/artifacts/Release.zip?branch=develop&job=Configuration:%20Release&pr=false)**
* *[Full build history](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/actions?query=workflow%3A%22GitHub+CI%22)*
* *[Full build history](https://ci.appveyor.com/project/SoullessSentinel/cxbx-reloaded/history)*
## Compatibility ## Compatibility
Cxbx-Reloaded has a [compatibility list](https://cxbx-reloaded.co.uk/compatibility). Cxbx-Reloaded has a [compatibility list](https://github.com/Cxbx-Reloaded/game-compatibility#cxbx-reloaded-game-compatibility-project).
If you would like to submit compatibility reports, please request permission in our Discord server. If you have something to report on a title, please create or update the issue for it there.
Please read the [Readme file](https://github.com/Cxbx-Reloaded/game-compatibility/blob/master/README.md) first!
## Bug Reports ## Bug Reports
Game or software specific issues can be reported in the [compatibility website](https://cxbx-reloaded.co.uk/compatibility). Game or software specific issues can be reported in the [compatibility list](https://github.com/Cxbx-Reloaded/game-compatibility#cxbx-reloaded-game-compatibility-project).
For emulation issues that are not specific to any single piece of software, a bug report can be submitted at [the Cxbx-Reloaded issue tracker](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues). For emulation issues that are not specific to any single piece of software, a bug report can be submitted at [the Cxbx-Reloaded issue tracker](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues).
<!--Make sure to follow the issue template and that it contains:
* The build tested with, error message displayed (if any)
* **You can copy and paste any popup messages. However, please keep it clean by pasting and trimming down to only the message itself.**
* Screenshots
* Optional unless there are graphic bugs for reference.
**Failure to follow the template will auto close your ticket.**--> Make sure bug reports contain:
* The build tested with, error message displayed (if any)
* Screenshots
* Xbe dump (created via `Edit > Dump Xbe Info To > File`)
* Kernel Debug log (created when running a game with `View > Debug Output (Kernel) > File` selected).
## Additional information ## Additional information
Cxbx-Reloaded has a [wiki](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/wiki) containing various subjects and background information. Cxbx-Reloaded has a [wiki](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/wiki) containing various subjects and background information.
@ -63,18 +53,19 @@ We welcome contributions, large and small.
If you want to do some coding, be sure to read the [Developer notes](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/wiki/Developer-notes). If you want to do some coding, be sure to read the [Developer notes](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/wiki/Developer-notes).
**IMPORTANT: Pull-Requests containing code derived from XQEMU will _not_ be approved until an agreement is reached to make work mutually beneficial. This includes updates to existing XQEMU derived code. We should not/will not become a hostile fork.** **IMPORTANT: Pull-Requests containing code derived from XQEMU will _not_ be approved until an agreement is reached to make work mutually beneficial. this includes updates to existing XQEMU derived code. We should not/will not become a hostile fork.**
Please contact us before you start working on something, so we can make sure your work is going to be accepted once finished. Please contact us before you start working on something, so we can make sure your work is going to be accepted once finished.
### Main Prerequisites ### Main Prerequisites
1. [Git for Windows](https://git-scm.com) 1. [Git for Windows](https://git-scm.com)
2. [CMake](https://cmake.org) 2. [CMake](https://cmake.org)
* Some IDEs already have CMake support, this is optional. * Some IDEs already have CMake support, so this is optional.
### Fetching the code ### Fetching the code
1. Run the following command in the command line: 1. Run the following command in the command line:
<br>`git clone --recurse-submodules https://github.com/Cxbx-Reloaded/Cxbx-Reloaded.git`
`git clone --recurse-submodules https://github.com/Cxbx-Reloaded/Cxbx-Reloaded.git`
* Please note the `--recurse-submodules` parameter. This is required to fetch submodules. * Please note the `--recurse-submodules` parameter. This is required to fetch submodules.
* If Cxbx-Reloaded was checked out without submodules, they can be updated/fetched with the following command: * If Cxbx-Reloaded was checked out without submodules, they can be updated/fetched with the following command:
@ -83,13 +74,12 @@ Please contact us before you start working on something, so we can make sure you
### Compiling ### Compiling
#### Windows #### Windows
Don't open `CMakeLists.txt` from Visual Studio, as it won't generate files in the `build` directory. **NOTE:** Don't open `CMakeLists.txt` from Visual Studio, as it won't generate files in the `build` directory.
##### Prerequisites ##### Prerequisites
1. [Visual Studio](https://visualstudio.microsoft.com/downloads/) 2022 1. [Visual Studio](https://visualstudio.microsoft.com/downloads/) 2017 or later
* C++ and C# desktop development * C++ and C# desktop development
* Windows Universal CRT SDK * Windows Universal CRT SDK
* Windows 11 SDK (10.0.22621.0) or later
* C++ CMake tools for Windows * C++ CMake tools for Windows
* *Optional if CMake is installed* * *Optional if CMake is installed*
* [Microsoft Child Process Debugging Power Tool](https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool) * [Microsoft Child Process Debugging Power Tool](https://marketplace.visualstudio.com/items?itemName=vsdbgplat.MicrosoftChildProcessDebuggingPowerTool)
@ -97,11 +87,11 @@ Don't open `CMakeLists.txt` from Visual Studio, as it won't generate files in th
##### Generate Visual Studio files ##### Generate Visual Studio files
1. If you don't have CMake installed, open `___ Native Tools Command Prompt for VS 20##`. 1. If you don't have CMake installed, open `___ Native Tools Command Prompt for VS 20##`.
2. `cd` to the Cxbx-Reloaded directory. 2. `cd` to the Cxbx-Reloaded directory.
3. Run the following command: `cmake -B build -G "Visual Studio 17 2022" -A Win32` \ 3. Run these commands.
**NOTES**: 1. `mkdir build & cd build`
* VS2022 17.0 or later is required. 2. `cmake .. -G "Visual Studio 16 2019" -A Win32`
* To build the Cxbx-Reloaded Debugger tool, add the variable `-DBUILD_CXBXR_DEBUGGER=ON` to the above command. * Visual Studio 2019 16.1 or later has CMake 3.14 bundled, and is required for the Visual Studio 2019 generator.
* _This debugger tool is deprecated and will be eventually removed, please use the Visual Studio debugger instead._ * Use `cmake .. -G "Visual Studio 15 2017" -A Win32` for Visual Studio 2017.
4. Open `Cxbx-Reloaded.sln` from the `build` directory. 4. Open `Cxbx-Reloaded.sln` from the `build` directory.
5. Select the Release configuration, then click Build. 5. Select the Release configuration, then click Build.
* Debug builds are **significantly slower, and only for developers**. * Debug builds are **significantly slower, and only for developers**.
@ -116,5 +106,3 @@ You can support [Luke Usher](https://github.com/LukeUsher), initiator of Cxbx-Re
* All contributors to the original Cxbx and [Dxbx](https://github.com/PatrickvL/Dxbx) projects. Without them Cxbx-Reloaded would not exist at all. * All contributors to the original Cxbx and [Dxbx](https://github.com/PatrickvL/Dxbx) projects. Without them Cxbx-Reloaded would not exist at all.
* [XQEMU](https://github.com/xqemu/xqemu) - While the majority of Cxbx-R is our own work (Kernel, HLE, etc), the NV2A LLE and NVNet implementation are primarily the work of the XQEMU developers. * [XQEMU](https://github.com/xqemu/xqemu) - While the majority of Cxbx-R is our own work (Kernel, HLE, etc), the NV2A LLE and NVNet implementation are primarily the work of the XQEMU developers.
* [XboxDev](https://github.com/xboxdev) - Providing Xbox hardware research & useful tooling. * [XboxDev](https://github.com/xboxdev) - Providing Xbox hardware research & useful tooling.
* [XbSymbolDatabase](https://github.com/Cxbx-Reloaded/XbSymbolDatabase) - Providing support to detect symbols across XDK builds from reverse engineered retail titles.
* [Xbox Kernel Test Suite](https://github.com/Cxbx-Reloaded/xbox_kernel_test_suite) - Making accurate tests on hardware to compare against cxbxr's kernel implementation.

View File

@ -47,9 +47,6 @@ GOTO :helpInfo
) )
:: Check second arg (Visual Studio version) :: Check second arg (Visual Studio version)
IF "%2"=="2022" (
SET msvc_compiler=Visual Studio 17 2022
)
IF "%2"=="2019" ( IF "%2"=="2019" (
SET msvc_compiler=Visual Studio 16 2019 SET msvc_compiler=Visual Studio 16 2019
) )
@ -57,7 +54,7 @@ IF "%2"=="2017" (
SET msvc_compiler=Visual Studio 15 2017 SET msvc_compiler=Visual Studio 15 2017
) )
IF "%2"=="" ( IF "%2"=="" (
SET msvc_compiler=Visual Studio 16 2019 SET msvc_compiler=Visual Studio 15 2017
) )
IF NOT DEFINED msvc_compiler ( IF NOT DEFINED msvc_compiler (
GOTO :helpInfo GOTO :helpInfo
@ -103,9 +100,8 @@ ECHO - ARM
ECHO - ARM64 ECHO - ARM64
ECHO --- ECHO ---
ECHO arg2 ECHO arg2
ECHO - 2022
ECHO - 2019
ECHO - 2017 ECHO - 2017
ECHO - 2019
PAUSE PAUSE
GOTO :end GOTO :end

View File

@ -12,41 +12,34 @@
#ifndef XBOXKRNL_DBG_H #ifndef XBOXKRNL_DBG_H
#define XBOXKRNL_DBG_H #define XBOXKRNL_DBG_H
#include "types.h" XBSYSAPI EXPORTNUM(5) VOID NTAPI DbgBreakPoint();
XBSYSAPI EXPORTNUM(6) VOID NTAPI DbgBreakPointWithStatus
namespace xbox
{
XBSYSAPI EXPORTNUM(5) void_xt NTAPI DbgBreakPoint();
XBSYSAPI EXPORTNUM(6) void_xt NTAPI DbgBreakPointWithStatus
( (
IN ulong_xt Status IN ULONG Status
); );
XBSYSAPI EXPORTNUM(7) ntstatus_xt NTAPI DbgLoadImageSymbols XBSYSAPI EXPORTNUM(7) NTSTATUS NTAPI DbgLoadImageSymbols
( (
IN PANSI_STRING Name, IN PANSI_STRING Name,
IN PVOID Base, IN PVOID Base,
IN ulong_ptr_xt ProcessId IN ULONG_PTR ProcessId
); );
XBSYSAPI EXPORTNUM(8) ulong_xt _cdecl DbgPrint XBSYSAPI EXPORTNUM(8) ULONG _cdecl DbgPrint
( (
PCHAR Format, ... PCHAR Format, ...
); );
XBSYSAPI EXPORTNUM(10) ulong_xt NTAPI DbgPrompt XBSYSAPI EXPORTNUM(10) ULONG NTAPI DbgPrompt
( (
IN PCCH Prompt, IN PCCH Prompt,
OUT PCH Response, OUT PCH Response,
IN ulong_xt MaximumResponseLength IN ULONG MaximumResponseLength
); );
XBSYSAPI EXPORTNUM(11) void_xt NTAPI DbgUnLoadImageSymbols XBSYSAPI EXPORTNUM(11) VOID NTAPI DbgUnLoadImageSymbols
( (
IN PANSI_STRING Name, IN PANSI_STRING Name,
IN PVOID Base, IN PVOID Base,
IN ulong_ptr_xt ProcessId IN ULONG_PTR ProcessId
); );
}
#endif #endif

View File

@ -12,17 +12,12 @@
#ifndef XBOXKRNL_EX_H #ifndef XBOXKRNL_EX_H
#define XBOXKRNL_EX_H #define XBOXKRNL_EX_H
#include "types.h" XBSYSAPI EXPORTNUM(12) NTSTATUS NTAPI ExAcquireReadWriteLockExclusive
namespace xbox
{
XBSYSAPI EXPORTNUM(12) void_xt NTAPI ExAcquireReadWriteLockExclusive
( (
IN PERWLOCK ReadWriteLock IN PERWLOCK ReadWriteLock
); );
XBSYSAPI EXPORTNUM(13) void_xt NTAPI ExAcquireReadWriteLockShared XBSYSAPI EXPORTNUM(13) NTSTATUS NTAPI ExAcquireReadWriteLockShared
( (
IN PERWLOCK ReadWriteLock IN PERWLOCK ReadWriteLock
); );
@ -36,7 +31,7 @@ XBSYSAPI EXPORTNUM(13) void_xt NTAPI ExAcquireReadWriteLockShared
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(14) PVOID NTAPI ExAllocatePool XBSYSAPI EXPORTNUM(14) PVOID NTAPI ExAllocatePool
( (
IN size_xt NumberOfBytes IN SIZE_T NumberOfBytes
); );
// ****************************************************************** // ******************************************************************
@ -48,8 +43,8 @@ XBSYSAPI EXPORTNUM(14) PVOID NTAPI ExAllocatePool
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(15) PVOID NTAPI ExAllocatePoolWithTag XBSYSAPI EXPORTNUM(15) PVOID NTAPI ExAllocatePoolWithTag
( (
IN size_xt NumberOfBytes, IN SIZE_T NumberOfBytes,
IN ulong_xt Tag IN ULONG Tag
); );
XBSYSAPI EXPORTNUM(16) OBJECT_TYPE ExEventObjectType; XBSYSAPI EXPORTNUM(16) OBJECT_TYPE ExEventObjectType;
@ -61,7 +56,7 @@ XBSYSAPI EXPORTNUM(16) OBJECT_TYPE ExEventObjectType;
// * Deallocates a block of pool memory // * Deallocates a block of pool memory
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(17) void_xt NTAPI ExFreePool XBSYSAPI EXPORTNUM(17) VOID NTAPI ExFreePool
( (
IN PVOID P IN PVOID P
); );
@ -69,7 +64,7 @@ XBSYSAPI EXPORTNUM(17) void_xt NTAPI ExFreePool
// ****************************************************************** // ******************************************************************
// * 0x0012 - ExInitializeReadWriteLock() // * 0x0012 - ExInitializeReadWriteLock()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(18) void_xt NTAPI ExInitializeReadWriteLock XBSYSAPI EXPORTNUM(18) VOID NTAPI ExInitializeReadWriteLock
( (
IN PERWLOCK ReadWriteLock IN PERWLOCK ReadWriteLock
); );
@ -83,14 +78,14 @@ XBSYSAPI EXPORTNUM(19) LARGE_INTEGER NTAPI ExInterlockedAddLargeInteger
); );
// Source:ReactOS // Source:ReactOS
XBSYSAPI EXPORTNUM(20) void_xt FASTCALL ExInterlockedAddLargeStatistic XBSYSAPI EXPORTNUM(20) VOID FASTCALL ExInterlockedAddLargeStatistic
( (
IN PLARGE_INTEGER Addend, IN PLARGE_INTEGER Addend,
IN ulong_xt Increment IN ULONG Increment
); );
// Source:ReactOS // Source:ReactOS
XBSYSAPI EXPORTNUM(21) longlong_xt FASTCALL ExInterlockedCompareExchange64 XBSYSAPI EXPORTNUM(21) LONGLONG FASTCALL ExInterlockedCompareExchange64
( (
IN OUT PLONGLONG Destination, IN OUT PLONGLONG Destination,
IN PLONGLONG Exchange, IN PLONGLONG Exchange,
@ -102,7 +97,7 @@ XBSYSAPI EXPORTNUM(22) OBJECT_TYPE ExMutantObjectType;
// ****************************************************************** // ******************************************************************
// * ExQueryPoolBlockSize // * ExQueryPoolBlockSize
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(23) ulong_xt NTAPI ExQueryPoolBlockSize XBSYSAPI EXPORTNUM(23) ULONG NTAPI ExQueryPoolBlockSize
( (
IN PVOID PoolBlock IN PVOID PoolBlock
); );
@ -110,36 +105,36 @@ XBSYSAPI EXPORTNUM(23) ulong_xt NTAPI ExQueryPoolBlockSize
// ****************************************************************** // ******************************************************************
// * 0x0018 - ExQueryNonVolatileSetting() // * 0x0018 - ExQueryNonVolatileSetting()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(24) ntstatus_xt NTAPI ExQueryNonVolatileSetting XBSYSAPI EXPORTNUM(24) NTSTATUS NTAPI ExQueryNonVolatileSetting
( (
IN dword_xt ValueIndex, IN DWORD ValueIndex,
OUT dword_xt *Type, OUT DWORD *Type,
OUT PVOID Value, OUT PVOID Value,
IN size_xt ValueLength, IN SIZE_T ValueLength,
OUT PSIZE_T ResultLength OPTIONAL OUT PSIZE_T ResultLength OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * ExReadWriteRefurbInfo // * ExReadWriteRefurbInfo
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(25) ntstatus_xt NTAPI ExReadWriteRefurbInfo XBSYSAPI EXPORTNUM(25) NTSTATUS NTAPI ExReadWriteRefurbInfo
( (
IN OUT PXBOX_REFURB_INFO pRefurbInfo, IN OUT PXBOX_REFURB_INFO pRefurbInfo,
IN ulong_xt dwBufferSize, IN ULONG dwBufferSize,
IN boolean_xt bIsWriteMode IN BOOLEAN bIsWriteMode
); );
XBSYSAPI EXPORTNUM(26) void_xt NTAPI ExRaiseException XBSYSAPI EXPORTNUM(26) VOID NTAPI ExRaiseException
( (
IN PEXCEPTION_RECORD ExceptionRecord IN PEXCEPTION_RECORD ExceptionRecord
); );
XBSYSAPI EXPORTNUM(27) void_xt NTAPI ExRaiseStatus XBSYSAPI EXPORTNUM(27) VOID NTAPI ExRaiseStatus
( (
IN ntstatus_xt Status IN NTSTATUS Status
); );
XBSYSAPI EXPORTNUM(28) void_xt NTAPI ExReleaseReadWriteLock XBSYSAPI EXPORTNUM(28) NTSTATUS NTAPI ExReleaseReadWriteLock
( (
IN PERWLOCK ReadWriteLock IN PERWLOCK ReadWriteLock
); );
@ -147,12 +142,12 @@ XBSYSAPI EXPORTNUM(28) void_xt NTAPI ExReleaseReadWriteLock
// ****************************************************************** // ******************************************************************
// * 0x001D - ExSaveNonVolatileSetting() // * 0x001D - ExSaveNonVolatileSetting()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(29) ntstatus_xt NTAPI ExSaveNonVolatileSetting XBSYSAPI EXPORTNUM(29) NTSTATUS NTAPI ExSaveNonVolatileSetting
( (
IN dword_xt ValueIndex, IN DWORD ValueIndex,
IN dword_xt Type, IN DWORD Type,
IN PVOID Value, IN PVOID Value,
IN size_xt ValueLength IN SIZE_T ValueLength
); );
XBSYSAPI EXPORTNUM(30) OBJECT_TYPE ExSemaphoreObjectType; XBSYSAPI EXPORTNUM(30) OBJECT_TYPE ExSemaphoreObjectType;
@ -185,33 +180,33 @@ XBSYSAPI EXPORTNUM(34) PLIST_ENTRY FASTCALL ExfInterlockedRemoveHeadList
IN PLIST_ENTRY ListHead IN PLIST_ENTRY ListHead
); );
XBSYSAPI EXPORTNUM(51) long_xt FASTCALL KRNL(InterlockedCompareExchange) XBSYSAPI EXPORTNUM(51) LONG FASTCALL KRNL(InterlockedCompareExchange)
( (
IN OUT volatile PLONG Destination, IN OUT volatile PLONG Destination,
IN long_xt Exchange, IN LONG Exchange,
IN long_xt Comparand IN LONG Comparand
); );
XBSYSAPI EXPORTNUM(52) long_xt FASTCALL KRNL(InterlockedDecrement) XBSYSAPI EXPORTNUM(52) LONG FASTCALL KRNL(InterlockedDecrement)
( (
IN OUT PLONG Addend IN OUT PLONG Addend
); );
XBSYSAPI EXPORTNUM(53) long_xt FASTCALL KRNL(InterlockedIncrement) XBSYSAPI EXPORTNUM(53) LONG FASTCALL KRNL(InterlockedIncrement)
( (
IN OUT PLONG Addend IN OUT PLONG Addend
); );
XBSYSAPI EXPORTNUM(54) long_xt FASTCALL KRNL(InterlockedExchange) XBSYSAPI EXPORTNUM(54) LONG FASTCALL KRNL(InterlockedExchange)
( (
IN volatile PLONG Destination, IN volatile PLONG Destination,
IN long_xt Value IN LONG Value
); );
XBSYSAPI EXPORTNUM(55) long_xt FASTCALL KRNL(InterlockedExchangeAdd) XBSYSAPI EXPORTNUM(55) LONG FASTCALL KRNL(InterlockedExchangeAdd)
( (
IN volatile PLONG Addend, IN volatile PLONG Addend,
IN long_xt Value IN LONG Value
); );
// Dxbx Note : The Xbox1 SINGLE_LIST strucures are the same as in WinNT // Dxbx Note : The Xbox1 SINGLE_LIST strucures are the same as in WinNT
@ -231,8 +226,6 @@ XBSYSAPI EXPORTNUM(58) SLIST_ENTRY * FASTCALL KRNL(InterlockedPushEntrySList)
IN PSLIST_ENTRY ListEntry IN PSLIST_ENTRY ListEntry
); );
}
#endif #endif

View File

@ -12,21 +12,16 @@
#ifndef XBOXKRNL_HAL_H #ifndef XBOXKRNL_HAL_H
#define XBOXKRNL_HAL_H #define XBOXKRNL_HAL_H
#include "types.h"
namespace xbox
{
// ****************************************************************** // ******************************************************************
// * HalReadSMCTrayState // * HalReadSMCTrayState
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(9) ntstatus_xt NTAPI HalReadSMCTrayState XBSYSAPI EXPORTNUM(9) VOID NTAPI HalReadSMCTrayState
( (
dword_xt* State, DWORD* State,
dword_xt* Count DWORD* Count
); );
XBSYSAPI EXPORTNUM(38) void_xt FASTCALL HalClearSoftwareInterrupt XBSYSAPI EXPORTNUM(38) VOID FASTCALL HalClearSoftwareInterrupt
( (
KIRQL Request KIRQL Request
); );
@ -34,73 +29,73 @@ XBSYSAPI EXPORTNUM(38) void_xt FASTCALL HalClearSoftwareInterrupt
// ****************************************************************** // ******************************************************************
// * 0x0027 - HalDisableSystemInterrupt() // * 0x0027 - HalDisableSystemInterrupt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(39) void_xt NTAPI HalDisableSystemInterrupt XBSYSAPI EXPORTNUM(39) VOID NTAPI HalDisableSystemInterrupt
( (
IN ulong_xt BusInterruptLevel IN ULONG BusInterruptLevel
); );
XBSYSAPI EXPORTNUM(40) ulong_xt HalDiskCachePartitionCount; XBSYSAPI EXPORTNUM(40) ULONG HalDiskCachePartitionCount;
XBSYSAPI EXPORTNUM(41) PANSI_STRING HalDiskModelNumber; XBSYSAPI EXPORTNUM(41) PANSI_STRING HalDiskModelNumber;
XBSYSAPI EXPORTNUM(42) PANSI_STRING HalDiskSerialNumber; XBSYSAPI EXPORTNUM(42) PANSI_STRING HalDiskSerialNumber;
// ****************************************************************** // ******************************************************************
// * 0x002B - HalEnableSystemInterrupt() // * 0x002B - HalEnableSystemInterrupt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(43) void_xt NTAPI HalEnableSystemInterrupt XBSYSAPI EXPORTNUM(43) VOID NTAPI HalEnableSystemInterrupt
( (
IN ulong_xt BusInterruptLevel, IN ULONG BusInterruptLevel,
IN KINTERRUPT_MODE InterruptMode IN KINTERRUPT_MODE InterruptMode
); );
// ****************************************************************** // ******************************************************************
// * HalGetInterruptVector // * HalGetInterruptVector
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(44) ulong_xt NTAPI HalGetInterruptVector XBSYSAPI EXPORTNUM(44) ULONG NTAPI HalGetInterruptVector
( (
IN ulong_xt BusInterruptLevel, IN ULONG BusInterruptLevel,
OUT PKIRQL Irql OUT PKIRQL Irql
); );
// ****************************************************************** // ******************************************************************
// * HalReadSMBusValue // * HalReadSMBusValue
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(45) ntstatus_xt NTAPI HalReadSMBusValue XBSYSAPI EXPORTNUM(45) NTSTATUS NTAPI HalReadSMBusValue
( (
IN uchar_xt Address, IN UCHAR Address,
IN uchar_xt Command, IN UCHAR Command,
IN boolean_xt WriteWord, IN BOOLEAN WriteWord,
OUT PULONG DataValue OUT PULONG DataValue
); );
// ****************************************************************** // ******************************************************************
// * HalReadWritePCISpace // * HalReadWritePCISpace
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(46) void_xt NTAPI HalReadWritePCISpace XBSYSAPI EXPORTNUM(46) VOID NTAPI HalReadWritePCISpace
( (
IN ulong_xt BusNumber, IN ULONG BusNumber,
IN ulong_xt SlotNumber, IN ULONG SlotNumber,
IN ulong_xt RegisterNumber, IN ULONG RegisterNumber,
IN PVOID Buffer, IN PVOID Buffer,
IN ulong_xt Length, IN ULONG Length,
IN boolean_xt WritePCISpace IN BOOLEAN WritePCISpace
); );
typedef void_xt (*PHAL_SHUTDOWN_NOTIFICATION)( typedef VOID (*PHAL_SHUTDOWN_NOTIFICATION)(
IN struct _HAL_SHUTDOWN_REGISTRATION *ShutdownRegistration IN struct _HAL_SHUTDOWN_REGISTRATION *ShutdownRegistration
); );
typedef struct _HAL_SHUTDOWN_REGISTRATION { typedef struct _HAL_SHUTDOWN_REGISTRATION {
PHAL_SHUTDOWN_NOTIFICATION NotificationRoutine; PHAL_SHUTDOWN_NOTIFICATION NotificationRoutine;
long_xt Priority; LONG Priority;
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
} HAL_SHUTDOWN_REGISTRATION, *PHAL_SHUTDOWN_REGISTRATION; } HAL_SHUTDOWN_REGISTRATION, *PHAL_SHUTDOWN_REGISTRATION;
XBSYSAPI EXPORTNUM(47) void_xt NTAPI HalRegisterShutdownNotification( XBSYSAPI EXPORTNUM(47) VOID NTAPI HalRegisterShutdownNotification(
IN PHAL_SHUTDOWN_REGISTRATION ShutdownRegistration, IN PHAL_SHUTDOWN_REGISTRATION ShutdownRegistration,
IN boolean_xt Register IN BOOLEAN Register
); );
XBSYSAPI EXPORTNUM(46) void_xt FASTCALL HalRequestSoftwareInterrupt XBSYSAPI EXPORTNUM(46) VOID FASTCALL HalRequestSoftwareInterrupt
( (
IN KIRQL Request IN KIRQL Request
); );
@ -112,7 +107,7 @@ XBSYSAPI EXPORTNUM(46) void_xt FASTCALL HalRequestSoftwareInterrupt
// * Reboot / Shutdown / Etc // * Reboot / Shutdown / Etc
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(49) void_xt DECLSPEC_NORETURN NTAPI HalReturnToFirmware XBSYSAPI EXPORTNUM(49) VOID DECLSPEC_NORETURN NTAPI HalReturnToFirmware
( (
RETURN_FIRMWARE Routine RETURN_FIRMWARE Routine
); );
@ -120,98 +115,96 @@ XBSYSAPI EXPORTNUM(49) void_xt DECLSPEC_NORETURN NTAPI HalReturnToFirmware
// ****************************************************************** // ******************************************************************
// * HalWriteSMBusValue // * HalWriteSMBusValue
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(50) ntstatus_xt NTAPI HalWriteSMBusValue XBSYSAPI EXPORTNUM(50) NTSTATUS NTAPI HalWriteSMBusValue
( (
uchar_xt Address, UCHAR Address,
uchar_xt Command, UCHAR Command,
boolean_xt WriteWord, BOOLEAN WriteWord,
ulong_xt DataValue ULONG DataValue
); );
// ****************************************************************** // ******************************************************************
// * READ_PORT_BUFFER_UCHAR // * READ_PORT_BUFFER_UCHAR
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(329) void_xt NTAPI READ_PORT_BUFFER_UCHAR XBSYSAPI EXPORTNUM(329) VOID NTAPI READ_PORT_BUFFER_UCHAR
( (
IN dword_xt Port, IN PUCHAR Port,
IN PUCHAR Buffer, IN PUCHAR Buffer,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * READ_PORT_BUFFER_USHORT // * READ_PORT_BUFFER_USHORT
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(330) void_xt NTAPI READ_PORT_BUFFER_USHORT XBSYSAPI EXPORTNUM(330) VOID NTAPI READ_PORT_BUFFER_USHORT
( (
IN dword_xt Port, IN PUSHORT Port,
IN PUSHORT Buffer, IN PUSHORT Buffer,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * READ_PORT_BUFFER_ULONG // * READ_PORT_BUFFER_ULONG
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(331) void_xt NTAPI READ_PORT_BUFFER_ULONG XBSYSAPI EXPORTNUM(331) VOID NTAPI READ_PORT_BUFFER_ULONG
( (
IN dword_xt Port, IN PULONG Port,
IN PULONG Buffer, IN PULONG Buffer,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * WRITE_PORT_BUFFER_UCHAR // * WRITE_PORT_BUFFER_UCHAR
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(332) void_xt NTAPI WRITE_PORT_BUFFER_UCHAR XBSYSAPI EXPORTNUM(332) VOID NTAPI WRITE_PORT_BUFFER_UCHAR
( (
IN dword_xt Port, IN PUCHAR Port,
IN PUCHAR Buffer, IN PUCHAR Buffer,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * WRITE_PORT_BUFFER_USHORT // * WRITE_PORT_BUFFER_USHORT
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(333) void_xt NTAPI WRITE_PORT_BUFFER_USHORT XBSYSAPI EXPORTNUM(333) VOID NTAPI WRITE_PORT_BUFFER_USHORT
( (
IN dword_xt Port, IN PUSHORT Port,
IN PUSHORT Buffer, IN PUSHORT Buffer,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * WRITE_PORT_BUFFER_ULONG // * WRITE_PORT_BUFFER_ULONG
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(334) void_xt NTAPI WRITE_PORT_BUFFER_ULONG XBSYSAPI EXPORTNUM(334) VOID NTAPI WRITE_PORT_BUFFER_ULONG
( (
IN dword_xt Port, IN PULONG Port,
IN PULONG Buffer, IN PULONG Buffer,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * HalBootSMCVideoMode // * HalBootSMCVideoMode
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(356) dword_xt HalBootSMCVideoMode; XBSYSAPI EXPORTNUM(356) DWORD HalBootSMCVideoMode;
XBSYSAPI EXPORTNUM(358) boolean_xt NTAPI HalIsResetOrShutdownPending XBSYSAPI EXPORTNUM(358) BOOLEAN NTAPI HalIsResetOrShutdownPending
( (
); );
XBSYSAPI EXPORTNUM(360) ntstatus_xt NTAPI HalInitiateShutdown XBSYSAPI EXPORTNUM(360) NTSTATUS NTAPI HalInitiateShutdown
( (
); );
XBSYSAPI EXPORTNUM(365) void_xt NTAPI HalEnableSecureTrayEject XBSYSAPI EXPORTNUM(365) VOID NTAPI HalEnableSecureTrayEject
( (
); );
XBSYSAPI EXPORTNUM(366) ntstatus_xt NTAPI HalWriteSMCScratchRegister XBSYSAPI EXPORTNUM(366) NTSTATUS NTAPI HalWriteSMCScratchRegister
( (
IN dword_xt ScratchRegister IN DWORD ScratchRegister
); );
}
#endif #endif

View File

@ -12,17 +12,12 @@
#ifndef XBOXKRNL_IO_H #ifndef XBOXKRNL_IO_H
#define XBOXKRNL_IO_H #define XBOXKRNL_IO_H
#include "types.h"
namespace xbox
{
// ****************************************************************** // ******************************************************************
// * 0x003B - IoAllocateIrp() // * 0x003B - IoAllocateIrp()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(59) PVOID NTAPI IoAllocateIrp XBSYSAPI EXPORTNUM(59) PVOID NTAPI IoAllocateIrp
( (
IN cchar_xt StackSize IN CCHAR StackSize
); );
// ****************************************************************** // ******************************************************************
@ -30,10 +25,10 @@ XBSYSAPI EXPORTNUM(59) PVOID NTAPI IoAllocateIrp
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(60) PVOID NTAPI IoBuildAsynchronousFsdRequest XBSYSAPI EXPORTNUM(60) PVOID NTAPI IoBuildAsynchronousFsdRequest
( (
IN ulong_xt MajorFunction, IN ULONG MajorFunction,
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
OUT PVOID Buffer OPTIONAL, OUT PVOID Buffer OPTIONAL,
IN ulong_xt Length, IN ULONG Length,
OUT PLARGE_INTEGER StartingOffset OPTIONAL, OUT PLARGE_INTEGER StartingOffset OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock OPTIONAL OUT PIO_STATUS_BLOCK IoStatusBlock OPTIONAL
); );
@ -43,13 +38,13 @@ XBSYSAPI EXPORTNUM(60) PVOID NTAPI IoBuildAsynchronousFsdRequest
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(61) PVOID NTAPI IoBuildDeviceIoControlRequest XBSYSAPI EXPORTNUM(61) PVOID NTAPI IoBuildDeviceIoControlRequest
( (
IN ulong_xt IoControlCode, IN ULONG IoControlCode,
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PVOID InputBuffer OPTIONAL, IN PVOID InputBuffer OPTIONAL,
IN ulong_xt InputBufferLength, IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL, OUT PVOID OutputBuffer OPTIONAL,
IN ulong_xt OutputBufferLength OPTIONAL, IN ULONG OutputBufferLength OPTIONAL,
IN boolean_xt InternalDeviceIoControl, IN BOOLEAN InternalDeviceIoControl,
IN PKEVENT Event, IN PKEVENT Event,
OUT PIO_STATUS_BLOCK IoStatusBlock OPTIONAL OUT PIO_STATUS_BLOCK IoStatusBlock OPTIONAL
); );
@ -59,10 +54,10 @@ XBSYSAPI EXPORTNUM(61) PVOID NTAPI IoBuildDeviceIoControlRequest
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(62) PVOID NTAPI IoBuildSynchronousFsdRequest XBSYSAPI EXPORTNUM(62) PVOID NTAPI IoBuildSynchronousFsdRequest
( (
IN ulong_xt MajorFunction, IN ULONG MajorFunction,
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
OUT PVOID Buffer OPTIONAL, OUT PVOID Buffer OPTIONAL,
IN ulong_xt Length, IN ULONG Length,
OUT PLARGE_INTEGER StartingOffset OPTIONAL, OUT PLARGE_INTEGER StartingOffset OPTIONAL,
IN PKEVENT Event, IN PKEVENT Event,
OUT PIO_STATUS_BLOCK IoStatusBlock OUT PIO_STATUS_BLOCK IoStatusBlock
@ -71,13 +66,13 @@ XBSYSAPI EXPORTNUM(62) PVOID NTAPI IoBuildSynchronousFsdRequest
// ****************************************************************** // ******************************************************************
// * 0x003F - IoCheckShareAccess() // * 0x003F - IoCheckShareAccess()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(63) ntstatus_xt NTAPI IoCheckShareAccess XBSYSAPI EXPORTNUM(63) NTSTATUS NTAPI IoCheckShareAccess
( (
IN access_mask_xt DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN ulong_xt DesiredShareAccess, IN ULONG DesiredShareAccess,
OUT PFILE_OBJECT FileObject, OUT PFILE_OBJECT FileObject,
OUT PSHARE_ACCESS ShareAccess, OUT PSHARE_ACCESS ShareAccess,
IN boolean_xt Update IN BOOLEAN Update
); );
// ****************************************************************** // ******************************************************************
@ -88,37 +83,37 @@ XBSYSAPI EXPORTNUM(64) OBJECT_TYPE IoCompletionObjectType;
// ****************************************************************** // ******************************************************************
// * 0x0041 - IoCreateDevice() // * 0x0041 - IoCreateDevice()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(65) ntstatus_xt NTAPI IoCreateDevice XBSYSAPI EXPORTNUM(65) NTSTATUS NTAPI IoCreateDevice
( (
IN PDRIVER_OBJECT DriverObject, IN PDRIVER_OBJECT DriverObject,
IN ulong_xt DeviceExtensionSize, IN ULONG DeviceExtensionSize,
IN PSTRING DeviceName OPTIONAL, IN PSTRING DeviceName OPTIONAL,
IN ulong_xt DeviceType, IN ULONG DeviceType,
IN boolean_xt Exclusive, IN BOOLEAN Exclusive,
OUT PDEVICE_OBJECT* DeviceObject OUT PDEVICE_OBJECT* DeviceObject
); );
// ****************************************************************** // ******************************************************************
// * 0x0042 - IoCreateFile() // * 0x0042 - IoCreateFile()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(66) ntstatus_xt NTAPI IoCreateFile XBSYSAPI EXPORTNUM(66) NTSTATUS NTAPI IoCreateFile
( (
OUT PHANDLE FileHandle, OUT PHANDLE FileHandle,
IN access_mask_xt DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize, IN PLARGE_INTEGER AllocationSize,
IN ulong_xt FileAttributes, IN ULONG FileAttributes,
IN ulong_xt ShareAccess, IN ULONG ShareAccess,
IN ulong_xt Disposition, IN ULONG Disposition,
IN ulong_xt CreateOptions, IN ULONG CreateOptions,
IN ulong_xt Options IN ULONG Options
); );
// ****************************************************************** // ******************************************************************
// * 0x0043 - IoCreateSymbolicLink() // * 0x0043 - IoCreateSymbolicLink()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(67) ntstatus_xt NTAPI IoCreateSymbolicLink XBSYSAPI EXPORTNUM(67) NTSTATUS NTAPI IoCreateSymbolicLink
( (
IN PSTRING SymbolicLinkName, IN PSTRING SymbolicLinkName,
IN PSTRING DeviceName IN PSTRING DeviceName
@ -127,7 +122,7 @@ XBSYSAPI EXPORTNUM(67) ntstatus_xt NTAPI IoCreateSymbolicLink
// ****************************************************************** // ******************************************************************
// * 0x0044 - IoDeleteDevice() // * 0x0044 - IoDeleteDevice()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(68) void_xt NTAPI IoDeleteDevice XBSYSAPI EXPORTNUM(68) VOID NTAPI IoDeleteDevice
( (
IN PDEVICE_OBJECT irql IN PDEVICE_OBJECT irql
); );
@ -135,7 +130,7 @@ XBSYSAPI EXPORTNUM(68) void_xt NTAPI IoDeleteDevice
// ****************************************************************** // ******************************************************************
// * 0x0045 - IoDeleteSymbolicLink() // * 0x0045 - IoDeleteSymbolicLink()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(69) ntstatus_xt NTAPI IoDeleteSymbolicLink XBSYSAPI EXPORTNUM(69) NTSTATUS NTAPI IoDeleteSymbolicLink
( (
IN PSTRING SymbolicLinkName IN PSTRING SymbolicLinkName
); );
@ -153,7 +148,7 @@ XBSYSAPI EXPORTNUM(71) OBJECT_TYPE IoFileObjectType;
// ****************************************************************** // ******************************************************************
// * 0x0048 - IoFreeIrp() // * 0x0048 - IoFreeIrp()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(72) void_xt NTAPI IoFreeIrp XBSYSAPI EXPORTNUM(72) VOID NTAPI IoFreeIrp
( (
IN PIRP Irp IN PIRP Irp
); );
@ -164,14 +159,14 @@ XBSYSAPI EXPORTNUM(72) void_xt NTAPI IoFreeIrp
XBSYSAPI EXPORTNUM(73) PVOID NTAPI IoInitializeIrp XBSYSAPI EXPORTNUM(73) PVOID NTAPI IoInitializeIrp
( (
IN PIRP Irp, IN PIRP Irp,
IN ushort_xt PacketSize, IN USHORT PacketSize,
IN cchar_xt StackSize IN CCHAR StackSize
); );
// ****************************************************************** // ******************************************************************
// * 0x004A - IoInvalidDeviceRequest() // * 0x004A - IoInvalidDeviceRequest()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(74) ntstatus_xt NTAPI IoInvalidDeviceRequest XBSYSAPI EXPORTNUM(74) NTSTATUS NTAPI IoInvalidDeviceRequest
( (
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp IN PIRP Irp
@ -180,11 +175,11 @@ XBSYSAPI EXPORTNUM(74) ntstatus_xt NTAPI IoInvalidDeviceRequest
// ****************************************************************** // ******************************************************************
// * 0x004B - IoQueryFileInformation() // * 0x004B - IoQueryFileInformation()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(75) ntstatus_xt NTAPI IoQueryFileInformation XBSYSAPI EXPORTNUM(75) NTSTATUS NTAPI IoQueryFileInformation
( (
IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
IN FILE_INFORMATION_CLASS FileInformationClass, IN FILE_INFORMATION_CLASS FileInformationClass,
IN ulong_xt Length, IN ULONG Length,
OUT PVOID FileInformation, OUT PVOID FileInformation,
OUT PULONG ReturnedLength OUT PULONG ReturnedLength
); );
@ -192,11 +187,11 @@ XBSYSAPI EXPORTNUM(75) ntstatus_xt NTAPI IoQueryFileInformation
// ****************************************************************** // ******************************************************************
// * 0x004C - IoQueryVolumeInformation() // * 0x004C - IoQueryVolumeInformation()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(76) ntstatus_xt NTAPI IoQueryVolumeInformation XBSYSAPI EXPORTNUM(76) NTSTATUS NTAPI IoQueryVolumeInformation
( (
IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
IN FS_INFORMATION_CLASS FsInformationClass, IN FS_INFORMATION_CLASS FsInformationClass,
IN ulong_xt Length, IN ULONG Length,
OUT PVOID FsInformation, OUT PVOID FsInformation,
OUT PULONG ReturnedLength OUT PULONG ReturnedLength
); );
@ -204,7 +199,7 @@ XBSYSAPI EXPORTNUM(76) ntstatus_xt NTAPI IoQueryVolumeInformation
// ****************************************************************** // ******************************************************************
// * 0x004D - IoQueueThreadIrp() // * 0x004D - IoQueueThreadIrp()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(77) void_xt NTAPI IoQueueThreadIrp XBSYSAPI EXPORTNUM(77) VOID NTAPI IoQueueThreadIrp
( (
IN PIRP Irp IN PIRP Irp
); );
@ -212,7 +207,7 @@ XBSYSAPI EXPORTNUM(77) void_xt NTAPI IoQueueThreadIrp
// ****************************************************************** // ******************************************************************
// * 0x004E - IoRemoveShareAccess() // * 0x004E - IoRemoveShareAccess()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(78) void_xt NTAPI IoRemoveShareAccess XBSYSAPI EXPORTNUM(78) VOID NTAPI IoRemoveShareAccess
( (
IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
IN PSHARE_ACCESS ShareAccess IN PSHARE_ACCESS ShareAccess
@ -221,22 +216,22 @@ XBSYSAPI EXPORTNUM(78) void_xt NTAPI IoRemoveShareAccess
// ****************************************************************** // ******************************************************************
// * 0x004F - IoSetIoCompletion() // * 0x004F - IoSetIoCompletion()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(79) ntstatus_xt NTAPI IoSetIoCompletion XBSYSAPI EXPORTNUM(79) NTSTATUS NTAPI IoSetIoCompletion
( (
IN PKQUEUE IoCompletion, IN PKQUEUE IoCompletion,
IN PVOID KeyContext, IN PVOID KeyContext,
IN PVOID ApcContext, IN PVOID ApcContext,
IN ntstatus_xt IoStatus, IN NTSTATUS IoStatus,
IN ulong_xt IoStatusInformation IN ULONG IoStatusInformation
); );
// ****************************************************************** // ******************************************************************
// * 0x0050 - IoSetShareAccess() // * 0x0050 - IoSetShareAccess()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(80) cchar_xt NTAPI IoSetShareAccess XBSYSAPI EXPORTNUM(80) CCHAR NTAPI IoSetShareAccess
( (
IN ulong_xt DesiredAccess, IN ULONG DesiredAccess,
IN ulong_xt DesiredShareAccess, IN ULONG DesiredShareAccess,
IN PFILE_OBJECT FileObject, IN PFILE_OBJECT FileObject,
OUT PSHARE_ACCESS ShareAccess OUT PSHARE_ACCESS ShareAccess
); );
@ -244,7 +239,7 @@ XBSYSAPI EXPORTNUM(80) cchar_xt NTAPI IoSetShareAccess
// ****************************************************************** // ******************************************************************
// * 0x0051 - IoStartNextPacket() // * 0x0051 - IoStartNextPacket()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(81) void_xt NTAPI IoStartNextPacket XBSYSAPI EXPORTNUM(81) VOID NTAPI IoStartNextPacket
( (
IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
); );
@ -252,16 +247,16 @@ XBSYSAPI EXPORTNUM(81) void_xt NTAPI IoStartNextPacket
// ****************************************************************** // ******************************************************************
// * 0x0052 - IoStartNextPacketByKey() // * 0x0052 - IoStartNextPacketByKey()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(82) void_xt NTAPI IoStartNextPacketByKey XBSYSAPI EXPORTNUM(82) VOID NTAPI IoStartNextPacketByKey
( (
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN ulong_xt Key IN ULONG Key
); );
// ****************************************************************** // ******************************************************************
// * 0x0053 - IoStartPacket() // * 0x0053 - IoStartPacket()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(83) void_xt NTAPI IoStartPacket XBSYSAPI EXPORTNUM(83) VOID NTAPI IoStartPacket
( (
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp, IN PIRP Irp,
@ -271,34 +266,34 @@ XBSYSAPI EXPORTNUM(83) void_xt NTAPI IoStartPacket
// ****************************************************************** // ******************************************************************
// * 0x0054 - IoSynchronousDeviceIoControlRequest() // * 0x0054 - IoSynchronousDeviceIoControlRequest()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(84) ntstatus_xt NTAPI IoSynchronousDeviceIoControlRequest XBSYSAPI EXPORTNUM(84) NTSTATUS NTAPI IoSynchronousDeviceIoControlRequest
( (
IN ulong_xt IoControlCode, IN ULONG IoControlCode,
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PVOID InputBuffer OPTIONAL, IN PVOID InputBuffer OPTIONAL,
IN ulong_xt InputBufferLength, IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL, OUT PVOID OutputBuffer OPTIONAL,
IN ulong_xt OutputBufferLength, IN ULONG OutputBufferLength,
OUT PULONG ReturnedOutputBufferLength OPTIONAL, OUT PULONG ReturnedOutputBufferLength OPTIONAL,
IN boolean_xt InternalDeviceIoControl IN BOOLEAN InternalDeviceIoControl
); );
// ****************************************************************** // ******************************************************************
// * 0x0055 - IoSynchronousFsdRequest() // * 0x0055 - IoSynchronousFsdRequest()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(85) ntstatus_xt NTAPI IoSynchronousFsdRequest XBSYSAPI EXPORTNUM(85) NTSTATUS NTAPI IoSynchronousFsdRequest
( (
IN ulong_xt MajorFunction, IN ULONG MajorFunction,
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
OUT PVOID Buffer OPTIONAL, OUT PVOID Buffer OPTIONAL,
IN ulong_xt Length, IN ULONG Length,
IN PLARGE_INTEGER StartingOffset OPTIONAL IN PLARGE_INTEGER StartingOffset OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x0056 - IofCallDriver() // * 0x0056 - IofCallDriver()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(86) ntstatus_xt FASTCALL IofCallDriver XBSYSAPI EXPORTNUM(86) NTSTATUS FASTCALL IofCallDriver
( (
IN PDEVICE_OBJECT DeviceObject, IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp IN PIRP Irp
@ -307,16 +302,16 @@ XBSYSAPI EXPORTNUM(86) ntstatus_xt FASTCALL IofCallDriver
// ****************************************************************** // ******************************************************************
// * 0x0057 - IofCompleteRequest() // * 0x0057 - IofCompleteRequest()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(87) void_xt FASTCALL IofCompleteRequest XBSYSAPI EXPORTNUM(87) VOID FASTCALL IofCompleteRequest
( (
IN PIRP Irp, IN PIRP Irp,
IN cchar_xt PriorityBoost IN CCHAR PriorityBoost
); );
// ****************************************************************** // ******************************************************************
// * 0x005A - IoDismountVolume() // * 0x005A - IoDismountVolume()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(90) ntstatus_xt NTAPI IoDismountVolume XBSYSAPI EXPORTNUM(90) NTSTATUS NTAPI IoDismountVolume
( (
IN PDEVICE_OBJECT DeviceObject IN PDEVICE_OBJECT DeviceObject
); );
@ -324,7 +319,7 @@ XBSYSAPI EXPORTNUM(90) ntstatus_xt NTAPI IoDismountVolume
// ****************************************************************** // ******************************************************************
// * 0x005B - IoDismountVolumeByName() // * 0x005B - IoDismountVolumeByName()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(91) ntstatus_xt NTAPI IoDismountVolumeByName XBSYSAPI EXPORTNUM(91) NTSTATUS NTAPI IoDismountVolumeByName
( (
IN PSTRING VolumeName IN PSTRING VolumeName
); );
@ -332,13 +327,11 @@ XBSYSAPI EXPORTNUM(91) ntstatus_xt NTAPI IoDismountVolumeByName
// ****************************************************************** // ******************************************************************
// * 0x0167 - IoMarkIrpMustComplete() // * 0x0167 - IoMarkIrpMustComplete()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(359) cchar_xt NTAPI IoMarkIrpMustComplete XBSYSAPI EXPORTNUM(359) CCHAR NTAPI IoMarkIrpMustComplete
( (
IN PIRP Irp IN PIRP Irp
); );
}
#endif #endif

View File

@ -12,15 +12,10 @@
#ifndef KERNEL_H #ifndef KERNEL_H
#define KERNEL_H #define KERNEL_H
#include "types.h"
namespace xbox
{
// ****************************************************************** // ******************************************************************
// * 0x005C - KeAlertResumeThread() // * 0x005C - KeAlertResumeThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(92) ntstatus_xt NTAPI KeAlertResumeThread XBSYSAPI EXPORTNUM(92) NTSTATUS NTAPI KeAlertResumeThread
( (
IN HANDLE ThreadHandle, IN HANDLE ThreadHandle,
IN OUT PULONG PreviousSuspendCount IN OUT PULONG PreviousSuspendCount
@ -29,7 +24,7 @@ XBSYSAPI EXPORTNUM(92) ntstatus_xt NTAPI KeAlertResumeThread
// ****************************************************************** // ******************************************************************
// * 0x005D - KeAlertThread() // * 0x005D - KeAlertThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(93) ntstatus_xt NTAPI KeAlertThread XBSYSAPI EXPORTNUM(93) NTSTATUS NTAPI KeAlertThread
( (
IN HANDLE ThreadHandle IN HANDLE ThreadHandle
); );
@ -37,7 +32,7 @@ XBSYSAPI EXPORTNUM(93) ntstatus_xt NTAPI KeAlertThread
// ****************************************************************** // ******************************************************************
// * 0x005E - KeBoostPriorityThread() // * 0x005E - KeBoostPriorityThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(94) ntstatus_xt NTAPI KeBoostPriorityThread XBSYSAPI EXPORTNUM(94) NTSTATUS NTAPI KeBoostPriorityThread
( (
IN PKTHREAD Thread, IN PKTHREAD Thread,
IN KPRIORITY Increment IN KPRIORITY Increment
@ -46,17 +41,17 @@ XBSYSAPI EXPORTNUM(94) ntstatus_xt NTAPI KeBoostPriorityThread
// ****************************************************************** // ******************************************************************
// * 0x005F - KeBugCheck() // * 0x005F - KeBugCheck()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(95) void_xt NTAPI KeBugCheck XBSYSAPI EXPORTNUM(95) VOID NTAPI KeBugCheck
( (
IN ulong_xt BugCheckMode IN ULONG BugCheckMode
); );
// ****************************************************************** // ******************************************************************
// * 0x0060 - KeBugCheckEx() // * 0x0060 - KeBugCheckEx()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(96) ntstatus_xt NTAPI KeBugCheckEx XBSYSAPI EXPORTNUM(96) NTSTATUS NTAPI KeBugCheckEx
( (
IN dword_xt BugCheckCode, IN DWORD BugCheckCode,
IN PVOID BugCheckParameter1, IN PVOID BugCheckParameter1,
IN PVOID BugCheckParameter2, IN PVOID BugCheckParameter2,
IN PVOID BugCheckParameter3, IN PVOID BugCheckParameter3,
@ -66,7 +61,7 @@ XBSYSAPI EXPORTNUM(96) ntstatus_xt NTAPI KeBugCheckEx
// ****************************************************************** // ******************************************************************
// * 0x0061 - KeCancelTimer() // * 0x0061 - KeCancelTimer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(97) boolean_xt NTAPI KeCancelTimer XBSYSAPI EXPORTNUM(97) BOOLEAN NTAPI KeCancelTimer
( (
IN PKTIMER IN PKTIMER
); );
@ -74,7 +69,7 @@ XBSYSAPI EXPORTNUM(97) boolean_xt NTAPI KeCancelTimer
// ****************************************************************** // ******************************************************************
// * 0x0062 - KeConnectInterrupt() // * 0x0062 - KeConnectInterrupt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(98) boolean_xt NTAPI KeConnectInterrupt XBSYSAPI EXPORTNUM(98) BOOLEAN NTAPI KeConnectInterrupt
( (
IN PKINTERRUPT InterruptObject IN PKINTERRUPT InterruptObject
); );
@ -82,17 +77,17 @@ XBSYSAPI EXPORTNUM(98) boolean_xt NTAPI KeConnectInterrupt
// ****************************************************************** // ******************************************************************
// * 0x0063 - KeDelayExecutionThread() // * 0x0063 - KeDelayExecutionThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(99) ntstatus_xt NTAPI KeDelayExecutionThread XBSYSAPI EXPORTNUM(99) NTSTATUS NTAPI KeDelayExecutionThread
( (
IN KPROCESSOR_MODE WaitMode, IN KPROCESSOR_MODE WaitMode,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Interval IN PLARGE_INTEGER Interval
); );
// ****************************************************************** // ******************************************************************
// * 0x0064 - KeDisconnectInterrupt() // * 0x0064 - KeDisconnectInterrupt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(100) void_xt NTAPI KeDisconnectInterrupt XBSYSAPI EXPORTNUM(100) VOID NTAPI KeDisconnectInterrupt
( (
IN PKINTERRUPT InterruptObject IN PKINTERRUPT InterruptObject
); );
@ -100,9 +95,9 @@ XBSYSAPI EXPORTNUM(100) void_xt NTAPI KeDisconnectInterrupt
// ****************************************************************** // ******************************************************************
// * 0x0065 - KeEnterCriticalRegion() // * 0x0065 - KeEnterCriticalRegion()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(101) void_xt NTAPI KeEnterCriticalRegion XBSYSAPI EXPORTNUM(101) VOID NTAPI KeEnterCriticalRegion
( (
void_xt VOID
); );
// ****************************************************************** // ******************************************************************
@ -118,7 +113,7 @@ XBSYSAPI EXPORTNUM(104) PKTHREAD NTAPI KeGetCurrentThread(void);
// ****************************************************************** // ******************************************************************
// * 0x0069 - KeInitializeApc() // * 0x0069 - KeInitializeApc()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(105) void_xt NTAPI KeInitializeApc XBSYSAPI EXPORTNUM(105) VOID NTAPI KeInitializeApc
( (
IN PKAPC Apc, IN PKAPC Apc,
IN PKTHREAD Thread, IN PKTHREAD Thread,
@ -132,7 +127,7 @@ XBSYSAPI EXPORTNUM(105) void_xt NTAPI KeInitializeApc
// ****************************************************************** // ******************************************************************
// * 0x006A - KeInitializeDeviceQueue() // * 0x006A - KeInitializeDeviceQueue()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(106) void_xt NTAPI KeInitializeDeviceQueue XBSYSAPI EXPORTNUM(106) VOID NTAPI KeInitializeDeviceQueue
( (
OUT PKDEVICE_QUEUE DeviceQueue OUT PKDEVICE_QUEUE DeviceQueue
); );
@ -140,7 +135,7 @@ XBSYSAPI EXPORTNUM(106) void_xt NTAPI KeInitializeDeviceQueue
// ****************************************************************** // ******************************************************************
// * 0x006B - KeInitializeDpc() // * 0x006B - KeInitializeDpc()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(107) void_xt NTAPI KeInitializeDpc XBSYSAPI EXPORTNUM(107) VOID NTAPI KeInitializeDpc
( (
KDPC *Dpc, KDPC *Dpc,
PKDEFERRED_ROUTINE DeferredRoutine, PKDEFERRED_ROUTINE DeferredRoutine,
@ -150,90 +145,90 @@ XBSYSAPI EXPORTNUM(107) void_xt NTAPI KeInitializeDpc
// ****************************************************************** // ******************************************************************
// * 0x006C - KeInitializeEvent() // * 0x006C - KeInitializeEvent()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(108) void_xt NTAPI KeInitializeEvent XBSYSAPI EXPORTNUM(108) VOID NTAPI KeInitializeEvent
( (
IN PRKEVENT Event, IN PRKEVENT Event,
IN EVENT_TYPE Type, IN EVENT_TYPE Type,
IN boolean_xt SignalState IN BOOLEAN SignalState
); );
// ****************************************************************** // ******************************************************************
// * 0x006D - KeInitializeInterrupt() // * 0x006D - KeInitializeInterrupt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(109) void_xt NTAPI KeInitializeInterrupt XBSYSAPI EXPORTNUM(109) VOID NTAPI KeInitializeInterrupt
( (
OUT PKINTERRUPT Interrupt, OUT PKINTERRUPT Interrupt,
IN PKSERVICE_ROUTINE ServiceRoutine, IN PKSERVICE_ROUTINE ServiceRoutine,
IN PVOID ServiceContext, IN PVOID ServiceContext,
IN ulong_xt Vector, IN ULONG Vector,
IN KIRQL Irql, IN KIRQL Irql,
IN KINTERRUPT_MODE InterruptMode, IN KINTERRUPT_MODE InterruptMode,
IN boolean_xt ShareVector IN BOOLEAN ShareVector
); );
// ****************************************************************** // ******************************************************************
// * 0x006E - KeInitializeMutant() // * 0x006E - KeInitializeMutant()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(110) void_xt NTAPI KeInitializeMutant XBSYSAPI EXPORTNUM(110) VOID NTAPI KeInitializeMutant
( (
IN PRKMUTANT Mutant, IN PRKMUTANT Mutant,
IN boolean_xt InitialOwner IN BOOLEAN InitialOwner
); );
// ****************************************************************** // ******************************************************************
// * 0x006F - KeInitializeQueue() // * 0x006F - KeInitializeQueue()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(111) void_xt NTAPI KeInitializeQueue XBSYSAPI EXPORTNUM(111) VOID NTAPI KeInitializeQueue
( (
IN PKQUEUE Queue, IN PKQUEUE Queue,
IN ulong_xt Count OPTIONAL IN ULONG Count OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x0070 - KeInitializeSemaphore() // * 0x0070 - KeInitializeSemaphore()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(112) void_xt NTAPI KeInitializeSemaphore XBSYSAPI EXPORTNUM(112) VOID NTAPI KeInitializeSemaphore
( (
IN PRKSEMAPHORE Semaphore, IN PRKSEMAPHORE Semaphore,
IN long_xt Count, IN LONG Count,
IN long_xt Limit IN LONG Limit
); );
// ****************************************************************** // ******************************************************************
// * 0x0071 - KeInitializeTimerEx() // * 0x0071 - KeInitializeTimerEx()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(113) void_xt NTAPI KeInitializeTimerEx XBSYSAPI EXPORTNUM(113) VOID NTAPI KeInitializeTimerEx
( (
IN PKTIMER Timer, IN PKTIMER Timer,
IN TIMER_TYPE Type IN TIMER_TYPE Type
); );
XBSYSAPI EXPORTNUM(114) boolean_xt NTAPI KeInsertByKeyDeviceQueue XBSYSAPI EXPORTNUM(114) BOOLEAN NTAPI KeInsertByKeyDeviceQueue
( (
IN PKDEVICE_QUEUE DeviceQueue, IN PKDEVICE_QUEUE DeviceQueue,
IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry, IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry,
IN ulong_xt SortKey IN ULONG SortKey
); );
XBSYSAPI EXPORTNUM(115) boolean_xt NTAPI KeInsertDeviceQueue XBSYSAPI EXPORTNUM(115) BOOLEAN NTAPI KeInsertDeviceQueue
( (
IN PKDEVICE_QUEUE DeviceQueue, IN PKDEVICE_QUEUE DeviceQueue,
IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
); );
XBSYSAPI EXPORTNUM(116) long_xt NTAPI KeInsertHeadQueue XBSYSAPI EXPORTNUM(116) LONG NTAPI KeInsertHeadQueue
( (
IN PRKQUEUE Queue, IN PRKQUEUE Queue,
IN PLIST_ENTRY Entry IN PLIST_ENTRY Entry
); );
XBSYSAPI EXPORTNUM(117) long_xt NTAPI KeInsertQueue XBSYSAPI EXPORTNUM(117) LONG NTAPI KeInsertQueue
( (
IN PRKQUEUE Queue, IN PRKQUEUE Queue,
IN PLIST_ENTRY Entry IN PLIST_ENTRY Entry
); );
XBSYSAPI EXPORTNUM(118) boolean_xt NTAPI KeInsertQueueApc XBSYSAPI EXPORTNUM(118) BOOLEAN NTAPI KeInsertQueueApc
( (
IN PRKAPC Apc, IN PRKAPC Apc,
IN PVOID SystemArgument1, IN PVOID SystemArgument1,
@ -244,7 +239,7 @@ XBSYSAPI EXPORTNUM(118) boolean_xt NTAPI KeInsertQueueApc
// ****************************************************************** // ******************************************************************
// * 0x0077 - KeInsertQueueDpc() // * 0x0077 - KeInsertQueueDpc()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(119) boolean_xt NTAPI KeInsertQueueDpc XBSYSAPI EXPORTNUM(119) BOOLEAN NTAPI KeInsertQueueDpc
( (
IN PKDPC Dpc, IN PKDPC Dpc,
IN PVOID SystemArgument1, IN PVOID SystemArgument1,
@ -259,24 +254,24 @@ XBSYSAPI EXPORTNUM(120) KSYSTEM_TIME KeInterruptTime;
// ****************************************************************** // ******************************************************************
// * 0x0079 - KeIsExecutingDpc() // * 0x0079 - KeIsExecutingDpc()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(121) boolean_xt NTAPI KeIsExecutingDpc(); XBSYSAPI EXPORTNUM(121) BOOLEAN NTAPI KeIsExecutingDpc();
// ****************************************************************** // ******************************************************************
// * 0x007A - KeLeaveCriticalRegion() // * 0x007A - KeLeaveCriticalRegion()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(122) void_xt NTAPI KeLeaveCriticalRegion XBSYSAPI EXPORTNUM(122) VOID NTAPI KeLeaveCriticalRegion
( (
void_xt VOID
); );
XBSYSAPI EXPORTNUM(123) long_xt NTAPI KePulseEvent XBSYSAPI EXPORTNUM(123) LONG NTAPI KePulseEvent
( (
IN PRKEVENT Event, IN PRKEVENT Event,
IN KPRIORITY Increment, IN KPRIORITY Increment,
IN boolean_xt Wait IN BOOLEAN Wait
); );
XBSYSAPI EXPORTNUM(124) long_xt NTAPI KeQueryBasePriorityThread XBSYSAPI EXPORTNUM(124) LONG NTAPI KeQueryBasePriorityThread
( (
IN PKTHREAD Thread IN PKTHREAD Thread
); );
@ -284,22 +279,22 @@ XBSYSAPI EXPORTNUM(124) long_xt NTAPI KeQueryBasePriorityThread
// ****************************************************************** // ******************************************************************
// * 0x007D - KeQueryInterruptTime() // * 0x007D - KeQueryInterruptTime()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(125) ulonglong_xt NTAPI KeQueryInterruptTime(void); XBSYSAPI EXPORTNUM(125) ULONGLONG NTAPI KeQueryInterruptTime(void);
// ****************************************************************** // ******************************************************************
// * 0x007E - KeQueryPerformanceCounter() // * 0x007E - KeQueryPerformanceCounter()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(126) ulonglong_xt NTAPI KeQueryPerformanceCounter(void); XBSYSAPI EXPORTNUM(126) ULONGLONG NTAPI KeQueryPerformanceCounter(void);
// ****************************************************************** // ******************************************************************
// * 0x007F - KeQueryPerformanceFrequency() // * 0x007F - KeQueryPerformanceFrequency()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(127) ulonglong_xt NTAPI KeQueryPerformanceFrequency(void); XBSYSAPI EXPORTNUM(127) ULONGLONG NTAPI KeQueryPerformanceFrequency(void);
// ****************************************************************** // ******************************************************************
// * 0x0080 - KeQuerySystemTime() // * 0x0080 - KeQuerySystemTime()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(128) void_xt NTAPI KeQuerySystemTime XBSYSAPI EXPORTNUM(128) VOID NTAPI KeQuerySystemTime
( (
PLARGE_INTEGER CurrentTime PLARGE_INTEGER CurrentTime
); );
@ -307,33 +302,33 @@ XBSYSAPI EXPORTNUM(128) void_xt NTAPI KeQuerySystemTime
// ****************************************************************** // ******************************************************************
// * 0x0081 - KeRaiseIrqlToDpcLevel() // * 0x0081 - KeRaiseIrqlToDpcLevel()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(129) uchar_xt NTAPI KeRaiseIrqlToDpcLevel(); XBSYSAPI EXPORTNUM(129) UCHAR NTAPI KeRaiseIrqlToDpcLevel();
// ****************************************************************** // ******************************************************************
// * 0x0082 - KeRaiseIrqlToSynchLevel() // * 0x0082 - KeRaiseIrqlToSynchLevel()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(130) uchar_xt NTAPI KeRaiseIrqlToSynchLevel(); XBSYSAPI EXPORTNUM(130) UCHAR NTAPI KeRaiseIrqlToSynchLevel();
XBSYSAPI EXPORTNUM(131) long_xt NTAPI KeReleaseMutant XBSYSAPI EXPORTNUM(131) LONG NTAPI KeReleaseMutant
( (
IN PRKMUTANT Mutant, IN PRKMUTANT Mutant,
IN KPRIORITY Increment, IN KPRIORITY Increment,
IN boolean_xt Abandoned, IN BOOLEAN Abandoned,
IN boolean_xt Wait IN BOOLEAN Wait
); );
XBSYSAPI EXPORTNUM(132) long_xt NTAPI KeReleaseSemaphore XBSYSAPI EXPORTNUM(132) LONG NTAPI KeReleaseSemaphore
( (
IN PRKSEMAPHORE Semaphore, IN PRKSEMAPHORE Semaphore,
IN KPRIORITY Increment, IN KPRIORITY Increment,
IN long_xt Adjustment, IN BOOLEAN Adjustment,
IN boolean_xt Wait IN BOOLEAN Wait
); );
XBSYSAPI EXPORTNUM(133) PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveByKeyDeviceQueue XBSYSAPI EXPORTNUM(133) PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveByKeyDeviceQueue
( (
IN PKDEVICE_QUEUE DeviceQueue, IN PKDEVICE_QUEUE DeviceQueue,
IN ulong_xt SortKey IN ULONG SortKey
); );
XBSYSAPI EXPORTNUM(134) PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveDeviceQueue XBSYSAPI EXPORTNUM(134) PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveDeviceQueue
@ -341,7 +336,7 @@ XBSYSAPI EXPORTNUM(134) PKDEVICE_QUEUE_ENTRY NTAPI KeRemoveDeviceQueue
IN PKDEVICE_QUEUE DeviceQueue IN PKDEVICE_QUEUE DeviceQueue
); );
XBSYSAPI EXPORTNUM(135) boolean_xt NTAPI KeRemoveEntryDeviceQueue XBSYSAPI EXPORTNUM(135) BOOLEAN NTAPI KeRemoveEntryDeviceQueue
( (
IN PKDEVICE_QUEUE DeviceQueue, IN PKDEVICE_QUEUE DeviceQueue,
IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry IN PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
@ -357,7 +352,7 @@ XBSYSAPI EXPORTNUM(136) PLIST_ENTRY NTAPI KeRemoveQueue
// ****************************************************************** // ******************************************************************
// * 0x0089 - KeRemoveQueueDpc() // * 0x0089 - KeRemoveQueueDpc()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(137) boolean_xt NTAPI KeRemoveQueueDpc XBSYSAPI EXPORTNUM(137) BOOLEAN NTAPI KeRemoveQueueDpc
( (
IN PKDPC Dpc IN PKDPC Dpc
); );
@ -365,7 +360,7 @@ XBSYSAPI EXPORTNUM(137) boolean_xt NTAPI KeRemoveQueueDpc
// ****************************************************************** // ******************************************************************
// * 0x008A - KeResetEvent() // * 0x008A - KeResetEvent()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(138) long_xt NTAPI KeResetEvent XBSYSAPI EXPORTNUM(138) LONG NTAPI KeResetEvent
( (
IN PRKEVENT Event IN PRKEVENT Event
); );
@ -373,7 +368,7 @@ XBSYSAPI EXPORTNUM(138) long_xt NTAPI KeResetEvent
// ****************************************************************** // ******************************************************************
// * 0x008B - KeRestoreFloatingPointState() // * 0x008B - KeRestoreFloatingPointState()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(139) ntstatus_xt NTAPI KeRestoreFloatingPointState XBSYSAPI EXPORTNUM(139) NTSTATUS NTAPI KeRestoreFloatingPointState
( (
IN PKFLOATING_SAVE PublicFloatSave IN PKFLOATING_SAVE PublicFloatSave
); );
@ -381,7 +376,7 @@ XBSYSAPI EXPORTNUM(139) ntstatus_xt NTAPI KeRestoreFloatingPointState
// ****************************************************************** // ******************************************************************
// * 0x008C - KeResumeThread() // * 0x008C - KeResumeThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(140) ulong_xt NTAPI KeResumeThread XBSYSAPI EXPORTNUM(140) ULONG NTAPI KeResumeThread
( (
IN PKTHREAD Thread IN PKTHREAD Thread
); );
@ -394,7 +389,7 @@ XBSYSAPI EXPORTNUM(141) PLIST_ENTRY NTAPI KeRundownQueue
// ****************************************************************** // ******************************************************************
// * 0x008E - KeSaveFloatingPointState() // * 0x008E - KeSaveFloatingPointState()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(142) ntstatus_xt NTAPI KeSaveFloatingPointState XBSYSAPI EXPORTNUM(142) NTSTATUS NTAPI KeSaveFloatingPointState
( (
OUT PKFLOATING_SAVE PublicFloatSave OUT PKFLOATING_SAVE PublicFloatSave
); );
@ -402,29 +397,29 @@ XBSYSAPI EXPORTNUM(142) ntstatus_xt NTAPI KeSaveFloatingPointState
// ****************************************************************** // ******************************************************************
// * 0x008F - KeSetBasePriorityThread() // * 0x008F - KeSetBasePriorityThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(143) long_xt NTAPI KeSetBasePriorityThread XBSYSAPI EXPORTNUM(143) LONG NTAPI KeSetBasePriorityThread
( (
IN PKTHREAD Thread, IN PKTHREAD Thread,
IN long_xt Priority IN LONG Priority
); );
XBSYSAPI EXPORTNUM(144) boolean_xt NTAPI KeSetDisableBoostThread XBSYSAPI EXPORTNUM(144) ULONG NTAPI KeSetDisableBoostThread
( (
IN PKTHREAD Thread, IN PKTHREAD Thread,
IN boolean_xt Disable IN ULONG Disable
); );
// ****************************************************************** // ******************************************************************
// * 0x0091 - KeSetEvent() // * 0x0091 - KeSetEvent()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(145) long_xt NTAPI KeSetEvent XBSYSAPI EXPORTNUM(145) LONG NTAPI KeSetEvent
( (
IN PRKEVENT Event, IN PRKEVENT Event,
IN KPRIORITY Increment, IN KPRIORITY Increment,
IN boolean_xt Wait IN BOOLEAN Wait
); );
XBSYSAPI EXPORTNUM(146) void_xt NTAPI KeSetEventBoostPriority XBSYSAPI EXPORTNUM(146) VOID NTAPI KeSetEventBoostPriority
( (
IN PRKEVENT Event, IN PRKEVENT Event,
IN PRKTHREAD *Thread IN PRKTHREAD *Thread
@ -439,16 +434,16 @@ XBSYSAPI EXPORTNUM(147) KPRIORITY NTAPI KeSetPriorityProcess
// ****************************************************************** // ******************************************************************
// * 0x0094 - KeSetPriorityThread() // * 0x0094 - KeSetPriorityThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(148) boolean_xt NTAPI KeSetPriorityThread XBSYSAPI EXPORTNUM(148) BOOLEAN NTAPI KeSetPriorityThread
( (
IN PKTHREAD Thread, IN PKTHREAD Thread,
IN long_xt Priority IN LONG Priority
); );
// ****************************************************************** // ******************************************************************
// * 0x0095 - KeSetTimer() // * 0x0095 - KeSetTimer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(149) boolean_xt NTAPI KeSetTimer XBSYSAPI EXPORTNUM(149) BOOLEAN NTAPI KeSetTimer
( (
IN PKTIMER Timer, IN PKTIMER Timer,
IN LARGE_INTEGER DueTime, IN LARGE_INTEGER DueTime,
@ -458,26 +453,26 @@ XBSYSAPI EXPORTNUM(149) boolean_xt NTAPI KeSetTimer
// ****************************************************************** // ******************************************************************
// * 0x0096 - KeSetTimerEx() // * 0x0096 - KeSetTimerEx()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(150) boolean_xt NTAPI KeSetTimerEx XBSYSAPI EXPORTNUM(150) BOOLEAN NTAPI KeSetTimerEx
( (
IN PKTIMER Timer, IN PKTIMER Timer,
IN LARGE_INTEGER DueTime, IN LARGE_INTEGER DueTime,
IN long_xt Period OPTIONAL, IN LONG Period OPTIONAL,
IN PKDPC Dpc OPTIONAL IN PKDPC Dpc OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x0097 - KeStallExecutionProcessor() // * 0x0097 - KeStallExecutionProcessor()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(151) void_xt NTAPI KeStallExecutionProcessor XBSYSAPI EXPORTNUM(151) VOID NTAPI KeStallExecutionProcessor
( (
IN ulong_xt MicroSeconds IN ULONG MicroSeconds
); );
// ****************************************************************** // ******************************************************************
// * 0x0098 - KeSuspendThread() // * 0x0098 - KeSuspendThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(152) ulong_xt NTAPI KeSuspendThread XBSYSAPI EXPORTNUM(152) ULONG NTAPI KeSuspendThread
( (
IN PKTHREAD Thread IN PKTHREAD Thread
); );
@ -485,7 +480,7 @@ XBSYSAPI EXPORTNUM(152) ulong_xt NTAPI KeSuspendThread
// ****************************************************************** // ******************************************************************
// * 0x0099 - KeSynchronizeExecution() // * 0x0099 - KeSynchronizeExecution()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(153) boolean_xt NTAPI KeSynchronizeExecution XBSYSAPI EXPORTNUM(153) BOOLEAN NTAPI KeSynchronizeExecution
( (
IN PKINTERRUPT Interrupt, IN PKINTERRUPT Interrupt,
IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine, IN PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
@ -500,7 +495,7 @@ XBSYSAPI EXPORTNUM(154) KSYSTEM_TIME KeSystemTime;
// ****************************************************************** // ******************************************************************
// * 0x009B - KeTestAlertThread() // * 0x009B - KeTestAlertThread()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(155) boolean_xt NTAPI KeTestAlertThread XBSYSAPI EXPORTNUM(155) BOOLEAN NTAPI KeTestAlertThread
( (
IN KPROCESSOR_MODE AlertMode IN KPROCESSOR_MODE AlertMode
); );
@ -508,24 +503,24 @@ XBSYSAPI EXPORTNUM(155) boolean_xt NTAPI KeTestAlertThread
// ****************************************************************** // ******************************************************************
// * 0x009C - KeTickCount // * 0x009C - KeTickCount
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(156) volatile dword_xt KeTickCount; XBSYSAPI EXPORTNUM(156) volatile DWORD KeTickCount;
// ****************************************************************** // ******************************************************************
// * 0x009D - KeTimeIncrement // * 0x009D - KeTimeIncrement
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(157) ulong_xt KeTimeIncrement; XBSYSAPI EXPORTNUM(157) ULONG KeTimeIncrement;
// ****************************************************************** // ******************************************************************
// * 0x009E - KeWaitForMultipleObjects() // * 0x009E - KeWaitForMultipleObjects()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(158) ntstatus_xt NTAPI KeWaitForMultipleObjects XBSYSAPI EXPORTNUM(158) NTSTATUS NTAPI KeWaitForMultipleObjects
( (
IN ulong_xt Count, IN ULONG Count,
IN PVOID Object[], IN PVOID Object[],
IN WAIT_TYPE WaitType, IN WAIT_TYPE WaitType,
IN KWAIT_REASON WaitReason, IN KWAIT_REASON WaitReason,
IN KPROCESSOR_MODE WaitMode, IN KPROCESSOR_MODE WaitMode,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Timeout OPTIONAL, IN PLARGE_INTEGER Timeout OPTIONAL,
IN PKWAIT_BLOCK WaitBlockArray OPTIONAL IN PKWAIT_BLOCK WaitBlockArray OPTIONAL
); );
@ -533,17 +528,15 @@ XBSYSAPI EXPORTNUM(158) ntstatus_xt NTAPI KeWaitForMultipleObjects
// ****************************************************************** // ******************************************************************
// * 0x009F - KeWaitForSingleObject() // * 0x009F - KeWaitForSingleObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(159) ntstatus_xt NTAPI KeWaitForSingleObject XBSYSAPI EXPORTNUM(159) NTSTATUS NTAPI KeWaitForSingleObject
( (
IN PVOID Object, IN PVOID Object,
IN KWAIT_REASON WaitReason, IN KWAIT_REASON WaitReason,
IN KPROCESSOR_MODE WaitMode, IN KPROCESSOR_MODE WaitMode,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Timeout OPTIONAL IN PLARGE_INTEGER Timeout OPTIONAL
); );
}
#endif #endif

View File

@ -12,107 +12,7 @@
#ifndef XBOXKRNL_MM_H #ifndef XBOXKRNL_MM_H
#define XBOXKRNL_MM_H #define XBOXKRNL_MM_H
#include "types.h" XBSYSAPI EXPORTNUM(102) PVOID MmGlobalData[8];
namespace xbox
{
typedef ulong_xt PFN;
typedef ulong_xt PFN_COUNT;
typedef ulong_xt PFN_NUMBER, *PPFN_NUMBER;
typedef struct _MMPFNFREE
{
ushort_xt PackedPfnFlink;
ushort_xt PackedPfnBlink;
} MMPFNFREE, *PMMPFNFREE;
typedef struct _MMPFNREGION
{
MMPFNFREE FreePagesByColor[32];
PFN_COUNT AvailablePages;
} MMPFNREGION, *PMMPFNREGION;
/* enum describing the usage type of the memory pages */
typedef enum _PageType
{
UnknownType, // Used by the PFN database
StackType, // Used by MmCreateKernelStack
VirtualPageTableType, // Used by the pages holding the PTs that map the user memory (lower 2 GiB)
SystemPageTableType, // Used by the pages holding the PTs that map the system memory
PoolType, // Used by ExAllocatePoolWithTag
VirtualMemoryType, // Used by NtAllocateVirtualMemory
SystemMemoryType, // Used by MmAllocateSystemMemory
ImageType, // Used to mark executable memory
CacheType, // Used by the file cache related functions
ContiguousType, // Used by MmAllocateContiguousMemoryEx and others
DebuggerType, // xbdm-related
COUNTtype // The size of the array containing the page usage per type
} PageType;
/* The Xbox PTE, modelled around the Intel 386 PTE specification */
typedef struct _XBOX_PTE
{
ulong_xt Valid : 1;
ulong_xt Write : 1;
ulong_xt Owner : 1;
ulong_xt WriteThrough : 1;
ulong_xt CacheDisable : 1;
ulong_xt Accessed : 1;
ulong_xt Dirty : 1;
ulong_xt LargePage : 1;
ulong_xt Global : 1;
ulong_xt GuardOrEnd : 1; // software field used for our own purposes
ulong_xt Persist : 1; // software field used for our own purposes
ulong_xt Unused : 1; // software field used for our own purposes
ulong_xt PFN : 20;
} XBOX_PTE, *PXBOX_PTE;
/* PTE as used by the memory manager */
typedef union _MMPTE
{
ulong_xt Default;
XBOX_PTE Hardware;
} MMPTE, *PMMPTE;
typedef PFN_NUMBER (FASTCALL *PMMREMOVE_PAGE_ROUTINE) (
IN PageType BusyType,
IN PMMPTE TargetPte
);
typedef struct _MMPTERANGE
{
MMPTE HeadPte;
PMMPTE FirstCommittedPte;
PMMPTE LastCommittedPte;
PMMPTE LastReservedPte;
PFN_COUNT *AvailablePages;
PMMREMOVE_PAGE_ROUTINE RemovePageRoutine;
} MMPTERANGE, *PMMPTERANGE;
typedef struct _MMADDRESS_NODE
{
ulong_ptr_xt StartingVpn;
ulong_ptr_xt EndingVpn;
struct _MMADDRESS_NODE *Parent;
struct _MMADDRESS_NODE *LeftChild;
struct _MMADDRESS_NODE *RightChild;
} MMADDRESS_NODE, *PMMADDRESS_NODE;
typedef struct _MMGLOBALDATA
{
PMMPFNREGION RetailPfnRegion;
PMMPTERANGE SystemPteRange;
PULONG AvailablePages;
PFN_COUNT *AllocatedPagesByUsage;
PRTL_CRITICAL_SECTION AddressSpaceLock;
PMMADDRESS_NODE *VadRoot;
PMMADDRESS_NODE *VadHint;
PMMADDRESS_NODE *VadFreeHint;
} MMGLOBALDATA, *PMMGLOBALDATA;
XBSYSAPI EXPORTNUM(102) MMGLOBALDATA MmGlobalData;
// ****************************************************************** // ******************************************************************
// * MmAllocateContiguousMemory // * MmAllocateContiguousMemory
@ -124,7 +24,7 @@ XBSYSAPI EXPORTNUM(102) MMGLOBALDATA MmGlobalData;
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(165) PVOID NTAPI MmAllocateContiguousMemory XBSYSAPI EXPORTNUM(165) PVOID NTAPI MmAllocateContiguousMemory
( (
IN ulong_xt NumberOfBytes IN ULONG NumberOfBytes
); );
// ****************************************************************** // ******************************************************************
@ -132,11 +32,11 @@ XBSYSAPI EXPORTNUM(165) PVOID NTAPI MmAllocateContiguousMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(166) PVOID NTAPI MmAllocateContiguousMemoryEx XBSYSAPI EXPORTNUM(166) PVOID NTAPI MmAllocateContiguousMemoryEx
( (
IN ulong_xt NumberOfBytes, IN ULONG NumberOfBytes,
IN physical_address_xt LowestAcceptableAddress, IN PHYSICAL_ADDRESS LowestAcceptableAddress,
IN physical_address_xt HighestAcceptableAddress, IN PHYSICAL_ADDRESS HighestAcceptableAddress,
IN ulong_xt Alignment OPTIONAL, IN ULONG Alignment OPTIONAL,
IN ulong_xt ProtectionType IN ULONG ProtectionType
); );
// ****************************************************************** // ******************************************************************
@ -144,8 +44,8 @@ XBSYSAPI EXPORTNUM(166) PVOID NTAPI MmAllocateContiguousMemoryEx
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(167) PVOID NTAPI MmAllocateSystemMemory XBSYSAPI EXPORTNUM(167) PVOID NTAPI MmAllocateSystemMemory
( (
ulong_xt NumberOfBytes, ULONG NumberOfBytes,
ulong_xt Protect ULONG Protect
); );
// ****************************************************************** // ******************************************************************
@ -153,8 +53,8 @@ XBSYSAPI EXPORTNUM(167) PVOID NTAPI MmAllocateSystemMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(168) PVOID NTAPI MmClaimGpuInstanceMemory XBSYSAPI EXPORTNUM(168) PVOID NTAPI MmClaimGpuInstanceMemory
( (
IN size_xt NumberOfBytes, IN SIZE_T NumberOfBytes,
OUT size_xt *NumberOfPaddingBytes OUT SIZE_T *NumberOfPaddingBytes
); );
// ****************************************************************** // ******************************************************************
@ -162,14 +62,14 @@ XBSYSAPI EXPORTNUM(168) PVOID NTAPI MmClaimGpuInstanceMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(169) PVOID NTAPI MmCreateKernelStack XBSYSAPI EXPORTNUM(169) PVOID NTAPI MmCreateKernelStack
( (
IN ulong_xt NumberOfBytes, IN ULONG NumberOfBytes,
IN boolean_xt DebuggerThread IN BOOLEAN DebuggerThread
); );
// ****************************************************************** // ******************************************************************
// * MmDeleteKernelStack // * MmDeleteKernelStack
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(170) void_xt NTAPI MmDeleteKernelStack XBSYSAPI EXPORTNUM(170) VOID NTAPI MmDeleteKernelStack
( (
IN PVOID StackBase, IN PVOID StackBase,
IN PVOID StackLimit IN PVOID StackLimit
@ -178,7 +78,7 @@ XBSYSAPI EXPORTNUM(170) void_xt NTAPI MmDeleteKernelStack
// ****************************************************************** // ******************************************************************
// * MmFreeContiguousMemory // * MmFreeContiguousMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(171) void_xt NTAPI MmFreeContiguousMemory XBSYSAPI EXPORTNUM(171) VOID NTAPI MmFreeContiguousMemory
( (
IN PVOID BaseAddress IN PVOID BaseAddress
); );
@ -186,16 +86,16 @@ XBSYSAPI EXPORTNUM(171) void_xt NTAPI MmFreeContiguousMemory
// ****************************************************************** // ******************************************************************
// * MmFreeSystemMemory // * MmFreeSystemMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(172) ulong_xt NTAPI MmFreeSystemMemory XBSYSAPI EXPORTNUM(172) ULONG NTAPI MmFreeSystemMemory
( (
PVOID BaseAddress, PVOID BaseAddress,
ulong_xt NumberOfBytes ULONG NumberOfBytes
); );
// ****************************************************************** // ******************************************************************
// * MmGetPhysicalAddress // * MmGetPhysicalAddress
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(173) physical_address_xt NTAPI MmGetPhysicalAddress XBSYSAPI EXPORTNUM(173) PHYSICAL_ADDRESS NTAPI MmGetPhysicalAddress
( (
IN PVOID BaseAddress IN PVOID BaseAddress
); );
@ -203,7 +103,7 @@ XBSYSAPI EXPORTNUM(173) physical_address_xt NTAPI MmGetPhysicalAddress
// ****************************************************************** // ******************************************************************
// * MmIsAddressValid // * MmIsAddressValid
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(174) boolean_xt NTAPI MmIsAddressValid XBSYSAPI EXPORTNUM(174) BOOLEAN NTAPI MmIsAddressValid
( (
IN PVOID VirtualAddress IN PVOID VirtualAddress
); );
@ -211,20 +111,20 @@ XBSYSAPI EXPORTNUM(174) boolean_xt NTAPI MmIsAddressValid
// ****************************************************************** // ******************************************************************
// * MmLockUnlockBufferPages // * MmLockUnlockBufferPages
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(175) void_xt NTAPI MmLockUnlockBufferPages XBSYSAPI EXPORTNUM(175) VOID NTAPI MmLockUnlockBufferPages
( (
IN PVOID BaseAddress, IN PVOID BaseAddress,
IN size_xt NumberOfBytes, IN SIZE_T NumberOfBytes,
IN boolean_xt UnlockPages IN BOOLEAN UnlockPages
); );
// ****************************************************************** // ******************************************************************
// * MmLockUnlockPhysicalPage // * MmLockUnlockPhysicalPage
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(176) void_xt NTAPI MmLockUnlockPhysicalPage XBSYSAPI EXPORTNUM(176) VOID NTAPI MmLockUnlockPhysicalPage
( (
IN ulong_ptr_xt PhysicalAddress, IN ULONG_PTR PhysicalAddress,
IN boolean_xt UnlockPage IN BOOLEAN UnlockPage
); );
// ****************************************************************** // ******************************************************************
@ -232,25 +132,25 @@ XBSYSAPI EXPORTNUM(176) void_xt NTAPI MmLockUnlockPhysicalPage
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(177) PVOID NTAPI MmMapIoSpace XBSYSAPI EXPORTNUM(177) PVOID NTAPI MmMapIoSpace
( (
IN physical_address_xt PhysicalAddress, IN PHYSICAL_ADDRESS PhysicalAddress,
IN ulong_xt NumberOfBytes, IN ULONG NumberOfBytes,
IN ulong_xt ProtectionType IN ULONG ProtectionType
); );
// ****************************************************************** // ******************************************************************
// * MmPersistContiguousMemory // * MmPersistContiguousMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(178) void_xt NTAPI MmPersistContiguousMemory XBSYSAPI EXPORTNUM(178) VOID NTAPI MmPersistContiguousMemory
( (
IN PVOID BaseAddress, IN PVOID BaseAddress,
IN ulong_xt NumberOfBytes, IN ULONG NumberOfBytes,
IN boolean_xt Persist IN BOOLEAN Persist
); );
// ****************************************************************** // ******************************************************************
// * MmQueryAddressProtect // * MmQueryAddressProtect
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(179) ulong_xt NTAPI MmQueryAddressProtect XBSYSAPI EXPORTNUM(179) ULONG NTAPI MmQueryAddressProtect
( (
IN PVOID VirtualAddress IN PVOID VirtualAddress
); );
@ -258,7 +158,7 @@ XBSYSAPI EXPORTNUM(179) ulong_xt NTAPI MmQueryAddressProtect
// ****************************************************************** // ******************************************************************
// * MmQueryAllocationSize // * MmQueryAllocationSize
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(180) ulong_xt NTAPI MmQueryAllocationSize XBSYSAPI EXPORTNUM(180) ULONG NTAPI MmQueryAllocationSize
( (
IN PVOID BaseAddress IN PVOID BaseAddress
); );
@ -266,7 +166,7 @@ XBSYSAPI EXPORTNUM(180) ulong_xt NTAPI MmQueryAllocationSize
// ****************************************************************** // ******************************************************************
// * MmQueryStatistics // * MmQueryStatistics
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(181) ntstatus_xt NTAPI MmQueryStatistics XBSYSAPI EXPORTNUM(181) NTSTATUS NTAPI MmQueryStatistics
( (
OUT PMM_STATISTICS MemoryStatistics OUT PMM_STATISTICS MemoryStatistics
); );
@ -274,20 +174,20 @@ XBSYSAPI EXPORTNUM(181) ntstatus_xt NTAPI MmQueryStatistics
// ****************************************************************** // ******************************************************************
// * MmSetAddressProtect // * MmSetAddressProtect
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(182) void_xt NTAPI MmSetAddressProtect XBSYSAPI EXPORTNUM(182) VOID NTAPI MmSetAddressProtect
( (
IN PVOID BaseAddress, IN PVOID BaseAddress,
IN ulong_xt NumberOfBytes, IN ULONG NumberOfBytes,
IN ulong_xt NewProtect IN ULONG NewProtect
); );
// ****************************************************************** // ******************************************************************
// * MmUnmapIoSpace // * MmUnmapIoSpace
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(183) void_xt NTAPI MmUnmapIoSpace XBSYSAPI EXPORTNUM(183) VOID NTAPI MmUnmapIoSpace
( (
IN PVOID BaseAddress, IN PVOID BaseAddress,
IN ulong_xt NumberOfBytes IN ULONG NumberOfBytes
); );
// ****************************************************************** // ******************************************************************
@ -295,28 +195,28 @@ XBSYSAPI EXPORTNUM(183) void_xt NTAPI MmUnmapIoSpace
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(374) PVOID NTAPI MmDbgAllocateMemory XBSYSAPI EXPORTNUM(374) PVOID NTAPI MmDbgAllocateMemory
( (
IN ulong_xt NumberOfBytes, IN ULONG NumberOfBytes,
IN ulong_xt Protect IN ULONG Protect
); );
// ****************************************************************** // ******************************************************************
// * MmDbgFreeMemory // * MmDbgFreeMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(375) ulong_xt NTAPI MmDbgFreeMemory XBSYSAPI EXPORTNUM(375) ULONG NTAPI MmDbgFreeMemory
( (
IN PVOID BaseAddress, IN PVOID BaseAddress,
IN ulong_xt NumberOfBytes IN ULONG NumberOfBytes
); );
// ****************************************************************** // ******************************************************************
// * MmDbgQueryAvailablePages // * MmDbgQueryAvailablePages
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(376) ulong_xt NTAPI MmDbgQueryAvailablePages(void); XBSYSAPI EXPORTNUM(376) ULONG NTAPI MmDbgQueryAvailablePages(void);
// ****************************************************************** // ******************************************************************
// * MmDbgReleaseAddress // * MmDbgReleaseAddress
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(377) void_xt NTAPI MmDbgReleaseAddress XBSYSAPI EXPORTNUM(377) VOID NTAPI MmDbgReleaseAddress
( (
IN PVOID VirtualAddress, IN PVOID VirtualAddress,
IN PULONG Opaque IN PULONG Opaque
@ -331,8 +231,6 @@ XBSYSAPI EXPORTNUM(378) PVOID NTAPI MmDbgWriteCheck
IN PULONG Opaque IN PULONG Opaque
); );
}
#endif #endif

View File

@ -12,31 +12,24 @@
#ifndef XBOXKRNL_NT_H #ifndef XBOXKRNL_NT_H
#define XBOXKRNL_NT_H #define XBOXKRNL_NT_H
#include "types.h"
namespace xbox
{
#define NtCurrentThread() ((HANDLE)-2) #define NtCurrentThread() ((HANDLE)-2)
#define X_MAXIMUM_WAIT_OBJECTS 64
// ****************************************************************** // ******************************************************************
// * NtAllocateVirtualMemory // * NtAllocateVirtualMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(184) ntstatus_xt NTAPI NtAllocateVirtualMemory XBSYSAPI EXPORTNUM(184) NTSTATUS NTAPI NtAllocateVirtualMemory
( (
IN OUT PVOID *BaseAddress, IN OUT PVOID *BaseAddress,
IN ulong_xt ZeroBits, IN ULONG ZeroBits,
IN OUT PULONG AllocationSize, IN OUT PULONG AllocationSize,
IN dword_xt AllocationType, IN DWORD AllocationType,
IN dword_xt Protect IN DWORD Protect
); );
// ****************************************************************** // ******************************************************************
// * 0x00B9 - NtCancelTimer() // * 0x00B9 - NtCancelTimer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(185) ntstatus_xt NTAPI NtCancelTimer XBSYSAPI EXPORTNUM(185) NTSTATUS NTAPI NtCancelTimer
( (
IN HANDLE TimerHandle, IN HANDLE TimerHandle,
OUT PBOOLEAN CurrentState OPTIONAL OUT PBOOLEAN CurrentState OPTIONAL
@ -45,7 +38,7 @@ XBSYSAPI EXPORTNUM(185) ntstatus_xt NTAPI NtCancelTimer
// ****************************************************************** // ******************************************************************
// * NtClearEvent // * NtClearEvent
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(186) ntstatus_xt NTAPI NtClearEvent XBSYSAPI EXPORTNUM(186) NTSTATUS NTAPI NtClearEvent
( (
IN HANDLE EventHandle IN HANDLE EventHandle
); );
@ -57,12 +50,12 @@ XBSYSAPI EXPORTNUM(186) ntstatus_xt NTAPI NtClearEvent
// * Closes an object handle // * Closes an object handle
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(187) ntstatus_xt NTAPI NtClose XBSYSAPI EXPORTNUM(187) NTSTATUS NTAPI NtClose
( (
IN HANDLE Handle IN HANDLE Handle
); );
XBSYSAPI EXPORTNUM(188) ntstatus_xt NTAPI NtCreateDirectoryObject XBSYSAPI EXPORTNUM(188) NTSTATUS NTAPI NtCreateDirectoryObject
( (
OUT PHANDLE DirectoryHandle, OUT PHANDLE DirectoryHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes IN POBJECT_ATTRIBUTES ObjectAttributes
@ -71,12 +64,12 @@ XBSYSAPI EXPORTNUM(188) ntstatus_xt NTAPI NtCreateDirectoryObject
// ****************************************************************** // ******************************************************************
// * NtCreateEvent // * NtCreateEvent
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(189) ntstatus_xt NTAPI NtCreateEvent XBSYSAPI EXPORTNUM(189) NTSTATUS NTAPI NtCreateEvent
( (
OUT PHANDLE EventHandle, OUT PHANDLE EventHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN EVENT_TYPE EventType, IN EVENT_TYPE EventType,
IN boolean_xt InitialState IN BOOLEAN InitialState
); );
@ -90,52 +83,52 @@ XBSYSAPI EXPORTNUM(189) ntstatus_xt NTAPI NtCreateEvent
// * a handle for the file object. // * a handle for the file object.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(190) ntstatus_xt NTAPI NtCreateFile XBSYSAPI EXPORTNUM(190) NTSTATUS NTAPI NtCreateFile
( (
OUT PHANDLE FileHandle, OUT PHANDLE FileHandle,
IN access_mask_xt DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PLARGE_INTEGER AllocationSize OPTIONAL, IN PLARGE_INTEGER AllocationSize OPTIONAL,
IN ulong_xt FileAttributes, IN ULONG FileAttributes,
IN ulong_xt ShareAccess, IN ULONG ShareAccess,
IN ulong_xt CreateDisposition, IN ULONG CreateDisposition,
IN ulong_xt CreateOptions IN ULONG CreateOptions
); );
XBSYSAPI EXPORTNUM(191) ntstatus_xt NTAPI NtCreateIoCompletion XBSYSAPI EXPORTNUM(191) NTSTATUS NTAPI NtCreateIoCompletion
( (
OUT PHANDLE IoCompletionHandle, OUT PHANDLE IoCompletionHandle,
IN access_mask_xt DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
IN ulong_xt Count IN ULONG Count
); );
// ****************************************************************** // ******************************************************************
// * NtCreateMutant // * NtCreateMutant
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(192) ntstatus_xt NTAPI NtCreateMutant XBSYSAPI EXPORTNUM(192) NTSTATUS NTAPI NtCreateMutant
( (
OUT PHANDLE MutantHandle, OUT PHANDLE MutantHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
IN boolean_xt InitialOwner IN BOOLEAN InitialOwner
); );
// ****************************************************************** // ******************************************************************
// * NtCreateSemaphore // * NtCreateSemaphore
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(193) ntstatus_xt NTAPI NtCreateSemaphore XBSYSAPI EXPORTNUM(193) NTSTATUS NTAPI NtCreateSemaphore
( (
OUT PHANDLE SemaphoreHandle, OUT PHANDLE SemaphoreHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ulong_xt InitialCount, IN ULONG InitialCount,
IN ulong_xt MaximumCount IN ULONG MaximumCount
); );
// ****************************************************************** // ******************************************************************
// * 0x00C2 - NtCreateTimer() // * 0x00C2 - NtCreateTimer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(194) ntstatus_xt NTAPI NtCreateTimer XBSYSAPI EXPORTNUM(194) NTSTATUS NTAPI NtCreateTimer
( (
OUT PHANDLE TimerHandle, OUT PHANDLE TimerHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
@ -145,7 +138,7 @@ XBSYSAPI EXPORTNUM(194) ntstatus_xt NTAPI NtCreateTimer
// ****************************************************************** // ******************************************************************
// * 0x00C3 - NtDeleteFile() // * 0x00C3 - NtDeleteFile()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(195) ntstatus_xt NTAPI NtDeleteFile XBSYSAPI EXPORTNUM(195) NTSTATUS NTAPI NtDeleteFile
( (
IN POBJECT_ATTRIBUTES ObjectAttributes IN POBJECT_ATTRIBUTES ObjectAttributes
); );
@ -153,34 +146,34 @@ XBSYSAPI EXPORTNUM(195) ntstatus_xt NTAPI NtDeleteFile
// ****************************************************************** // ******************************************************************
// * 0x00C4 - NtDeviceIoControlFile // * 0x00C4 - NtDeviceIoControlFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(196) ntstatus_xt NTAPI NtDeviceIoControlFile XBSYSAPI EXPORTNUM(196) NTSTATUS NTAPI NtDeviceIoControlFile
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL, IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL, IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN ulong_xt IoControlCode, IN ULONG IoControlCode,
IN PVOID InputBuffer OPTIONAL, IN PVOID InputBuffer OPTIONAL,
IN ulong_xt InputBufferLength, IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL, OUT PVOID OutputBuffer OPTIONAL,
IN ulong_xt OutputBufferLength IN ULONG OutputBufferLength
); );
// ****************************************************************** // ******************************************************************
// * NtDuplicateObject // * NtDuplicateObject
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(197) ntstatus_xt NTAPI NtDuplicateObject XBSYSAPI EXPORTNUM(197) NTSTATUS NTAPI NtDuplicateObject
( (
PVOID SourceHandle, PVOID SourceHandle,
PVOID *TargetHandle, PVOID *TargetHandle,
dword_xt Options DWORD Options
); );
// ****************************************************************** // ******************************************************************
// * NtFlushBuffersFile // * NtFlushBuffersFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(198) ntstatus_xt NTAPI NtFlushBuffersFile XBSYSAPI EXPORTNUM(198) NTSTATUS NTAPI NtFlushBuffersFile
( (
PVOID FileHandle, PVOID FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock OUT PIO_STATUS_BLOCK IoStatusBlock
@ -189,31 +182,31 @@ XBSYSAPI EXPORTNUM(198) ntstatus_xt NTAPI NtFlushBuffersFile
// ****************************************************************** // ******************************************************************
// * NtFreeVirtualMemory // * NtFreeVirtualMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(199) ntstatus_xt NTAPI NtFreeVirtualMemory XBSYSAPI EXPORTNUM(199) NTSTATUS NTAPI NtFreeVirtualMemory
( (
IN OUT PVOID *BaseAddress, IN OUT PVOID *BaseAddress,
IN OUT PULONG FreeSize, IN OUT PULONG FreeSize,
IN ulong_xt FreeType IN ULONG FreeType
); );
// ****************************************************************** // ******************************************************************
// * 0x00C8 - NtFsControlFile // * 0x00C8 - NtFsControlFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(200) ntstatus_xt NTAPI NtFsControlFile XBSYSAPI EXPORTNUM(200) NTSTATUS NTAPI NtFsControlFile
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL, IN HANDLE Event OPTIONAL,
IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL,
IN PVOID ApcContext OPTIONAL, IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN ulong_xt FsControlCode, IN ULONG FsControlCode,
IN PVOID InputBuffer OPTIONAL, IN PVOID InputBuffer OPTIONAL,
IN ulong_xt InputBufferLength, IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL, OUT PVOID OutputBuffer OPTIONAL,
IN ulong_xt OutputBufferLength IN ULONG OutputBufferLength
); );
XBSYSAPI EXPORTNUM(201) ntstatus_xt NTAPI NtOpenDirectoryObject XBSYSAPI EXPORTNUM(201) NTSTATUS NTAPI NtOpenDirectoryObject
( (
OUT PHANDLE DirectoryHandle, OUT PHANDLE DirectoryHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes IN POBJECT_ATTRIBUTES ObjectAttributes
@ -222,25 +215,25 @@ XBSYSAPI EXPORTNUM(201) ntstatus_xt NTAPI NtOpenDirectoryObject
// ****************************************************************** // ******************************************************************
// * NtOpenFile // * NtOpenFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(202) ntstatus_xt NTAPI NtOpenFile XBSYSAPI EXPORTNUM(202) NTSTATUS NTAPI NtOpenFile
( (
OUT PHANDLE FileHandle, OUT PHANDLE FileHandle,
IN access_mask_xt DesiredAccess, IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN ulong_xt ShareAccess, IN ULONG ShareAccess,
IN ulong_xt OpenOptions IN ULONG OpenOptions
); );
XBSYSAPI EXPORTNUM(203) ntstatus_xt NTAPI NtOpenSymbolicLinkObject( XBSYSAPI EXPORTNUM(203) NTSTATUS NTAPI NtOpenSymbolicLinkObject(
OUT PHANDLE LinkHandle, OUT PHANDLE LinkHandle,
IN POBJECT_ATTRIBUTES ObjectAttributes IN POBJECT_ATTRIBUTES ObjectAttributes
); );
XBSYSAPI EXPORTNUM(205) ntstatus_xt NTAPI NtProtectVirtualMemory( XBSYSAPI EXPORTNUM(205) NTSTATUS NTAPI NtProtectVirtualMemory(
IN OUT PVOID *BaseAddress, IN OUT PVOID *BaseAddress,
IN OUT PSIZE_T RegionSize, IN OUT PSIZE_T RegionSize,
IN ulong_xt NewProtect, IN ULONG NewProtect,
OUT PULONG OldProtect OUT PULONG OldProtect
); );
@ -248,7 +241,7 @@ XBSYSAPI EXPORTNUM(205) ntstatus_xt NTAPI NtProtectVirtualMemory(
// ****************************************************************** // ******************************************************************
// * NtPulseEvent // * NtPulseEvent
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(205) ntstatus_xt NTAPI NtPulseEvent XBSYSAPI EXPORTNUM(205) NTSTATUS NTAPI NtPulseEvent
( (
IN HANDLE EventHandle, IN HANDLE EventHandle,
OUT PLONG PreviousState OPTIONAL OUT PLONG PreviousState OPTIONAL
@ -257,19 +250,19 @@ XBSYSAPI EXPORTNUM(205) ntstatus_xt NTAPI NtPulseEvent
// ****************************************************************** // ******************************************************************
// * NtQueueApcThread // * NtQueueApcThread
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(206) ntstatus_xt NTAPI NtQueueApcThread XBSYSAPI EXPORTNUM(206) NTSTATUS NTAPI NtQueueApcThread
( (
IN HANDLE ThreadHandle, IN HANDLE ThreadHandle,
IN PIO_APC_ROUTINE ApcRoutine, IN PIO_APC_ROUTINE ApcRoutine,
IN PVOID ApcRoutineContext OPTIONAL, IN PVOID ApcRoutineContext OPTIONAL,
IN PIO_STATUS_BLOCK ApcStatusBlock OPTIONAL, IN PIO_STATUS_BLOCK ApcStatusBlock OPTIONAL,
IN PVOID ApcReserved OPTIONAL IN ULONG ApcReserved OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * NtQueryDirectoryFile // * NtQueryDirectoryFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(207) ntstatus_xt NTAPI NtQueryDirectoryFile XBSYSAPI EXPORTNUM(207) NTSTATUS NTAPI NtQueryDirectoryFile
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL, IN HANDLE Event OPTIONAL,
@ -277,20 +270,20 @@ XBSYSAPI EXPORTNUM(207) ntstatus_xt NTAPI NtQueryDirectoryFile
IN PVOID ApcContext, IN PVOID ApcContext,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT FILE_DIRECTORY_INFORMATION *FileInformation, OUT FILE_DIRECTORY_INFORMATION *FileInformation,
IN ulong_xt Length, IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass, IN FILE_INFORMATION_CLASS FileInformationClass,
IN PSTRING FileMask, IN PSTRING FileMask,
IN boolean_xt RestartScan IN BOOLEAN RestartScan
); );
// ****************************************************************** // ******************************************************************
// * 0x00D0 - NtQueryDirectoryObject // * 0x00D0 - NtQueryDirectoryObject
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(208) ntstatus_xt NTAPI NtQueryDirectoryObject( XBSYSAPI EXPORTNUM(208) NTSTATUS NTAPI NtQueryDirectoryObject(
IN HANDLE DirectoryHandle, IN HANDLE DirectoryHandle,
OUT PVOID Buffer, OUT PVOID Buffer,
IN ulong_xt Length, IN ULONG Length,
IN boolean_xt RestartScan, IN BOOLEAN RestartScan,
IN OUT PULONG Context, IN OUT PULONG Context,
OUT PULONG ReturnedLength OPTIONAL OUT PULONG ReturnedLength OPTIONAL
); );
@ -298,7 +291,7 @@ XBSYSAPI EXPORTNUM(208) ntstatus_xt NTAPI NtQueryDirectoryObject(
// ****************************************************************** // ******************************************************************
// * 0x00D1 - NtQueryEvent() // * 0x00D1 - NtQueryEvent()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(209) ntstatus_xt NTAPI NtQueryEvent XBSYSAPI EXPORTNUM(209) NTSTATUS NTAPI NtQueryEvent
( (
IN HANDLE EventHandle, IN HANDLE EventHandle,
OUT PEVENT_BASIC_INFORMATION EventInformation OUT PEVENT_BASIC_INFORMATION EventInformation
@ -307,7 +300,7 @@ XBSYSAPI EXPORTNUM(209) ntstatus_xt NTAPI NtQueryEvent
// ****************************************************************** // ******************************************************************
// * NtQueryFullAttributesFile // * NtQueryFullAttributesFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(210) ntstatus_xt NTAPI NtQueryFullAttributesFile XBSYSAPI EXPORTNUM(210) NTSTATUS NTAPI NtQueryFullAttributesFile
( (
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PFILE_NETWORK_OPEN_INFORMATION Attributes OUT PFILE_NETWORK_OPEN_INFORMATION Attributes
@ -320,19 +313,19 @@ XBSYSAPI EXPORTNUM(210) ntstatus_xt NTAPI NtQueryFullAttributesFile
// * Return various kinds of information about a given file object. // * Return various kinds of information about a given file object.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(211) ntstatus_xt NTAPI NtQueryInformationFile XBSYSAPI EXPORTNUM(211) NTSTATUS NTAPI NtQueryInformationFile
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FileInformation, OUT PVOID FileInformation,
IN ulong_xt Length, IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInfo IN FILE_INFORMATION_CLASS FileInfo
); );
// ****************************************************************** // ******************************************************************
// * 0x00D4 - NtQueryIoCompletion // * 0x00D4 - NtQueryIoCompletion
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(212) ntstatus_xt NTAPI NtQueryIoCompletion XBSYSAPI EXPORTNUM(212) NTSTATUS NTAPI NtQueryIoCompletion
( (
IN HANDLE IoCompletionHandle, IN HANDLE IoCompletionHandle,
OUT PIO_COMPLETION_BASIC_INFORMATION IoCompletionInformation OUT PIO_COMPLETION_BASIC_INFORMATION IoCompletionInformation
@ -341,7 +334,7 @@ XBSYSAPI EXPORTNUM(212) ntstatus_xt NTAPI NtQueryIoCompletion
// ****************************************************************** // ******************************************************************
// * 0x00D5 - NtQueryMutant() // * 0x00D5 - NtQueryMutant()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(213) ntstatus_xt NTAPI NtQueryMutant XBSYSAPI EXPORTNUM(213) NTSTATUS NTAPI NtQueryMutant
( (
IN HANDLE MutantHandle, IN HANDLE MutantHandle,
OUT PMUTANT_BASIC_INFORMATION MutantInformation OUT PMUTANT_BASIC_INFORMATION MutantInformation
@ -350,7 +343,7 @@ XBSYSAPI EXPORTNUM(213) ntstatus_xt NTAPI NtQueryMutant
// ****************************************************************** // ******************************************************************
// * 0x00D6 - NtQuerySemaphore() // * 0x00D6 - NtQuerySemaphore()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(214) ntstatus_xt NTAPI NtQuerySemaphore XBSYSAPI EXPORTNUM(214) NTSTATUS NTAPI NtQuerySemaphore
( (
IN HANDLE SemaphoreHandle, IN HANDLE SemaphoreHandle,
OUT PSEMAPHORE_BASIC_INFORMATION SemaphoreInformation OUT PSEMAPHORE_BASIC_INFORMATION SemaphoreInformation
@ -359,7 +352,7 @@ XBSYSAPI EXPORTNUM(214) ntstatus_xt NTAPI NtQuerySemaphore
// ****************************************************************** // ******************************************************************
// * 0x00D7 - NtQuerySymbolicLinkObject() // * 0x00D7 - NtQuerySymbolicLinkObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(215) ntstatus_xt NTAPI NtQuerySymbolicLinkObject XBSYSAPI EXPORTNUM(215) NTSTATUS NTAPI NtQuerySymbolicLinkObject
( (
HANDLE LinkHandle, HANDLE LinkHandle,
OUT PSTRING LinkTarget, OUT PSTRING LinkTarget,
@ -369,7 +362,7 @@ XBSYSAPI EXPORTNUM(215) ntstatus_xt NTAPI NtQuerySymbolicLinkObject
// ****************************************************************** // ******************************************************************
// * 0x00D8 - NtQueryTimer() // * 0x00D8 - NtQueryTimer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(216) ntstatus_xt NTAPI NtQueryTimer XBSYSAPI EXPORTNUM(216) NTSTATUS NTAPI NtQueryTimer
( (
IN HANDLE TimerHandle, IN HANDLE TimerHandle,
OUT PTIMER_BASIC_INFORMATION TimerInformation OUT PTIMER_BASIC_INFORMATION TimerInformation
@ -378,7 +371,7 @@ XBSYSAPI EXPORTNUM(216) ntstatus_xt NTAPI NtQueryTimer
// ****************************************************************** // ******************************************************************
// * NtQueryVirtualMemory // * NtQueryVirtualMemory
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(217) ntstatus_xt NTAPI NtQueryVirtualMemory XBSYSAPI EXPORTNUM(217) NTSTATUS NTAPI NtQueryVirtualMemory
( (
IN PVOID BaseAddress, IN PVOID BaseAddress,
OUT PMEMORY_BASIC_INFORMATION Buffer OUT PMEMORY_BASIC_INFORMATION Buffer
@ -387,12 +380,12 @@ XBSYSAPI EXPORTNUM(217) ntstatus_xt NTAPI NtQueryVirtualMemory
// ****************************************************************** // ******************************************************************
// * NtQueryVolumeInformationFile // * NtQueryVolumeInformationFile
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(218) ntstatus_xt NTAPI NtQueryVolumeInformationFile XBSYSAPI EXPORTNUM(218) NTSTATUS NTAPI NtQueryVolumeInformationFile
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PFILE_FS_SIZE_INFORMATION FileInformation, OUT PFILE_FS_SIZE_INFORMATION FileInformation,
IN ulong_xt Length, IN ULONG Length,
IN FS_INFORMATION_CLASS FileInformationClass IN FS_INFORMATION_CLASS FileInformationClass
); );
@ -403,7 +396,7 @@ XBSYSAPI EXPORTNUM(218) ntstatus_xt NTAPI NtQueryVolumeInformationFile
// * Read data from an opened file. // * Read data from an opened file.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(219) ntstatus_xt NTAPI NtReadFile XBSYSAPI EXPORTNUM(219) NTSTATUS NTAPI NtReadFile
( (
IN HANDLE FileHandle, // TODO: correct paramters IN HANDLE FileHandle, // TODO: correct paramters
IN HANDLE Event OPTIONAL, IN HANDLE Event OPTIONAL,
@ -411,14 +404,14 @@ XBSYSAPI EXPORTNUM(219) ntstatus_xt NTAPI NtReadFile
IN PVOID ApcContext, IN PVOID ApcContext,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID Buffer, OUT PVOID Buffer,
IN ulong_xt Length, IN ULONG Length,
IN PLARGE_INTEGER ByteOffset OPTIONAL IN PLARGE_INTEGER ByteOffset OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x00DC - NtReadFileScatter // * 0x00DC - NtReadFileScatter
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(220) ntstatus_xt NTAPI NtReadFileScatter XBSYSAPI EXPORTNUM(220) NTSTATUS NTAPI NtReadFileScatter
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL, IN HANDLE Event OPTIONAL,
@ -426,14 +419,14 @@ XBSYSAPI EXPORTNUM(220) ntstatus_xt NTAPI NtReadFileScatter
IN PVOID ApcContext OPTIONAL, IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PFILE_SEGMENT_ELEMENT SegmentArray, IN PFILE_SEGMENT_ELEMENT SegmentArray,
IN ulong_xt Length, IN ULONG Length,
IN PLARGE_INTEGER ByteOffset OPTIONAL IN PLARGE_INTEGER ByteOffset OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * NtReleaseMutant // * NtReleaseMutant
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(221) ntstatus_xt NTAPI NtReleaseMutant XBSYSAPI EXPORTNUM(221) NTSTATUS NTAPI NtReleaseMutant
( (
IN HANDLE MutantHandle, IN HANDLE MutantHandle,
OUT PLONG PreviousCount OUT PLONG PreviousCount
@ -442,17 +435,17 @@ XBSYSAPI EXPORTNUM(221) ntstatus_xt NTAPI NtReleaseMutant
// ****************************************************************** // ******************************************************************
// * NtReleaseSemaphore // * NtReleaseSemaphore
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(222) ntstatus_xt NTAPI NtReleaseSemaphore XBSYSAPI EXPORTNUM(222) NTSTATUS NTAPI NtReleaseSemaphore
( (
IN HANDLE SemaphoreHandle, IN HANDLE SemaphoreHandle,
IN ulong_xt ReleaseCount, IN ULONG ReleaseCount,
OUT PULONG PreviousCount OPTIONAL OUT PULONG PreviousCount OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x00DF - NtRemoveIoCompletion // * 0x00DF - NtRemoveIoCompletion
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(223) ntstatus_xt NTAPI NtRemoveIoCompletion XBSYSAPI EXPORTNUM(223) NTSTATUS NTAPI NtRemoveIoCompletion
( (
IN HANDLE IoCompletionHandle, IN HANDLE IoCompletionHandle,
OUT PVOID *KeyContext, OUT PVOID *KeyContext,
@ -464,7 +457,7 @@ XBSYSAPI EXPORTNUM(223) ntstatus_xt NTAPI NtRemoveIoCompletion
// ****************************************************************** // ******************************************************************
// * NtResumeThread // * NtResumeThread
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(224) ntstatus_xt NTAPI NtResumeThread XBSYSAPI EXPORTNUM(224) NTSTATUS NTAPI NtResumeThread
( (
IN HANDLE ThreadHandle, IN HANDLE ThreadHandle,
OUT PULONG PreviousSuspendCount OUT PULONG PreviousSuspendCount
@ -473,7 +466,7 @@ XBSYSAPI EXPORTNUM(224) ntstatus_xt NTAPI NtResumeThread
// ****************************************************************** // ******************************************************************
// * NtSetEvent // * NtSetEvent
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(225) ntstatus_xt NTAPI NtSetEvent XBSYSAPI EXPORTNUM(225) NTSTATUS NTAPI NtSetEvent
( (
IN HANDLE EventHandle, IN HANDLE EventHandle,
OUT PLONG PreviousState OUT PLONG PreviousState
@ -486,31 +479,31 @@ XBSYSAPI EXPORTNUM(225) ntstatus_xt NTAPI NtSetEvent
// * Changes various kinds of information about a given file object. // * Changes various kinds of information about a given file object.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(226) ntstatus_xt NTAPI NtSetInformationFile XBSYSAPI EXPORTNUM(226) NTSTATUS NTAPI NtSetInformationFile
( (
IN HANDLE FileHandle, // TODO: correct paramters IN HANDLE FileHandle, // TODO: correct paramters
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PVOID FileInformation, IN PVOID FileInformation,
IN ulong_xt Length, IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInformationClass IN FILE_INFORMATION_CLASS FileInformationClass
); );
// ****************************************************************** // ******************************************************************
// * 0x00E3 - NtSetIoCompletion // * 0x00E3 - NtSetIoCompletion
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(227) ntstatus_xt NTAPI NtSetIoCompletion XBSYSAPI EXPORTNUM(227) NTSTATUS NTAPI NtSetIoCompletion
( (
IN HANDLE IoCompletionHandle, IN HANDLE IoCompletionHandle,
IN PVOID KeyContext, IN PVOID KeyContext,
IN PVOID ApcContext, IN PVOID ApcContext,
IN ntstatus_xt IoStatus, IN NTSTATUS IoStatus,
IN ulong_ptr_xt IoStatusInformation IN ULONG_PTR IoStatusInformation
); );
// ****************************************************************** // ******************************************************************
// * NtSetSystemTime // * NtSetSystemTime
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(228) ntstatus_xt NTAPI NtSetSystemTime XBSYSAPI EXPORTNUM(228) NTSTATUS NTAPI NtSetSystemTime
( (
IN PLARGE_INTEGER SystemTime, IN PLARGE_INTEGER SystemTime,
OUT PLARGE_INTEGER PreviousTime OPTIONAL OUT PLARGE_INTEGER PreviousTime OPTIONAL
@ -519,34 +512,34 @@ XBSYSAPI EXPORTNUM(228) ntstatus_xt NTAPI NtSetSystemTime
// ****************************************************************** // ******************************************************************
// * 0x00E5 - NtSetTimerEx() // * 0x00E5 - NtSetTimerEx()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(229) ntstatus_xt NTAPI NtSetTimerEx XBSYSAPI EXPORTNUM(229) NTSTATUS NTAPI NtSetTimerEx
( (
IN HANDLE TimerHandle, IN HANDLE TimerHandle,
IN PLARGE_INTEGER DueTime, IN PLARGE_INTEGER DueTime,
IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL, IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL,
IN KPROCESSOR_MODE ApcMode, IN KPROCESSOR_MODE ApcMode,
IN PVOID TimerContext OPTIONAL, IN PVOID TimerContext OPTIONAL,
IN boolean_xt WakeTimer, IN BOOLEAN WakeTimer,
IN long_xt Period OPTIONAL, IN LONG Period OPTIONAL,
OUT PBOOLEAN PreviousState OPTIONAL OUT PBOOLEAN PreviousState OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x00E6 - NtSignalAndWaitForSingleObjectEx // * 0x00E6 - NtSignalAndWaitForSingleObjectEx
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(230) ntstatus_xt NTAPI NtSignalAndWaitForSingleObjectEx XBSYSAPI EXPORTNUM(230) NTSTATUS NTAPI NtSignalAndWaitForSingleObjectEx
( (
IN HANDLE SignalHandle, IN HANDLE SignalHandle,
IN HANDLE WaitHandle, IN HANDLE WaitHandle,
IN KPROCESSOR_MODE WaitMode, IN KPROCESSOR_MODE WaitMode,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Timeout OPTIONAL IN PLARGE_INTEGER Timeout OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * NtSuspendThread // * NtSuspendThread
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(231) ntstatus_xt NTAPI NtSuspendThread XBSYSAPI EXPORTNUM(231) NTSTATUS NTAPI NtSuspendThread
( (
IN HANDLE ThreadHandle, IN HANDLE ThreadHandle,
OUT PULONG PreviousSuspendCount OPTIONAL OUT PULONG PreviousSuspendCount OPTIONAL
@ -555,11 +548,11 @@ XBSYSAPI EXPORTNUM(231) ntstatus_xt NTAPI NtSuspendThread
// ****************************************************************** // ******************************************************************
// * NtUserIoApcDispatcher // * NtUserIoApcDispatcher
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(232) void_xt NTAPI NtUserIoApcDispatcher XBSYSAPI EXPORTNUM(232) VOID NTAPI NtUserIoApcDispatcher
( (
PVOID ApcContext, PVOID ApcContext,
PIO_STATUS_BLOCK IoStatusBlock, PIO_STATUS_BLOCK IoStatusBlock,
ulong_xt Reserved ULONG Reserved
); );
// ****************************************************************** // ******************************************************************
@ -571,34 +564,34 @@ XBSYSAPI EXPORTNUM(232) void_xt NTAPI NtUserIoApcDispatcher
// * until the wait times out. // * until the wait times out.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(233) ntstatus_xt NTAPI NtWaitForSingleObject XBSYSAPI EXPORTNUM(233) NTSTATUS NTAPI NtWaitForSingleObject
( (
IN HANDLE Handle, IN HANDLE Handle,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Timeout IN PLARGE_INTEGER Timeout
); );
// ****************************************************************** // ******************************************************************
// * NtWaitForSingleObjectEx // * NtWaitForSingleObjectEx
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(234) ntstatus_xt NTAPI NtWaitForSingleObjectEx XBSYSAPI EXPORTNUM(234) NTSTATUS NTAPI NtWaitForSingleObjectEx
( (
IN HANDLE Handle, IN HANDLE Handle,
IN char_xt WaitMode, IN CHAR WaitMode,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Timeout IN PLARGE_INTEGER Timeout
); );
// ****************************************************************** // ******************************************************************
// * NtWaitForMultipleObjectsEx // * NtWaitForMultipleObjectsEx
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(235) ntstatus_xt NTAPI NtWaitForMultipleObjectsEx XBSYSAPI EXPORTNUM(235) NTSTATUS NTAPI NtWaitForMultipleObjectsEx
( (
IN ulong_xt Count, IN ULONG Count,
IN HANDLE *Handles, IN HANDLE *Handles,
IN WAIT_TYPE WaitType, IN WAIT_TYPE WaitType,
IN char_xt WaitMode, IN CHAR WaitMode,
IN boolean_xt Alertable, IN BOOLEAN Alertable,
IN PLARGE_INTEGER Timeout IN PLARGE_INTEGER Timeout
); );
@ -609,7 +602,7 @@ XBSYSAPI EXPORTNUM(235) ntstatus_xt NTAPI NtWaitForMultipleObjectsEx
// * Write data to an opened file. // * Write data to an opened file.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(236) ntstatus_xt NTAPI NtWriteFile XBSYSAPI EXPORTNUM(236) NTSTATUS NTAPI NtWriteFile
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
IN HANDLE Event, IN HANDLE Event,
@ -617,14 +610,14 @@ XBSYSAPI EXPORTNUM(236) ntstatus_xt NTAPI NtWriteFile
IN PVOID ApcContext OPTIONAL, IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PVOID Buffer, IN PVOID Buffer,
IN ulong_xt Length, IN ULONG Length,
IN PLARGE_INTEGER ByteOffset OPTIONAL IN PLARGE_INTEGER ByteOffset OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x00ED - NtWriteFileGather // * 0x00ED - NtWriteFileGather
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(237) ntstatus_xt NTAPI NtWriteFileGather XBSYSAPI EXPORTNUM(237) NTSTATUS NTAPI NtWriteFileGather
( (
IN HANDLE FileHandle, IN HANDLE FileHandle,
IN HANDLE Event OPTIONAL, IN HANDLE Event OPTIONAL,
@ -632,16 +625,14 @@ XBSYSAPI EXPORTNUM(237) ntstatus_xt NTAPI NtWriteFileGather
IN PVOID ApcContext OPTIONAL, IN PVOID ApcContext OPTIONAL,
OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PIO_STATUS_BLOCK IoStatusBlock,
IN PFILE_SEGMENT_ELEMENT SegmentArray, IN PFILE_SEGMENT_ELEMENT SegmentArray,
IN ulong_xt Length, IN ULONG Length,
IN PLARGE_INTEGER ByteOffset OPTIONAL IN PLARGE_INTEGER ByteOffset OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * NtYieldExecution // * NtYieldExecution
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(238) void_xt NTAPI NtYieldExecution(void); XBSYSAPI EXPORTNUM(238) VOID NTAPI NtYieldExecution(void);
}
#endif #endif

View File

@ -12,12 +12,7 @@
#ifndef XBOXKRNL_OB_H #ifndef XBOXKRNL_OB_H
#define XBOXKRNL_OB_H #define XBOXKRNL_OB_H
#include "types.h" #define OBJ_NAME_PATH_SEPARATOR ((CHAR)L'\\')
namespace xbox
{
#define OBJ_NAME_PATH_SEPARATOR ((char_xt)L'\\')
#define OB_NUMBER_HASH_BUCKETS 11 #define OB_NUMBER_HASH_BUCKETS 11
typedef struct _OBJECT_DIRECTORY { typedef struct _OBJECT_DIRECTORY {
@ -40,27 +35,18 @@ typedef struct _OBJECT_HEADER_NAME_INFO {
#define ObpIsFlagSet(flagset, flag) (((flagset) & (flag)) != 0) #define ObpIsFlagSet(flagset, flag) (((flagset) & (flag)) != 0)
#define ObpIsFlagClear(flagset, flag) (((flagset) & (flag)) == 0) #define ObpIsFlagClear(flagset, flag) (((flagset) & (flag)) == 0)
#define ObpEncodeFreeHandleLink(Link) (((ulong_ptr_xt)(Link)) | 1) #define ObpEncodeFreeHandleLink(Link) (((ULONG_PTR)(Link)) | 1)
#define ObpDecodeFreeHandleLink(Link) (((ulong_ptr_xt)(Link)) & (~1)) #define ObpDecodeFreeHandleLink(Link) (((ULONG_PTR)(Link)) & (~1))
#define ObpIsFreeHandleLink(Link) (((ulong_ptr_xt)(Link)) & 1) #define ObpIsFreeHandleLink(Link) (((ULONG_PTR)(Link)) & 1)
#define ObpGetTableByteOffsetFromHandle(Handle) (HandleToUlong(Handle) & (OB_HANDLES_PER_TABLE * sizeof(PVOID) - 1)) #define ObpGetTableByteOffsetFromHandle(Handle) (HandleToUlong(Handle) & (OB_HANDLES_PER_TABLE * sizeof(PVOID) - 1))
#define ObpGetTableFromHandle(Handle) ObpObjectHandleTable.RootTable[HandleToUlong(Handle) >> (OB_HANDLES_PER_TABLE_SHIFT + 2)] #define ObpGetTableFromHandle(Handle) ObpObjectHandleTable.RootTable[HandleToUlong(Handle) >> (OB_HANDLES_PER_TABLE_SHIFT + 2)]
#define ObpGetHandleContentsPointer(Handle) ((PVOID*)((PUCHAR)ObpGetTableFromHandle(Handle) + ObpGetTableByteOffsetFromHandle(Handle))) #define ObpGetHandleContentsPointer(Handle) ((PVOID*)((PUCHAR)ObpGetTableFromHandle(Handle) + ObpGetTableByteOffsetFromHandle(Handle)))
#define ObpMaskOffApplicationBits(Handle) ((HANDLE)(((ulong_ptr_xt)(Handle)) & ~(sizeof(ulong_xt) - 1))) #define ObpMaskOffApplicationBits(Handle) ((HANDLE)(((ULONG_PTR)(Handle)) & ~(sizeof(ULONG) - 1)))
#define OB_FLAG_NAMED_OBJECT 0x01 #define OB_FLAG_NAMED_OBJECT 0x01
#define OB_FLAG_PERMANENT_OBJECT 0x02 #define OB_FLAG_PERMANENT_OBJECT 0x02
#define OB_FLAG_ATTACHED_OBJECT 0x04 #define OB_FLAG_ATTACHED_OBJECT 0x04
#define OBJ_INHERIT 0x00000002L
#define OBJ_PERMANENT 0x00000010L
#define OBJ_EXCLUSIVE 0x00000020L
#define OBJ_CASE_INSENSITIVE 0x00000040L
#define OBJ_OPENIF 0x00000080L
#define OBJ_OPENLINK 0x00000100L
#define OBJ_KERNEL_HANDLE 0x00000200L
#define OBJ_VALID_ATTRIBUTES 0x000003F2L
#define OBJECT_TO_OBJECT_HEADER(Object) CONTAINING_RECORD(Object, OBJECT_HEADER, Body) #define OBJECT_TO_OBJECT_HEADER(Object) CONTAINING_RECORD(Object, OBJECT_HEADER, Body)
#define OBJECT_TO_OBJECT_HEADER_NAME_INFO(Object) ((POBJECT_HEADER_NAME_INFO)OBJECT_TO_OBJECT_HEADER(Object) - 1) #define OBJECT_TO_OBJECT_HEADER_NAME_INFO(Object) ((POBJECT_HEADER_NAME_INFO)OBJECT_TO_OBJECT_HEADER(Object) - 1)
#define OBJECT_HEADER_NAME_INFO_TO_OBJECT_HEADER(ObjectHeaderNameInfo) ((POBJECT_HEADER)((POBJECT_HEADER_NAME_INFO)(ObjectHeaderNameInfo)+1)) #define OBJECT_HEADER_NAME_INFO_TO_OBJECT_HEADER(ObjectHeaderNameInfo) ((POBJECT_HEADER)((POBJECT_HEADER_NAME_INFO)(ObjectHeaderNameInfo)+1))
@ -68,52 +54,48 @@ typedef struct _OBJECT_HEADER_NAME_INFO {
#define OBJECT_HEADER_NAME_INFO_TO_OBJECT(ObjectHeaderNameInfo) (&OBJECT_HEADER_NAME_INFO_TO_OBJECT_HEADER(ObjectHeaderNameInfo)->Body) #define OBJECT_HEADER_NAME_INFO_TO_OBJECT(ObjectHeaderNameInfo) (&OBJECT_HEADER_NAME_INFO_TO_OBJECT_HEADER(ObjectHeaderNameInfo)->Body)
HANDLE ObpCreateObjectHandle(PVOID Object); HANDLE ObpCreateObjectHandle(PVOID Object);
boolean_xt ObpCreatePermanentDirectoryObject( BOOLEAN ObpCreatePermanentDirectoryObject(
IN POBJECT_STRING DirectoryName OPTIONAL, IN POBJECT_STRING DirectoryName OPTIONAL,
OUT POBJECT_DIRECTORY *DirectoryObject OUT POBJECT_DIRECTORY *DirectoryObject
); );
ntstatus_xt ObpReferenceObjectByName( NTSTATUS ObpReferenceObjectByName(
IN HANDLE RootDirectoryHandle, IN HANDLE RootDirectoryHandle,
IN POBJECT_STRING ObjectName, IN POBJECT_STRING ObjectName,
IN ulong_xt Attributes, IN ULONG Attributes,
IN POBJECT_TYPE ObjectType, IN POBJECT_TYPE ObjectType,
IN OUT PVOID ParseContext OPTIONAL, IN OUT PVOID ParseContext OPTIONAL,
OUT PVOID *ReturnedObject OUT PVOID *ReturnedObject
); );
// Avoid a conflict with the InitializeObjectAttributes macro imported by the windows headers #define XB_InitializeObjectAttributes(p, n, a, r, s){\
#define X_InitializeObjectAttributes(p, n, a, r){\
(p)->RootDirectory = r; \ (p)->RootDirectory = r; \
(p)->Attributes = a; \ (p)->Attributes = a; \
(p)->ObjectName = n; \ (p)->ObjectName = n; \
} }
boolean_xt ObInitSystem(); BOOLEAN ObInitSystem();
boolean_xt ObpExtendObjectHandleTable(); BOOLEAN ObpExtendObjectHandleTable();
void_xt ObDissectName(OBJECT_STRING Path, POBJECT_STRING FirstName, POBJECT_STRING RemainingName); VOID ObDissectName(OBJECT_STRING Path, POBJECT_STRING FirstName, POBJECT_STRING RemainingName);
PVOID ObpGetObjectHandleContents(HANDLE Handle); PVOID ObpGetObjectHandleContents(HANDLE Handle);
PVOID ObpGetObjectHandleReference(HANDLE Handle); PVOID ObpGetObjectHandleReference(HANDLE Handle);
ulong_xt FASTCALL ObpComputeHashIndex(POBJECT_STRING ElementName); ULONG FASTCALL ObpComputeHashIndex(IN POBJECT_STRING ElementName);
PVOID ObpDestroyObjectHandle(HANDLE Handle);
void_xt ObpDetachNamedObject(PVOID Object, KIRQL OldIrql);
ntstatus_xt ObpClose(HANDLE Handle);
boolean_xt ObpLookupElementNameInDirectory( BOOLEAN ObpLookupElementNameInDirectory(
IN POBJECT_DIRECTORY Directory, IN POBJECT_DIRECTORY Directory,
IN POBJECT_STRING ElementName, IN POBJECT_STRING ElementName,
IN boolean_xt ResolveSymbolicLink, IN BOOLEAN ResolveSymbolicLink,
OUT PVOID *ReturnedObject OUT PVOID *ReturnedObject
); );
// ****************************************************************** // ******************************************************************
// * 0x00EF - ObCreateObject() // * 0x00EF - ObCreateObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(239) ntstatus_xt NTAPI ObCreateObject XBSYSAPI EXPORTNUM(239) NTSTATUS NTAPI ObCreateObject
( (
IN POBJECT_TYPE ObjectType, IN POBJECT_TYPE ObjectType,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ulong_xt ObjectBodySize, IN ULONG ObjectBodySize,
OUT PVOID *Object OUT PVOID *Object
); );
@ -125,18 +107,18 @@ XBSYSAPI EXPORTNUM(240) OBJECT_TYPE ObDirectoryObjectType;
// ****************************************************************** // ******************************************************************
// * 0x00F1 - ObInsertObject() // * 0x00F1 - ObInsertObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(241) ntstatus_xt NTAPI ObInsertObject XBSYSAPI EXPORTNUM(241) NTSTATUS NTAPI ObInsertObject
( (
IN PVOID Object, IN PVOID Object,
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN ulong_xt ObjectPointerBias, IN ULONG ObjectPointerBias,
OUT PHANDLE Handle OUT PHANDLE Handle
); );
// ****************************************************************** // ******************************************************************
// * 0x00F2 - ObMakeTemporaryObject() // * 0x00F2 - ObMakeTemporaryObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(242) void_xt NTAPI ObMakeTemporaryObject XBSYSAPI EXPORTNUM(242) VOID NTAPI ObMakeTemporaryObject
( (
IN PVOID Object IN PVOID Object
); );
@ -144,7 +126,7 @@ XBSYSAPI EXPORTNUM(242) void_xt NTAPI ObMakeTemporaryObject
// ****************************************************************** // ******************************************************************
// * 0x00F3 - ObOpenObjectByName() // * 0x00F3 - ObOpenObjectByName()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(243) ntstatus_xt NTAPI ObOpenObjectByName XBSYSAPI EXPORTNUM(243) NTSTATUS NTAPI ObOpenObjectByName
( (
IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_ATTRIBUTES ObjectAttributes,
IN POBJECT_TYPE ObjectType, IN POBJECT_TYPE ObjectType,
@ -155,7 +137,7 @@ XBSYSAPI EXPORTNUM(243) ntstatus_xt NTAPI ObOpenObjectByName
// ****************************************************************** // ******************************************************************
// * 0x00F4 - ObOpenObjectByPointer() // * 0x00F4 - ObOpenObjectByPointer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(244) ntstatus_xt NTAPI ObOpenObjectByPointer XBSYSAPI EXPORTNUM(244) NTSTATUS NTAPI ObOpenObjectByPointer
( (
IN PVOID Object, IN PVOID Object,
IN POBJECT_TYPE ObjectType, IN POBJECT_TYPE ObjectType,
@ -168,8 +150,8 @@ XBSYSAPI EXPORTNUM(244) ntstatus_xt NTAPI ObOpenObjectByPointer
#define OB_HANDLES_PER_SEGMENT (OB_TABLES_PER_SEGMENT * OB_HANDLES_PER_TABLE) #define OB_HANDLES_PER_SEGMENT (OB_TABLES_PER_SEGMENT * OB_HANDLES_PER_TABLE)
typedef struct _OBJECT_HANDLE_TABLE { typedef struct _OBJECT_HANDLE_TABLE {
long_xt HandleCount; LONG HandleCount;
long_ptr_xt FirstFreeTableEntry; LONG_PTR FirstFreeTableEntry;
HANDLE NextHandleNeedingPool; HANDLE NextHandleNeedingPool;
PVOID **RootTable; PVOID **RootTable;
PVOID *BuiltinRootTable[OB_TABLES_PER_SEGMENT]; PVOID *BuiltinRootTable[OB_TABLES_PER_SEGMENT];
@ -183,7 +165,7 @@ XBSYSAPI EXPORTNUM(245) OBJECT_HANDLE_TABLE ObpObjectHandleTable;
// ****************************************************************** // ******************************************************************
// * 0x00F6 - ObReferenceObjectByHandle() // * 0x00F6 - ObReferenceObjectByHandle()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(246) ntstatus_xt NTAPI ObReferenceObjectByHandle XBSYSAPI EXPORTNUM(246) NTSTATUS NTAPI ObReferenceObjectByHandle
( (
IN HANDLE Handle, IN HANDLE Handle,
IN POBJECT_TYPE ObjectType OPTIONAL, IN POBJECT_TYPE ObjectType OPTIONAL,
@ -193,10 +175,10 @@ XBSYSAPI EXPORTNUM(246) ntstatus_xt NTAPI ObReferenceObjectByHandle
// ****************************************************************** // ******************************************************************
// * 0x00F7 - ObReferenceObjectByName() // * 0x00F7 - ObReferenceObjectByName()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(247) ntstatus_xt NTAPI ObReferenceObjectByName XBSYSAPI EXPORTNUM(247) NTSTATUS NTAPI ObReferenceObjectByName
( (
IN POBJECT_STRING ObjectName, IN POBJECT_STRING ObjectName,
IN ulong_xt Attributes, IN ULONG Attributes,
IN POBJECT_TYPE ObjectType, IN POBJECT_TYPE ObjectType,
IN OUT PVOID ParseContext OPTIONAL, IN OUT PVOID ParseContext OPTIONAL,
OUT PVOID *Object OUT PVOID *Object
@ -205,7 +187,7 @@ XBSYSAPI EXPORTNUM(247) ntstatus_xt NTAPI ObReferenceObjectByName
// ****************************************************************** // ******************************************************************
// * 0x00F8 - ObReferenceObjectByPointer() // * 0x00F8 - ObReferenceObjectByPointer()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(248) ntstatus_xt NTAPI ObReferenceObjectByPointer XBSYSAPI EXPORTNUM(248) NTSTATUS NTAPI ObReferenceObjectByPointer
( (
IN PVOID Object, IN PVOID Object,
IN POBJECT_TYPE ObjectType IN POBJECT_TYPE ObjectType
@ -219,7 +201,7 @@ XBSYSAPI EXPORTNUM(249) OBJECT_TYPE ObSymbolicLinkObjectType;
// ****************************************************************** // ******************************************************************
// * 0x00FA - ObfDereferenceObject() // * 0x00FA - ObfDereferenceObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(250) void_xt FASTCALL ObfDereferenceObject XBSYSAPI EXPORTNUM(250) VOID FASTCALL ObfDereferenceObject
( (
IN PVOID Object IN PVOID Object
); );
@ -227,12 +209,11 @@ XBSYSAPI EXPORTNUM(250) void_xt FASTCALL ObfDereferenceObject
// ****************************************************************** // ******************************************************************
// * 0x00FB - ObfReferenceObject() // * 0x00FB - ObfReferenceObject()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(251) void_xt FASTCALL ObfReferenceObject XBSYSAPI EXPORTNUM(251) VOID FASTCALL ObfReferenceObject
( (
IN PVOID Object IN PVOID Object
); );
}
#endif #endif

View File

@ -12,45 +12,41 @@
#ifndef XBOXKRNL_PS_H #ifndef XBOXKRNL_PS_H
#define XBOXKRNL_PS_H #define XBOXKRNL_PS_H
#include "types.h" #define PsGetCurrentThread() (CONTAINING_RECORD((KeGetCurrentThread()),ETHREAD,Tcb))
#define X_THREAD_QUANTUM 60
namespace xbox
{
// ****************************************************************** // ******************************************************************
// * PsCreateSystemThread // * PsCreateSystemThread
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(254) ntstatus_xt NTAPI PsCreateSystemThread XBSYSAPI EXPORTNUM(254) NTSTATUS NTAPI PsCreateSystemThread
( (
OUT PHANDLE ThreadHandle, OUT PHANDLE ThreadHandle,
OUT PHANDLE ThreadId OPTIONAL, OUT PHANDLE ThreadId OPTIONAL,
IN PKSTART_ROUTINE StartRoutine, IN PKSTART_ROUTINE StartRoutine,
IN PVOID StartContext, IN PVOID StartContext,
IN boolean_xt DebuggerThread IN BOOLEAN DebuggerThread
); );
// ****************************************************************** // ******************************************************************
// * PsCreateSystemThreadEx // * PsCreateSystemThreadEx
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(255) ntstatus_xt NTAPI PsCreateSystemThreadEx XBSYSAPI EXPORTNUM(255) NTSTATUS NTAPI PsCreateSystemThreadEx
( (
OUT PHANDLE ThreadHandle, OUT PHANDLE ThreadHandle,
IN ulong_xt ThreadExtensionSize, IN ULONG ThreadExtensionSize,
IN ulong_xt KernelStackSize, IN ULONG KernelStackSize,
IN ulong_xt TlsDataSize, IN ULONG TlsDataSize,
OUT PHANDLE ThreadId OPTIONAL, OUT PHANDLE ThreadId OPTIONAL,
IN PKSTART_ROUTINE StartRoutine, IN PKSTART_ROUTINE StartRoutine,
IN PVOID StartContext, IN PVOID StartContext,
IN boolean_xt CreateSuspended, IN BOOLEAN CreateSuspended,
IN boolean_xt DebuggerThread, IN BOOLEAN DebuggerThread,
IN PKSYSTEM_ROUTINE SystemRoutine OPTIONAL IN PKSYSTEM_ROUTINE SystemRoutine OPTIONAL
); );
// ****************************************************************** // ******************************************************************
// * 0x0100 - PsQueryStatistics() // * 0x0100 - PsQueryStatistics()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(256) ntstatus_xt NTAPI PsQueryStatistics XBSYSAPI EXPORTNUM(256) NTSTATUS NTAPI PsQueryStatistics
( (
IN OUT PPS_STATISTICS ProcessStatistics IN OUT PPS_STATISTICS ProcessStatistics
); );
@ -58,7 +54,7 @@ XBSYSAPI EXPORTNUM(256) ntstatus_xt NTAPI PsQueryStatistics
// ****************************************************************** // ******************************************************************
// * PsSetCreateThreadNotifyRoutine // * PsSetCreateThreadNotifyRoutine
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(257) ntstatus_xt NTAPI PsSetCreateThreadNotifyRoutine XBSYSAPI EXPORTNUM(257) NTSTATUS NTAPI PsSetCreateThreadNotifyRoutine
( (
IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine IN PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
); );
@ -66,13 +62,9 @@ XBSYSAPI EXPORTNUM(257) ntstatus_xt NTAPI PsSetCreateThreadNotifyRoutine
// ****************************************************************** // ******************************************************************
// * PsTerminateSystemThread // * PsTerminateSystemThread
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(258) void_xt NTAPI PsTerminateSystemThread(IN ntstatus_xt ExitStatus); XBSYSAPI EXPORTNUM(258) VOID NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus);
XBSYSAPI EXPORTNUM(259) OBJECT_TYPE PsThreadObjectType; XBSYSAPI EXPORTNUM(259) volatile OBJECT_TYPE PsThreadObjectType;
PETHREAD PspGetCurrentThread();
}
#endif #endif

View File

@ -12,37 +12,32 @@
#ifndef XBOXKRNL_RTL_H #ifndef XBOXKRNL_RTL_H
#define XBOXKRNL_RTL_H #define XBOXKRNL_RTL_H
#include "types.h"
namespace xbox
{
// ****************************************************************** // ******************************************************************
// * RtlAnsiStringToUnicodeString // * RtlAnsiStringToUnicodeString
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(260) ntstatus_xt NTAPI RtlAnsiStringToUnicodeString XBSYSAPI EXPORTNUM(260) NTSTATUS NTAPI RtlAnsiStringToUnicodeString
( (
PUNICODE_STRING DestinationString, PUNICODE_STRING DestinationString,
PSTRING SourceString, PSTRING SourceString,
uchar_xt AllocateDestinationString UCHAR AllocateDestinationString
); );
// ****************************************************************** // ******************************************************************
// * RtlAppendStringToString // * RtlAppendStringToString
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(261) ntstatus_xt NTAPI RtlAppendStringToString XBSYSAPI EXPORTNUM(261) NTSTATUS NTAPI RtlAppendStringToString
( (
IN OUT PSTRING Destination, IN OUT PSTRING Destination,
IN PSTRING Source IN PSTRING Source
); );
XBSYSAPI EXPORTNUM(262) ntstatus_xt NTAPI RtlAppendUnicodeStringToString XBSYSAPI EXPORTNUM(262) NTSTATUS NTAPI RtlAppendUnicodeStringToString
( (
IN OUT PUNICODE_STRING Destination, IN OUT PUNICODE_STRING Destination,
IN PUNICODE_STRING Source IN PUNICODE_STRING Source
); );
XBSYSAPI EXPORTNUM(263) ntstatus_xt NTAPI RtlAppendUnicodeToString XBSYSAPI EXPORTNUM(263) NTSTATUS NTAPI RtlAppendUnicodeToString
( (
IN OUT PUNICODE_STRING Destination, IN OUT PUNICODE_STRING Destination,
IN LPCWSTR Source IN LPCWSTR Source
@ -51,18 +46,18 @@ XBSYSAPI EXPORTNUM(263) ntstatus_xt NTAPI RtlAppendUnicodeToString
// ****************************************************************** // ******************************************************************
// * RtlAssert // * RtlAssert
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(264) void_xt NTAPI RtlAssert XBSYSAPI EXPORTNUM(264) VOID NTAPI RtlAssert
( (
PCHAR FailedAssertion, PCHAR FailedAssertion,
PCHAR FileName, PCHAR FileName,
ulong_xt LineNumber, ULONG LineNumber,
PCHAR Message PCHAR Message
); );
// ****************************************************************** // ******************************************************************
// * 0x0109 - RtlCaptureContext() // * 0x0109 - RtlCaptureContext()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(265) void_xt NTAPI RtlCaptureContext XBSYSAPI EXPORTNUM(265) VOID NTAPI RtlCaptureContext
( (
IN PCONTEXT ContextRecord IN PCONTEXT ContextRecord
); );
@ -70,10 +65,10 @@ XBSYSAPI EXPORTNUM(265) void_xt NTAPI RtlCaptureContext
// ****************************************************************** // ******************************************************************
// * 0x010A - RtlCaptureStackBackTrace() // * 0x010A - RtlCaptureStackBackTrace()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(266) ushort_xt NTAPI RtlCaptureStackBackTrace XBSYSAPI EXPORTNUM(266) USHORT NTAPI RtlCaptureStackBackTrace
( (
IN ulong_xt FramesToSkip, IN ULONG FramesToSkip,
IN ulong_xt FramesToCapture, IN ULONG FramesToCapture,
OUT PVOID *BackTrace, OUT PVOID *BackTrace,
OUT PULONG BackTraceHash OUT PULONG BackTraceHash
); );
@ -81,10 +76,10 @@ XBSYSAPI EXPORTNUM(266) ushort_xt NTAPI RtlCaptureStackBackTrace
// ****************************************************************** // ******************************************************************
// * RtlCharToInteger // * RtlCharToInteger
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(267) ntstatus_xt NTAPI RtlCharToInteger XBSYSAPI EXPORTNUM(267) NTSTATUS NTAPI RtlCharToInteger
( (
IN PCSZ String, IN PCSZ String,
IN ulong_xt Base OPTIONAL, IN ULONG Base OPTIONAL,
OUT PULONG Value OUT PULONG Value
); );
@ -95,41 +90,41 @@ XBSYSAPI EXPORTNUM(267) ntstatus_xt NTAPI RtlCharToInteger
// * compare block of memory, return number of equivalent bytes. // * compare block of memory, return number of equivalent bytes.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(268) size_xt NTAPI RtlCompareMemory XBSYSAPI EXPORTNUM(268) SIZE_T NTAPI RtlCompareMemory
( (
IN CONST void_xt *Source1, IN CONST VOID *Source1,
IN CONST void_xt *Source2, IN CONST VOID *Source2,
IN size_xt Length IN SIZE_T Length
); );
// ****************************************************************** // ******************************************************************
// * 0x010D - RtlCompareMemoryUlong() // * 0x010D - RtlCompareMemoryUlong()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(269) size_xt NTAPI RtlCompareMemoryUlong XBSYSAPI EXPORTNUM(269) SIZE_T NTAPI RtlCompareMemoryUlong
( (
IN PVOID Source, IN PVOID Source,
IN size_xt Length, IN SIZE_T Length,
IN ulong_xt Pattern IN ULONG Pattern
); );
// ****************************************************************** // ******************************************************************
// * 0x010E - RtlCompareString() // * 0x010E - RtlCompareString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(270) long_xt NTAPI RtlCompareString XBSYSAPI EXPORTNUM(270) LONG NTAPI RtlCompareString
( (
IN PSTRING String1, IN PSTRING String1,
IN PSTRING String2, IN PSTRING String2,
IN boolean_xt CaseInSensitive IN BOOLEAN CaseInSensitive
); );
// ****************************************************************** // ******************************************************************
// * 0x010F - RtlCompareUnicodeString() // * 0x010F - RtlCompareUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(271) long_xt NTAPI RtlCompareUnicodeString XBSYSAPI EXPORTNUM(271) LONG NTAPI RtlCompareUnicodeString
( (
IN PUNICODE_STRING String1, IN PUNICODE_STRING String1,
IN PUNICODE_STRING String2, IN PUNICODE_STRING String2,
IN boolean_xt CaseInSensitive IN BOOLEAN CaseInSensitive
); );
// ****************************************************************** // ******************************************************************
@ -139,7 +134,7 @@ XBSYSAPI EXPORTNUM(271) long_xt NTAPI RtlCompareUnicodeString
// * Copy Source to Destination // * Copy Source to Destination
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(272) void_xt NTAPI RtlCopyString XBSYSAPI EXPORTNUM(272) VOID NTAPI RtlCopyString
( (
OUT PSTRING DestinationString, OUT PSTRING DestinationString,
IN PSTRING SourceString OPTIONAL IN PSTRING SourceString OPTIONAL
@ -148,7 +143,7 @@ XBSYSAPI EXPORTNUM(272) void_xt NTAPI RtlCopyString
// ****************************************************************** // ******************************************************************
// * 0x0111 - RtlCopyUnicodeString() // * 0x0111 - RtlCopyUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(273) void_xt NTAPI RtlCopyUnicodeString XBSYSAPI EXPORTNUM(273) VOID NTAPI RtlCopyUnicodeString
( (
OUT PUNICODE_STRING DestinationString, OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString OPTIONAL IN PUNICODE_STRING SourceString OPTIONAL
@ -157,7 +152,7 @@ XBSYSAPI EXPORTNUM(273) void_xt NTAPI RtlCopyUnicodeString
// ****************************************************************** // ******************************************************************
// * 0x0112 - RtlCreateUnicodeString() // * 0x0112 - RtlCreateUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(274) boolean_xt NTAPI RtlCreateUnicodeString XBSYSAPI EXPORTNUM(274) BOOLEAN NTAPI RtlCreateUnicodeString
( (
OUT PUNICODE_STRING DestinationString, OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString IN PCWSTR SourceString
@ -166,25 +161,25 @@ XBSYSAPI EXPORTNUM(274) boolean_xt NTAPI RtlCreateUnicodeString
// ****************************************************************** // ******************************************************************
// * 0x0113 - RtlDowncaseUnicodeChar() // * 0x0113 - RtlDowncaseUnicodeChar()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(275) wchar_xt NTAPI RtlDowncaseUnicodeChar XBSYSAPI EXPORTNUM(275) WCHAR NTAPI RtlDowncaseUnicodeChar
( (
IN wchar_xt SourceCharacter IN WCHAR SourceCharacter
); );
// ****************************************************************** // ******************************************************************
// * 0x0114 - RtlDowncaseUnicodeString() // * 0x0114 - RtlDowncaseUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(276) ntstatus_xt NTAPI RtlDowncaseUnicodeString XBSYSAPI EXPORTNUM(276) NTSTATUS NTAPI RtlDowncaseUnicodeString
( (
OUT PUNICODE_STRING DestinationString, OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN boolean_xt AllocateDestinationString IN BOOLEAN AllocateDestinationString
); );
// ****************************************************************** // ******************************************************************
// * RtlEnterCriticalSection // * RtlEnterCriticalSection
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(277) void_xt NTAPI RtlEnterCriticalSection XBSYSAPI EXPORTNUM(277) VOID NTAPI RtlEnterCriticalSection
( (
IN PRTL_CRITICAL_SECTION CriticalSection IN PRTL_CRITICAL_SECTION CriticalSection
); );
@ -192,7 +187,7 @@ XBSYSAPI EXPORTNUM(277) void_xt NTAPI RtlEnterCriticalSection
// ****************************************************************** // ******************************************************************
// * 0x0116 - RtlEnterCriticalSectionAndRegion() // * 0x0116 - RtlEnterCriticalSectionAndRegion()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(278) void_xt NTAPI RtlEnterCriticalSectionAndRegion XBSYSAPI EXPORTNUM(278) VOID NTAPI RtlEnterCriticalSectionAndRegion
( (
IN PRTL_CRITICAL_SECTION CriticalSection IN PRTL_CRITICAL_SECTION CriticalSection
); );
@ -200,21 +195,21 @@ XBSYSAPI EXPORTNUM(278) void_xt NTAPI RtlEnterCriticalSectionAndRegion
// ****************************************************************** // ******************************************************************
// * 0x0117 - RtlEqualString() // * 0x0117 - RtlEqualString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(279) boolean_xt NTAPI RtlEqualString XBSYSAPI EXPORTNUM(279) BOOLEAN NTAPI RtlEqualString
( (
IN PSTRING String1, IN PSTRING String1,
IN PSTRING String2, IN PSTRING String2,
IN boolean_xt CaseInsensitive IN BOOLEAN CaseInsensitive
); );
// ****************************************************************** // ******************************************************************
// * 0x0118 - RtlEqualUnicodeString() // * 0x0118 - RtlEqualUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(280) boolean_xt NTAPI RtlEqualUnicodeString XBSYSAPI EXPORTNUM(280) BOOLEAN NTAPI RtlEqualUnicodeString
( (
IN PUNICODE_STRING String1, IN PUNICODE_STRING String1,
IN PUNICODE_STRING String2, IN PUNICODE_STRING String2,
IN boolean_xt CaseInSensitive IN BOOLEAN CaseInSensitive
); );
// ****************************************************************** // ******************************************************************
@ -223,7 +218,7 @@ XBSYSAPI EXPORTNUM(280) boolean_xt NTAPI RtlEqualUnicodeString
XBSYSAPI EXPORTNUM(281) LARGE_INTEGER NTAPI RtlExtendedIntegerMultiply XBSYSAPI EXPORTNUM(281) LARGE_INTEGER NTAPI RtlExtendedIntegerMultiply
( (
IN LARGE_INTEGER Multiplicand, IN LARGE_INTEGER Multiplicand,
IN long_xt Multiplier IN LONG Multiplier
); );
// ****************************************************************** // ******************************************************************
@ -232,7 +227,7 @@ XBSYSAPI EXPORTNUM(281) LARGE_INTEGER NTAPI RtlExtendedIntegerMultiply
XBSYSAPI EXPORTNUM(282) LARGE_INTEGER NTAPI RtlExtendedLargeIntegerDivide XBSYSAPI EXPORTNUM(282) LARGE_INTEGER NTAPI RtlExtendedLargeIntegerDivide
( (
IN LARGE_INTEGER Dividend, IN LARGE_INTEGER Dividend,
IN ulong_xt Divisor, IN ULONG Divisor,
IN PULONG Remainder // OUT? OPTIONAL? IN PULONG Remainder // OUT? OPTIONAL?
); );
@ -243,33 +238,33 @@ XBSYSAPI EXPORTNUM(283) LARGE_INTEGER NTAPI RtlExtendedMagicDivide
( (
IN LARGE_INTEGER Dividend, IN LARGE_INTEGER Dividend,
IN LARGE_INTEGER MagicDivisor, IN LARGE_INTEGER MagicDivisor,
IN cchar_xt ShiftCount IN CCHAR ShiftCount
); );
// ****************************************************************** // ******************************************************************
// * 0x011C - RtlFillMemory() // * 0x011C - RtlFillMemory()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(284) void_xt NTAPI RtlFillMemory XBSYSAPI EXPORTNUM(284) VOID NTAPI RtlFillMemory
( (
IN void_xt UNALIGNED *Destination, IN VOID UNALIGNED *Destination,
IN dword_xt Length, IN DWORD Length,
IN byte_xt Fill IN BYTE Fill
); );
// ****************************************************************** // ******************************************************************
// * 0x011D - RtlFillMemoryUlong() // * 0x011D - RtlFillMemoryUlong()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(285) void_xt NTAPI RtlFillMemoryUlong XBSYSAPI EXPORTNUM(285) VOID NTAPI RtlFillMemoryUlong
( (
IN PVOID Destination, IN PVOID Destination,
IN size_xt Length, IN SIZE_T Length,
IN ulong_xt Pattern IN ULONG Pattern
); );
// ****************************************************************** // ******************************************************************
// * RtlFreeAnsiString // * RtlFreeAnsiString
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(286) void_xt NTAPI RtlFreeAnsiString XBSYSAPI EXPORTNUM(286) VOID NTAPI RtlFreeAnsiString
( (
IN OUT PANSI_STRING AnsiString IN OUT PANSI_STRING AnsiString
); );
@ -277,7 +272,7 @@ XBSYSAPI EXPORTNUM(286) void_xt NTAPI RtlFreeAnsiString
// ****************************************************************** // ******************************************************************
// * 0x011F - RtlFreeUnicodeString() // * 0x011F - RtlFreeUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(287) void_xt NTAPI RtlFreeUnicodeString XBSYSAPI EXPORTNUM(287) VOID NTAPI RtlFreeUnicodeString
( (
IN OUT PUNICODE_STRING UnicodeString IN OUT PUNICODE_STRING UnicodeString
); );
@ -285,7 +280,7 @@ XBSYSAPI EXPORTNUM(287) void_xt NTAPI RtlFreeUnicodeString
// ****************************************************************** // ******************************************************************
// * 0x0120 - RtlGetCallersAddress() // * 0x0120 - RtlGetCallersAddress()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(288) void_xt NTAPI RtlGetCallersAddress XBSYSAPI EXPORTNUM(288) VOID NTAPI RtlGetCallersAddress
( (
OUT PVOID *CallersAddress, OUT PVOID *CallersAddress,
OUT PVOID *CallersCaller OUT PVOID *CallersCaller
@ -298,13 +293,13 @@ XBSYSAPI EXPORTNUM(288) void_xt NTAPI RtlGetCallersAddress
// * Initialize a counted ANSI string. // * Initialize a counted ANSI string.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(289) void_xt NTAPI RtlInitAnsiString XBSYSAPI EXPORTNUM(289) VOID NTAPI RtlInitAnsiString
( (
IN OUT PANSI_STRING DestinationString, IN OUT PANSI_STRING DestinationString,
IN PCSZ SourceString IN PCSZ SourceString
); );
XBSYSAPI EXPORTNUM(290) void_xt NTAPI RtlInitUnicodeString XBSYSAPI EXPORTNUM(290) VOID NTAPI RtlInitUnicodeString
( (
IN OUT PUNICODE_STRING DestinationString, IN OUT PUNICODE_STRING DestinationString,
IN PCWSTR SourceString IN PCWSTR SourceString
@ -313,7 +308,7 @@ XBSYSAPI EXPORTNUM(290) void_xt NTAPI RtlInitUnicodeString
// ****************************************************************** // ******************************************************************
// * RtlInitializeCriticalSection // * RtlInitializeCriticalSection
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(291) void_xt NTAPI RtlInitializeCriticalSection XBSYSAPI EXPORTNUM(291) VOID NTAPI RtlInitializeCriticalSection
( (
IN PRTL_CRITICAL_SECTION CriticalSection IN PRTL_CRITICAL_SECTION CriticalSection
); );
@ -321,28 +316,28 @@ XBSYSAPI EXPORTNUM(291) void_xt NTAPI RtlInitializeCriticalSection
// ****************************************************************** // ******************************************************************
// * 0x0124 - RtlIntegerToChar() // * 0x0124 - RtlIntegerToChar()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(292) ntstatus_xt NTAPI RtlIntegerToChar XBSYSAPI EXPORTNUM(292) NTSTATUS NTAPI RtlIntegerToChar
( (
IN ulong_xt Value, IN ULONG Value,
IN ulong_xt Base, IN ULONG Base,
IN long_xt OutputLength, IN LONG OutputLength,
IN PSZ String IN PSZ String
); );
// ****************************************************************** // ******************************************************************
// * 0x0125 - RtlIntegerToUnicodeString() // * 0x0125 - RtlIntegerToUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(293) ntstatus_xt NTAPI RtlIntegerToUnicodeString XBSYSAPI EXPORTNUM(293) NTSTATUS NTAPI RtlIntegerToUnicodeString
( (
IN ulong_xt Value, IN ULONG Value,
IN ulong_xt Base, IN ULONG Base,
IN PUNICODE_STRING String IN PUNICODE_STRING String
); );
// ****************************************************************** // ******************************************************************
// * RtlLeaveCriticalSection // * RtlLeaveCriticalSection
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(294) void_xt NTAPI RtlLeaveCriticalSection XBSYSAPI EXPORTNUM(294) VOID NTAPI RtlLeaveCriticalSection
( (
IN PRTL_CRITICAL_SECTION CriticalSection IN PRTL_CRITICAL_SECTION CriticalSection
); );
@ -350,7 +345,7 @@ XBSYSAPI EXPORTNUM(294) void_xt NTAPI RtlLeaveCriticalSection
// ****************************************************************** // ******************************************************************
// * 0x0127 - RtlLeaveCriticalSectionAndRegion() // * 0x0127 - RtlLeaveCriticalSectionAndRegion()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(295) void_xt NTAPI RtlLeaveCriticalSectionAndRegion XBSYSAPI EXPORTNUM(295) VOID NTAPI RtlLeaveCriticalSectionAndRegion
( (
IN PRTL_CRITICAL_SECTION CriticalSection IN PRTL_CRITICAL_SECTION CriticalSection
); );
@ -358,12 +353,12 @@ XBSYSAPI EXPORTNUM(295) void_xt NTAPI RtlLeaveCriticalSectionAndRegion
// ****************************************************************** // ******************************************************************
// * RtlLowerChar // * RtlLowerChar
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(296) char_xt NTAPI RtlLowerChar(char_xt Character); XBSYSAPI EXPORTNUM(296) CHAR NTAPI RtlLowerChar(CHAR Character);
// ****************************************************************** // ******************************************************************
// * 0x0129 - RtlMapGenericMask() // * 0x0129 - RtlMapGenericMask()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(297) void_xt NTAPI RtlMapGenericMask XBSYSAPI EXPORTNUM(297) VOID NTAPI RtlMapGenericMask
( (
IN PACCESS_MASK AccessMask, IN PACCESS_MASK AccessMask,
IN PGENERIC_MAPPING GenericMapping IN PGENERIC_MAPPING GenericMapping
@ -377,47 +372,47 @@ XBSYSAPI EXPORTNUM(297) void_xt NTAPI RtlMapGenericMask
// * in 4-byte blocks, followed by any remaining blocks. // * in 4-byte blocks, followed by any remaining blocks.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(298) void_xt NTAPI RtlMoveMemory XBSYSAPI EXPORTNUM(298) VOID NTAPI RtlMoveMemory
( (
IN void_xt UNALIGNED *Destination, IN VOID UNALIGNED *Destination,
IN CONST void_xt UNALIGNED *Source, IN CONST VOID UNALIGNED *Source,
IN size_xt Length IN SIZE_T Length
); );
// ****************************************************************** // ******************************************************************
// * 0x012B - RtlMultiByteToUnicodeN() // * 0x012B - RtlMultiByteToUnicodeN()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(299) ntstatus_xt NTAPI RtlMultiByteToUnicodeN XBSYSAPI EXPORTNUM(299) NTSTATUS NTAPI RtlMultiByteToUnicodeN
( (
IN PWSTR UnicodeString, IN PWSTR UnicodeString,
IN ulong_xt MaxBytesInUnicodeString, IN ULONG MaxBytesInUnicodeString,
IN PULONG BytesInUnicodeString, IN PULONG BytesInUnicodeString,
IN PCHAR MultiByteString, IN PCHAR MultiByteString,
IN ulong_xt BytesInMultiByteString IN ULONG BytesInMultiByteString
); );
// ****************************************************************** // ******************************************************************
// * 0x012C - RtlMultiByteToUnicodeSize() // * 0x012C - RtlMultiByteToUnicodeSize()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(300) ntstatus_xt NTAPI RtlMultiByteToUnicodeSize XBSYSAPI EXPORTNUM(300) NTSTATUS NTAPI RtlMultiByteToUnicodeSize
( (
IN PULONG BytesInUnicodeString, IN PULONG BytesInUnicodeString,
IN PCHAR MultiByteString, IN PCHAR MultiByteString,
IN ulong_xt BytesInMultiByteString IN ULONG BytesInMultiByteString
); );
// ****************************************************************** // ******************************************************************
// * RtlNtStatusToDosError // * RtlNtStatusToDosError
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(301) ulong_xt NTAPI RtlNtStatusToDosError XBSYSAPI EXPORTNUM(301) ULONG NTAPI RtlNtStatusToDosError
( (
IN ntstatus_xt Status IN NTSTATUS Status
); );
// ****************************************************************** // ******************************************************************
// * 0x012E - RtlRaiseException() // * 0x012E - RtlRaiseException()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(302) void_xt NTAPI RtlRaiseException XBSYSAPI EXPORTNUM(302) VOID NTAPI RtlRaiseException
( (
IN PEXCEPTION_RECORD ExceptionRecord IN PEXCEPTION_RECORD ExceptionRecord
); );
@ -425,15 +420,15 @@ XBSYSAPI EXPORTNUM(302) void_xt NTAPI RtlRaiseException
// ****************************************************************** // ******************************************************************
// * 0x012F - RtlRaiseStatus() // * 0x012F - RtlRaiseStatus()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(303) void_xt NTAPI RtlRaiseStatus XBSYSAPI EXPORTNUM(303) VOID NTAPI RtlRaiseStatus
( (
IN ntstatus_xt Status IN NTSTATUS Status
); );
// ****************************************************************** // ******************************************************************
// * RtlTimeFieldsToTime // * RtlTimeFieldsToTime
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(304) boolean_xt NTAPI RtlTimeFieldsToTime XBSYSAPI EXPORTNUM(304) BOOLEAN NTAPI RtlTimeFieldsToTime
( (
IN PTIME_FIELDS TimeFields, IN PTIME_FIELDS TimeFields,
OUT PLARGE_INTEGER Time OUT PLARGE_INTEGER Time
@ -442,7 +437,7 @@ XBSYSAPI EXPORTNUM(304) boolean_xt NTAPI RtlTimeFieldsToTime
// ****************************************************************** // ******************************************************************
// * RtlTimeToTimeFields // * RtlTimeToTimeFields
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(305) void_xt NTAPI RtlTimeToTimeFields XBSYSAPI EXPORTNUM(305) VOID NTAPI RtlTimeToTimeFields
( (
IN PLARGE_INTEGER Time, IN PLARGE_INTEGER Time,
OUT PTIME_FIELDS TimeFields OUT PTIME_FIELDS TimeFields
@ -451,7 +446,7 @@ XBSYSAPI EXPORTNUM(305) void_xt NTAPI RtlTimeToTimeFields
// ****************************************************************** // ******************************************************************
// * RtlTryEnterCriticalSection // * RtlTryEnterCriticalSection
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(306) boolean_xt NTAPI RtlTryEnterCriticalSection XBSYSAPI EXPORTNUM(306) BOOLEAN NTAPI RtlTryEnterCriticalSection
( (
IN PRTL_CRITICAL_SECTION CriticalSection IN PRTL_CRITICAL_SECTION CriticalSection
); );
@ -459,57 +454,57 @@ XBSYSAPI EXPORTNUM(306) boolean_xt NTAPI RtlTryEnterCriticalSection
// ****************************************************************** // ******************************************************************
// * 0x0133 - RtlUlongByteSwap() // * 0x0133 - RtlUlongByteSwap()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(307) ulong_xt FASTCALL RtlUlongByteSwap XBSYSAPI EXPORTNUM(307) ULONG FASTCALL RtlUlongByteSwap
( (
IN ulong_xt Source IN ULONG Source
); );
// ****************************************************************** // ******************************************************************
// * RtlUnicodeStringToAnsiString // * RtlUnicodeStringToAnsiString
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(308) ntstatus_xt NTAPI RtlUnicodeStringToAnsiString XBSYSAPI EXPORTNUM(308) NTSTATUS NTAPI RtlUnicodeStringToAnsiString
( (
IN OUT PSTRING DestinationString, IN OUT PSTRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN boolean_xt AllocateDestinationString IN BOOLEAN AllocateDestinationString
); );
// ****************************************************************** // ******************************************************************
// * 0x0135 - RtlUnicodeStringToInteger() // * 0x0135 - RtlUnicodeStringToInteger()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(309) ntstatus_xt NTAPI RtlUnicodeStringToInteger XBSYSAPI EXPORTNUM(309) NTSTATUS NTAPI RtlUnicodeStringToInteger
( (
IN PUNICODE_STRING String, IN PUNICODE_STRING String,
IN ulong_xt Base, IN ULONG Base,
IN PULONG Value IN PULONG Value
); );
// ****************************************************************** // ******************************************************************
// * 0x0136 - RtlUnicodeToMultiByteN() // * 0x0136 - RtlUnicodeToMultiByteN()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(310) ntstatus_xt NTAPI RtlUnicodeToMultiByteN XBSYSAPI EXPORTNUM(310) NTSTATUS NTAPI RtlUnicodeToMultiByteN
( (
IN PCHAR MultiByteString, IN PCHAR MultiByteString,
IN ulong_xt MaxBytesInMultiByteString, IN ULONG MaxBytesInMultiByteString,
IN PULONG BytesInMultiByteString, IN PULONG BytesInMultiByteString,
IN PWSTR UnicodeString, IN PWSTR UnicodeString,
IN ulong_xt BytesInUnicodeString IN ULONG BytesInUnicodeString
); );
// ****************************************************************** // ******************************************************************
// * 0x0137 - RtlUnicodeToMultiByteSize() // * 0x0137 - RtlUnicodeToMultiByteSize()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(311) ntstatus_xt NTAPI RtlUnicodeToMultiByteSize XBSYSAPI EXPORTNUM(311) NTSTATUS NTAPI RtlUnicodeToMultiByteSize
( (
IN PULONG BytesInMultiByteString, IN PULONG BytesInMultiByteString,
IN PWSTR UnicodeString, IN PWSTR UnicodeString,
IN ulong_xt BytesInUnicodeString IN ULONG BytesInUnicodeString
); );
// ****************************************************************** // ******************************************************************
// * 0x0138 - RtlUnwind() // * 0x0138 - RtlUnwind()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(312) void_xt NTAPI RtlUnwind XBSYSAPI EXPORTNUM(312) VOID NTAPI RtlUnwind
( (
IN PVOID TargetFrame OPTIONAL, IN PVOID TargetFrame OPTIONAL,
IN PVOID TargetIp OPTIONAL, IN PVOID TargetIp OPTIONAL,
@ -520,45 +515,45 @@ XBSYSAPI EXPORTNUM(312) void_xt NTAPI RtlUnwind
// ****************************************************************** // ******************************************************************
// * 0x0139 - RtlUpcaseUnicodeChar() // * 0x0139 - RtlUpcaseUnicodeChar()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(313) wchar_xt NTAPI RtlUpcaseUnicodeChar XBSYSAPI EXPORTNUM(313) WCHAR NTAPI RtlUpcaseUnicodeChar
( (
IN wchar_xt SourceCharacter IN WCHAR SourceCharacter
); );
// ****************************************************************** // ******************************************************************
// * 0x013A - RtlUpcaseUnicodeString() // * 0x013A - RtlUpcaseUnicodeString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(314) ntstatus_xt NTAPI RtlUpcaseUnicodeString XBSYSAPI EXPORTNUM(314) NTSTATUS NTAPI RtlUpcaseUnicodeString
( (
OUT PUNICODE_STRING DestinationString, OUT PUNICODE_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN boolean_xt AllocateDestinationString IN BOOLEAN AllocateDestinationString
); );
// ****************************************************************** // ******************************************************************
// * 0x013B - RtlUpcaseUnicodeToMultiByteN() // * 0x013B - RtlUpcaseUnicodeToMultiByteN()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(315) ntstatus_xt NTAPI RtlUpcaseUnicodeToMultiByteN XBSYSAPI EXPORTNUM(315) NTSTATUS NTAPI RtlUpcaseUnicodeToMultiByteN
( (
IN OUT PCHAR MultiByteString, IN OUT PCHAR MultiByteString,
IN ulong_xt MaxBytesInMultiByteString, IN ULONG MaxBytesInMultiByteString,
IN PULONG BytesInMultiByteString, IN PULONG BytesInMultiByteString,
IN PWSTR UnicodeString, IN PWSTR UnicodeString,
IN ulong_xt BytesInUnicodeString IN ULONG BytesInUnicodeString
); );
// ****************************************************************** // ******************************************************************
// * 0x013C - RtlUpperChar() // * 0x013C - RtlUpperChar()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(316) char_xt NTAPI RtlUpperChar XBSYSAPI EXPORTNUM(316) CHAR NTAPI RtlUpperChar
( (
char_xt Character CHAR Character
); );
// ****************************************************************** // ******************************************************************
// * 0x013D - RtlUpperString() // * 0x013D - RtlUpperString()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(317) void_xt NTAPI RtlUpperString XBSYSAPI EXPORTNUM(317) VOID NTAPI RtlUpperString
( (
OUT PSTRING DestinationString, OUT PSTRING DestinationString,
IN PSTRING SourceString IN PSTRING SourceString
@ -567,19 +562,19 @@ XBSYSAPI EXPORTNUM(317) void_xt NTAPI RtlUpperString
// ****************************************************************** // ******************************************************************
// * 0x013E - RtlUshortByteSwap() // * 0x013E - RtlUshortByteSwap()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(318) ushort_xt FASTCALL RtlUshortByteSwap XBSYSAPI EXPORTNUM(318) USHORT FASTCALL RtlUshortByteSwap
( (
IN ushort_xt Source IN USHORT Source
); );
// ****************************************************************** // ******************************************************************
// * 0x013F - RtlWalkFrameChain // * 0x013F - RtlWalkFrameChain
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(319) ulong_xt NTAPI RtlWalkFrameChain XBSYSAPI EXPORTNUM(319) ULONG NTAPI RtlWalkFrameChain
( (
OUT PVOID *Callers, OUT PVOID *Callers,
IN ulong_xt Count, IN ULONG Count,
IN ulong_xt Flags IN ULONG Flags
); );
// ****************************************************************** // ******************************************************************
@ -589,27 +584,22 @@ XBSYSAPI EXPORTNUM(319) ulong_xt NTAPI RtlWalkFrameChain
// * Fill a block of memory with zeros. // * Fill a block of memory with zeros.
// * // *
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(320) void_xt NTAPI RtlZeroMemory XBSYSAPI EXPORTNUM(320) VOID NTAPI RtlZeroMemory
( (
IN void_xt UNALIGNED *Destination, IN VOID UNALIGNED *Destination,
IN size_xt Length IN SIZE_T Length
); );
// ****************************************************************** // ******************************************************************
// * 0x0160 - RtlRip // * 0x0160 - RtlRip
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(352) void_xt NTAPI RtlRip XBSYSAPI EXPORTNUM(352) VOID NTAPI RtlRip
( (
PCHAR ApiName, PCHAR ApiName,
PCHAR Expression, PCHAR Expression,
PCHAR Message PCHAR Message
); );
void_xt RtlInitSystem();
extern RTL_CRITICAL_SECTION NtSystemTimeCritSec;
}
#endif #endif

View File

@ -12,11 +12,6 @@
#ifndef XBOX_H #ifndef XBOX_H
#define XBOX_H #define XBOX_H
#include "types.h"
namespace xbox
{
#define AV_PACK_NONE 0x00000000 #define AV_PACK_NONE 0x00000000
#define AV_PACK_STANDARD 0x00000001 #define AV_PACK_STANDARD 0x00000001
#define AV_PACK_RFU 0x00000002 #define AV_PACK_RFU 0x00000002
@ -78,8 +73,6 @@ namespace xbox
#define AV_OPTION_CGMS 18 #define AV_OPTION_CGMS 18
#define AV_OPTION_WIDESCREEN 19 #define AV_OPTION_WIDESCREEN 19
void_xt InitializeFscCacheEvent();
// ****************************************************************** // ******************************************************************
// * 0x0001 - AvGetSavedDataAddress() // * 0x0001 - AvGetSavedDataAddress()
// ****************************************************************** // ******************************************************************
@ -88,31 +81,31 @@ XBSYSAPI EXPORTNUM(1) PVOID NTAPI AvGetSavedDataAddress(void);
// ****************************************************************** // ******************************************************************
// * 0x0002 - AvSendTVEncoderOption() // * 0x0002 - AvSendTVEncoderOption()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(2) void_xt NTAPI AvSendTVEncoderOption XBSYSAPI EXPORTNUM(2) VOID NTAPI AvSendTVEncoderOption
( (
IN PVOID RegisterBase, IN PVOID RegisterBase,
IN ulong_xt Option, IN ULONG Option,
IN ulong_xt Param, IN ULONG Param,
OUT ulong_xt *Result OUT ULONG *Result
); );
// ****************************************************************** // ******************************************************************
// * 0x0003 - AvSetDisplayMode() // * 0x0003 - AvSetDisplayMode()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(3) ulong_xt NTAPI AvSetDisplayMode XBSYSAPI EXPORTNUM(3) ULONG NTAPI AvSetDisplayMode
( (
IN PVOID RegisterBase, IN PVOID RegisterBase,
IN ulong_xt Step, IN ULONG Step,
IN ulong_xt Mode, IN ULONG Mode,
IN ulong_xt Format, IN ULONG Format,
IN ulong_xt Pitch, IN ULONG Pitch,
IN ulong_xt FrameBuffer IN ULONG FrameBuffer
); );
// ****************************************************************** // ******************************************************************
// * 0x0004 - AvSetSavedDataAddress() // * 0x0004 - AvSetSavedDataAddress()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(4) void_xt NTAPI AvSetSavedDataAddress XBSYSAPI EXPORTNUM(4) VOID NTAPI AvSetSavedDataAddress
( (
IN PVOID Address IN PVOID Address
); );
@ -120,51 +113,51 @@ XBSYSAPI EXPORTNUM(4) void_xt NTAPI AvSetSavedDataAddress
// ****************************************************************** // ******************************************************************
// * 0x0023 - FscGetCacheSize() // * 0x0023 - FscGetCacheSize()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(35) ulong_xt NTAPI FscGetCacheSize(); XBSYSAPI EXPORTNUM(35) ULONG NTAPI FscGetCacheSize();
// ****************************************************************** // ******************************************************************
// * 0x0024 - FscInvalidateIdleBlocks() // * 0x0024 - FscInvalidateIdleBlocks()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(36) void_xt NTAPI FscInvalidateIdleBlocks(); XBSYSAPI EXPORTNUM(36) VOID NTAPI FscInvalidateIdleBlocks();
// ****************************************************************** // ******************************************************************
// * 0x0025 - FscSetCacheSize() // * 0x0025 - FscSetCacheSize()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(37) ntstatus_xt NTAPI FscSetCacheSize XBSYSAPI EXPORTNUM(37) NTSTATUS NTAPI FscSetCacheSize
( (
ulong_xt NumberOfCachePages ULONG NumberOfCachePages
); );
// ****************************************************************** // ******************************************************************
// * 0x0058 - KdDebuggerEnabled // * 0x0058 - KdDebuggerEnabled
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(88) boolean_xt KdDebuggerEnabled; XBSYSAPI EXPORTNUM(88) BOOLEAN KdDebuggerEnabled;
// ****************************************************************** // ******************************************************************
// * 0x0059 - KdDebuggerNotPresent // * 0x0059 - KdDebuggerNotPresent
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(89) boolean_xt KdDebuggerNotPresent; XBSYSAPI EXPORTNUM(89) BOOLEAN KdDebuggerNotPresent;
// ****************************************************************** // ******************************************************************
// * 0x00A0 - KfRaiseIrql() // * 0x00A0 - KfRaiseIrql()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(160) uchar_xt FASTCALL KfRaiseIrql XBSYSAPI EXPORTNUM(160) UCHAR FASTCALL KfRaiseIrql
( (
IN uchar_xt NewIrql IN UCHAR NewIrql
); );
// ****************************************************************** // ******************************************************************
// * 0x00A1 - KfLowerIrql() // * 0x00A1 - KfLowerIrql()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(161) void_xt FASTCALL KfLowerIrql XBSYSAPI EXPORTNUM(161) VOID FASTCALL KfLowerIrql
( (
IN uchar_xt NewIrql IN UCHAR NewIrql
); );
// ****************************************************************** // ******************************************************************
// * 0x00A2 - KiBugCheckData // * 0x00A2 - KiBugCheckData
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(162) ulong_ptr_xt KiBugCheckData[5]; XBSYSAPI EXPORTNUM(162) ULONG_PTR KiBugCheckData[5];
void KiLockDispatcherDatabase void KiLockDispatcherDatabase
( (
@ -174,7 +167,7 @@ void KiLockDispatcherDatabase
// ****************************************************************** // ******************************************************************
// * 0x00A3 - KiUnlockDispatcherDatabase() // * 0x00A3 - KiUnlockDispatcherDatabase()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(163) void_xt FASTCALL KiUnlockDispatcherDatabase XBSYSAPI EXPORTNUM(163) VOID FASTCALL KiUnlockDispatcherDatabase
( (
IN KIRQL OldIrql IN KIRQL OldIrql
); );
@ -187,24 +180,24 @@ XBSYSAPI EXPORTNUM(164) PLAUNCH_DATA_PAGE LaunchDataPage;
// ****************************************************************** // ******************************************************************
// * 0x00FC - PhyGetLinkState() // * 0x00FC - PhyGetLinkState()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(252) dword_xt NTAPI PhyGetLinkState XBSYSAPI EXPORTNUM(252) DWORD NTAPI PhyGetLinkState
( (
IN ulong_xt Mode IN ULONG Mode
); );
// ****************************************************************** // ******************************************************************
// * 0x00FD - PhyInitialize() // * 0x00FD - PhyInitialize()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(253) ntstatus_xt NTAPI PhyInitialize XBSYSAPI EXPORTNUM(253) NTSTATUS NTAPI PhyInitialize
( (
IN ulong_xt forceReset, IN ULONG forceReset,
IN PVOID Parameter2 IN PVOID Parameter2
); );
// ****************************************************************** // ******************************************************************
// * 0x0141 - XboxEEPROMKey // * 0x0141 - XboxEEPROMKey
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(321) uchar_xt XboxEEPROMKey[16]; XBSYSAPI EXPORTNUM(321) UCHAR XboxEEPROMKey[16];
// ****************************************************************** // ******************************************************************
// * 0x0142 - XboxHardwareInfo // * 0x0142 - XboxHardwareInfo
@ -214,13 +207,13 @@ XBSYSAPI EXPORTNUM(322) XBOX_HARDWARE_INFO XboxHardwareInfo;
// ****************************************************************** // ******************************************************************
// * 0x0143 - XboxHDKey // * 0x0143 - XboxHDKey
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(323) uchar_xt XboxHDKey[16]; XBSYSAPI EXPORTNUM(323) UCHAR XboxHDKey[16];
typedef struct _XBOX_KRNL_VERSION { typedef struct _XBOX_KRNL_VERSION {
ushort_xt Major; USHORT Major;
ushort_xt Minor; USHORT Minor;
ushort_xt Build; USHORT Build;
ushort_xt Qfe; USHORT Qfe;
} XBOX_KRNL_VERSION; } XBOX_KRNL_VERSION;
// ****************************************************************** // ******************************************************************
@ -231,7 +224,7 @@ XBSYSAPI EXPORTNUM(324) XBOX_KRNL_VERSION XboxKrnlVersion;
// ****************************************************************** // ******************************************************************
// * 0x0145 - XboxSignatureKey // * 0x0145 - XboxSignatureKey
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(325) byte_xt XboxSignatureKey[16]; XBSYSAPI EXPORTNUM(325) BYTE XboxSignatureKey[16];
// ****************************************************************** // ******************************************************************
// * 0x0146 - XeImageFileName // * 0x0146 - XeImageFileName
@ -241,7 +234,7 @@ XBSYSAPI EXPORTNUM(326) OBJECT_STRING XeImageFileName;
// ****************************************************************** // ******************************************************************
// * 0x0147 - XeLoadSection() // * 0x0147 - XeLoadSection()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(327) ntstatus_xt NTAPI XeLoadSection XBSYSAPI EXPORTNUM(327) NTSTATUS NTAPI XeLoadSection
( (
IN PXBEIMAGE_SECTION Section IN PXBEIMAGE_SECTION Section
); );
@ -249,7 +242,7 @@ XBSYSAPI EXPORTNUM(327) ntstatus_xt NTAPI XeLoadSection
// ****************************************************************** // ******************************************************************
// * 0x0148 - XeUnloadSection() // * 0x0148 - XeUnloadSection()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(328) ntstatus_xt NTAPI XeUnloadSection XBSYSAPI EXPORTNUM(328) NTSTATUS NTAPI XeUnloadSection
( (
IN PXBEIMAGE_SECTION Section IN PXBEIMAGE_SECTION Section
); );
@ -257,7 +250,7 @@ XBSYSAPI EXPORTNUM(328) ntstatus_xt NTAPI XeUnloadSection
// ****************************************************************** // ******************************************************************
// * 0x014F - XcSHAInit() // * 0x014F - XcSHAInit()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(335) void_xt NTAPI XcSHAInit XBSYSAPI EXPORTNUM(335) VOID NTAPI XcSHAInit
( (
IN PUCHAR pbSHAContext IN PUCHAR pbSHAContext
); );
@ -265,17 +258,17 @@ XBSYSAPI EXPORTNUM(335) void_xt NTAPI XcSHAInit
// ****************************************************************** // ******************************************************************
// * 0x0150 - XcSHAUpdate() // * 0x0150 - XcSHAUpdate()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(336) void_xt NTAPI XcSHAUpdate XBSYSAPI EXPORTNUM(336) VOID NTAPI XcSHAUpdate
( (
IN PUCHAR pbSHAContext, IN PUCHAR pbSHAContext,
IN PUCHAR pbInput, IN PUCHAR pbInput,
IN ulong_xt dwInputLength IN ULONG dwInputLength
); );
// ****************************************************************** // ******************************************************************
// * 0x0151 - XcSHAFinal() // * 0x0151 - XcSHAFinal()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(337) void_xt NTAPI XcSHAFinal XBSYSAPI EXPORTNUM(337) VOID NTAPI XcSHAFinal
( (
IN PUCHAR pbSHAContext, IN PUCHAR pbSHAContext,
IN PUCHAR pbDigest IN PUCHAR pbDigest
@ -284,41 +277,41 @@ XBSYSAPI EXPORTNUM(337) void_xt NTAPI XcSHAFinal
// ****************************************************************** // ******************************************************************
// * 0x0152 - XcRC4Key() // * 0x0152 - XcRC4Key()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(338) void_xt NTAPI XcRC4Key XBSYSAPI EXPORTNUM(338) VOID NTAPI XcRC4Key
( (
IN PUCHAR pbKeyStruct, IN PUCHAR pbKeyStruct,
IN ulong_xt dwKeyLength, IN ULONG dwKeyLength,
IN PUCHAR pbKey IN PUCHAR pbKey
); );
// ****************************************************************** // ******************************************************************
// * 0x0153 - XcRC4Crypt() // * 0x0153 - XcRC4Crypt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(339) void_xt NTAPI XcRC4Crypt XBSYSAPI EXPORTNUM(339) VOID NTAPI XcRC4Crypt
( (
IN PUCHAR pbKeyStruct, IN PUCHAR pbKeyStruct,
IN ulong_xt dwInputLength, IN ULONG dwInputLength,
IN PUCHAR pbInput IN PUCHAR pbInput
); );
// ****************************************************************** // ******************************************************************
// * 0x0154 - XcHMAC() // * 0x0154 - XcHMAC()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(340) void_xt NTAPI XcHMAC XBSYSAPI EXPORTNUM(340) VOID NTAPI XcHMAC
( (
IN PBYTE pbKeyMaterial, IN PBYTE pbKeyMaterial,
IN ulong_xt cbKeyMaterial, IN ULONG cbKeyMaterial,
IN PBYTE pbData, IN PBYTE pbData,
IN ulong_xt cbData, IN ULONG cbData,
IN PBYTE pbData2, IN PBYTE pbData2,
IN ulong_xt cbData2, IN ULONG cbData2,
OUT PBYTE HmacData OUT PBYTE HmacData
); );
// ****************************************************************** // ******************************************************************
// * 0x0155 - XcPKEncPublic() // * 0x0155 - XcPKEncPublic()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(341) ulong_xt NTAPI XcPKEncPublic XBSYSAPI EXPORTNUM(341) ULONG NTAPI XcPKEncPublic
( (
IN PUCHAR pbPubKey, IN PUCHAR pbPubKey,
IN PUCHAR pbInput, IN PUCHAR pbInput,
@ -328,7 +321,7 @@ XBSYSAPI EXPORTNUM(341) ulong_xt NTAPI XcPKEncPublic
// ****************************************************************** // ******************************************************************
// * 0x0156 - XcPKDecPrivate() // * 0x0156 - XcPKDecPrivate()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(342) ulong_xt NTAPI XcPKDecPrivate XBSYSAPI EXPORTNUM(342) ULONG NTAPI XcPKDecPrivate
( (
IN PUCHAR pbPrvKey, IN PUCHAR pbPrvKey,
IN PUCHAR pbInput, IN PUCHAR pbInput,
@ -338,7 +331,7 @@ XBSYSAPI EXPORTNUM(342) ulong_xt NTAPI XcPKDecPrivate
// ****************************************************************** // ******************************************************************
// * 0x0157 - XcPKGetKeyLen() // * 0x0157 - XcPKGetKeyLen()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(343) ulong_xt NTAPI XcPKGetKeyLen XBSYSAPI EXPORTNUM(343) ULONG NTAPI XcPKGetKeyLen
( (
OUT PUCHAR pbPubKey OUT PUCHAR pbPubKey
); );
@ -346,7 +339,7 @@ XBSYSAPI EXPORTNUM(343) ulong_xt NTAPI XcPKGetKeyLen
// ****************************************************************** // ******************************************************************
// * 0x0158 - XcVerifyPKCS1Signature() // * 0x0158 - XcVerifyPKCS1Signature()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(344) boolean_xt NTAPI XcVerifyPKCS1Signature XBSYSAPI EXPORTNUM(344) BOOLEAN NTAPI XcVerifyPKCS1Signature
( (
IN PUCHAR pbSig, IN PUCHAR pbSig,
IN PUCHAR pbPubKey, IN PUCHAR pbPubKey,
@ -356,30 +349,30 @@ XBSYSAPI EXPORTNUM(344) boolean_xt NTAPI XcVerifyPKCS1Signature
// ****************************************************************** // ******************************************************************
// * 0x0159 - XcModExp() // * 0x0159 - XcModExp()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(345) ulong_xt NTAPI XcModExp XBSYSAPI EXPORTNUM(345) ULONG NTAPI XcModExp
( (
IN LPDWORD pA, IN LPDWORD pA,
IN LPDWORD pB, IN LPDWORD pB,
IN LPDWORD pC, IN LPDWORD pC,
IN LPDWORD pD, IN LPDWORD pD,
IN ulong_xt dwN IN ULONG dwN
); );
// ****************************************************************** // ******************************************************************
// * 0x015A - XcDESKeyParity() // * 0x015A - XcDESKeyParity()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(346) void_xt NTAPI XcDESKeyParity XBSYSAPI EXPORTNUM(346) VOID NTAPI XcDESKeyParity
( (
IN PUCHAR pbKey, IN PUCHAR pbKey,
IN ulong_xt dwKeyLength IN ULONG dwKeyLength
); );
// ****************************************************************** // ******************************************************************
// * 0x015B - XcKeyTable() // * 0x015B - XcKeyTable()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(347) void_xt NTAPI XcKeyTable XBSYSAPI EXPORTNUM(347) VOID NTAPI XcKeyTable
( (
IN ulong_xt dwCipher, IN ULONG dwCipher,
OUT PUCHAR pbKeyTable, OUT PUCHAR pbKeyTable,
IN PUCHAR pbKey IN PUCHAR pbKey
); );
@ -387,55 +380,55 @@ XBSYSAPI EXPORTNUM(347) void_xt NTAPI XcKeyTable
// ****************************************************************** // ******************************************************************
// * 0x015C - XcBlockCrypt() // * 0x015C - XcBlockCrypt()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(348) void_xt NTAPI XcBlockCrypt XBSYSAPI EXPORTNUM(348) VOID NTAPI XcBlockCrypt
( (
IN ulong_xt dwCipher, IN ULONG dwCipher,
OUT PUCHAR pbOutput, OUT PUCHAR pbOutput,
IN PUCHAR pbInput, IN PUCHAR pbInput,
IN PUCHAR pbKeyTable, IN PUCHAR pbKeyTable,
IN ulong_xt dwOp IN ULONG dwOp
); );
// ****************************************************************** // ******************************************************************
// * 0x015D - XcBlockCryptCBC() // * 0x015D - XcBlockCryptCBC()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(349) void_xt NTAPI XcBlockCryptCBC XBSYSAPI EXPORTNUM(349) VOID NTAPI XcBlockCryptCBC
( (
IN ulong_xt dwCipher, IN ULONG dwCipher,
IN ulong_xt dwInputLength, IN ULONG dwInputLength,
OUT PUCHAR pbOutput, OUT PUCHAR pbOutput,
IN PUCHAR pbInput, IN PUCHAR pbInput,
IN PUCHAR pbKeyTable, IN PUCHAR pbKeyTable,
IN ulong_xt dwOp, IN ULONG dwOp,
IN PUCHAR pbFeedback IN PUCHAR pbFeedback
); );
// ****************************************************************** // ******************************************************************
// * 0x015E - XcCryptService() // * 0x015E - XcCryptService()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(350) ulong_xt NTAPI XcCryptService XBSYSAPI EXPORTNUM(350) ULONG NTAPI XcCryptService
( (
IN ulong_xt dwOp, IN ULONG dwOp,
IN PVOID pArgs IN PVOID pArgs
); );
/* Function pointers which point to all the kernel crypto functions. Used by PCRYPTO_VECTOR. */ /* Function pointers which point to all the kernel crypto functions. Used by PCRYPTO_VECTOR. */
typedef void_xt(NTAPI *pfXcSHAInit)(PUCHAR pbSHAContext); typedef VOID(NTAPI *pfXcSHAInit)(PUCHAR pbSHAContext);
typedef void_xt(NTAPI *pfXcSHAUpdate)(PUCHAR pbSHAContext, PUCHAR pbInput, ulong_xt dwInputLength); typedef VOID(NTAPI *pfXcSHAUpdate)(PUCHAR pbSHAContext, PUCHAR pbInput, ULONG dwInputLength);
typedef void_xt(NTAPI *pfXcSHAFinal)(PUCHAR pbSHAContext, PUCHAR pbDigest); typedef VOID(NTAPI *pfXcSHAFinal)(PUCHAR pbSHAContext, PUCHAR pbDigest);
typedef void_xt(NTAPI *pfXcRC4Key)(PUCHAR pbKeyStruct, ulong_xt dwKeyLength, PUCHAR pbKey); typedef VOID(NTAPI *pfXcRC4Key)(PUCHAR pbKeyStruct, ULONG dwKeyLength, PUCHAR pbKey);
typedef void_xt(NTAPI *pfXcRC4Crypt)(PUCHAR pbKeyStruct, ulong_xt dwInputLength, PUCHAR pbInput); typedef VOID(NTAPI *pfXcRC4Crypt)(PUCHAR pbKeyStruct, ULONG dwInputLength, PUCHAR pbInput);
typedef void_xt(NTAPI *pfXcHMAC)(PBYTE pbKeyMaterial, ulong_xt cbKeyMaterial, PBYTE pbData, ulong_xt cbData, PBYTE pbData2, ulong_xt cbData2, PBYTE HmacData); typedef VOID(NTAPI *pfXcHMAC)(PBYTE pbKeyMaterial, ULONG cbKeyMaterial, PBYTE pbData, ULONG cbData, PBYTE pbData2, ULONG cbData2, PBYTE HmacData);
typedef ulong_xt(NTAPI *pfXcPKEncPublic)(PUCHAR pbPubKey, PUCHAR pbInput, PUCHAR pbOutput); typedef ULONG(NTAPI *pfXcPKEncPublic)(PUCHAR pbPubKey, PUCHAR pbInput, PUCHAR pbOutput);
typedef ulong_xt(NTAPI *pfXcPKDecPrivate)(PUCHAR pbPrvKey, PUCHAR pbInput, PUCHAR pbOutput); typedef ULONG(NTAPI *pfXcPKDecPrivate)(PUCHAR pbPrvKey, PUCHAR pbInput, PUCHAR pbOutput);
typedef ulong_xt(NTAPI *pfXcPKGetKeyLen)(PUCHAR pbPubKey); typedef ULONG(NTAPI *pfXcPKGetKeyLen)(PUCHAR pbPubKey);
typedef boolean_xt(NTAPI *pfXcVerifyPKCS1Signature)(PUCHAR pbSig, PUCHAR pbPubKey, PUCHAR pbDigest); typedef BOOLEAN(NTAPI *pfXcVerifyPKCS1Signature)(PUCHAR pbSig, PUCHAR pbPubKey, PUCHAR pbDigest);
typedef ulong_xt(NTAPI *pfXcModExp)(LPDWORD pA, LPDWORD pB, LPDWORD pC, LPDWORD pD, ulong_xt dwN); typedef ULONG(NTAPI *pfXcModExp)(LPDWORD pA, LPDWORD pB, LPDWORD pC, LPDWORD pD, ULONG dwN);
typedef void_xt(NTAPI *pfXcDESKeyParity)(PUCHAR pbKey, ulong_xt dwKeyLength); typedef VOID(NTAPI *pfXcDESKeyParity)(PUCHAR pbKey, ULONG dwKeyLength);
typedef void_xt(NTAPI *pfXcKeyTable)(ulong_xt dwCipher, PUCHAR pbKeyTable, PUCHAR pbKey); typedef VOID(NTAPI *pfXcKeyTable)(ULONG dwCipher, PUCHAR pbKeyTable, PUCHAR pbKey);
typedef void_xt(NTAPI *pfXcBlockCrypt)(ulong_xt dwCipher, PUCHAR pbOutput, PUCHAR pbInput, PUCHAR pbKeyTable, ulong_xt dwOp); typedef VOID(NTAPI *pfXcBlockCrypt)(ULONG dwCipher, PUCHAR pbOutput, PUCHAR pbInput, PUCHAR pbKeyTable, ULONG dwOp);
typedef void_xt(NTAPI *pfXcBlockCryptCBC)(ulong_xt dwCipher, ulong_xt dwInputLength, PUCHAR pbOutput, PUCHAR pbInput, PUCHAR pbKeyTable, ulong_xt dwOp, PUCHAR pbFeedback); typedef VOID(NTAPI *pfXcBlockCryptCBC)(ULONG dwCipher, ULONG dwInputLength, PUCHAR pbOutput, PUCHAR pbInput, PUCHAR pbKeyTable, ULONG dwOp, PUCHAR pbFeedback);
typedef ulong_xt(NTAPI *pfXcCryptService)(ulong_xt dwOp, PVOID pArgs); typedef ULONG(NTAPI *pfXcCryptService)(ULONG dwOp, PVOID pArgs);
/* Struct which contains all the pointers to the crypto functions */ /* Struct which contains all the pointers to the crypto functions */
typedef struct { typedef struct {
@ -460,7 +453,7 @@ typedef struct {
// ****************************************************************** // ******************************************************************
// * 0x015F - XcUpdateCrypto() // * 0x015F - XcUpdateCrypto()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(351) void_xt NTAPI XcUpdateCrypto XBSYSAPI EXPORTNUM(351) VOID NTAPI XcUpdateCrypto
( (
IN PCRYPTO_VECTOR pNewVector, IN PCRYPTO_VECTOR pNewVector,
OUT PCRYPTO_VECTOR pROMVector OPTIONAL OUT PCRYPTO_VECTOR pROMVector OPTIONAL
@ -482,10 +475,10 @@ XBSYSAPI EXPORTNUM(354) XBOX_KEY_DATA XboxAlternateSignatureKeys[ALTERNATE_SIGNA
// ****************************************************************** // ******************************************************************
// * 0x0163 - XePublicKeyData // * 0x0163 - XePublicKeyData
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(355) uchar_xt XePublicKeyData[284]; XBSYSAPI EXPORTNUM(355) UCHAR XePublicKeyData[284];
XBSYSAPI EXPORTNUM(355) uchar_xt XePublicKeyDataRetail[284]; XBSYSAPI EXPORTNUM(355) UCHAR XePublicKeyDataRetail[284];
XBSYSAPI EXPORTNUM(355) uchar_xt XePublicKeyDataDebug[284]; XBSYSAPI EXPORTNUM(355) UCHAR XePublicKeyDataChihiroGame[284];
XBSYSAPI EXPORTNUM(355) uchar_xt XePublicKeyDataChihiro[284]; XBSYSAPI EXPORTNUM(355) UCHAR XePublicKeyDataChihiroBoot[284];
// ****************************************************************** // ******************************************************************
// * 0x0165 - IdexChannelObject // * 0x0165 - IdexChannelObject
@ -495,10 +488,10 @@ XBSYSAPI EXPORTNUM(357) IDE_CHANNEL_OBJECT IdexChannelObject;
// ****************************************************************** // ******************************************************************
// * 0x0169 - RtlSnprintf() // * 0x0169 - RtlSnprintf()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(361) int_xt CDECL RtlSnprintf XBSYSAPI EXPORTNUM(361) INT CDECL RtlSnprintf
( (
IN PCHAR string, IN PCHAR string,
IN size_xt count, IN SIZE_T count,
IN LPCCH format, IN LPCCH format,
... ...
); );
@ -506,7 +499,7 @@ XBSYSAPI EXPORTNUM(361) int_xt CDECL RtlSnprintf
// ****************************************************************** // ******************************************************************
// * 0x016A - RtlSprintf() // * 0x016A - RtlSprintf()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(362) int_xt CDECL RtlSprintf XBSYSAPI EXPORTNUM(362) INT CDECL RtlSprintf
( (
IN PCHAR string, IN PCHAR string,
IN LPCCH format, IN LPCCH format,
@ -516,10 +509,10 @@ XBSYSAPI EXPORTNUM(362) int_xt CDECL RtlSprintf
// ****************************************************************** // ******************************************************************
// * 0x016B - RtlVsnprintf() // * 0x016B - RtlVsnprintf()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(363) int_xt CDECL RtlVsnprintf XBSYSAPI EXPORTNUM(363) INT CDECL RtlVsnprintf
( (
IN PCHAR string, IN PCHAR string,
IN size_xt count, IN SIZE_T count,
IN LPCCH format, IN LPCCH format,
... ...
); );
@ -527,49 +520,47 @@ XBSYSAPI EXPORTNUM(363) int_xt CDECL RtlVsnprintf
// ****************************************************************** // ******************************************************************
// * 0x016C - RtlVsprintf() // * 0x016C - RtlVsprintf()
// ****************************************************************** // ******************************************************************
XBSYSAPI EXPORTNUM(364) int_xt CDECL RtlVsprintf XBSYSAPI EXPORTNUM(364) INT CDECL RtlVsprintf
( (
IN PCHAR string, IN PCHAR string,
IN LPCCH format, IN LPCCH format,
... ...
); );
XBSYSAPI EXPORTNUM(367) ntstatus_xt NTAPI UnknownAPI367 XBSYSAPI EXPORTNUM(367) NTSTATUS NTAPI UnknownAPI367
( (
// UNKNOWN ARGUMENTS // UNKNOWN ARGUMENTS
); );
XBSYSAPI EXPORTNUM(368) ntstatus_xt NTAPI UnknownAPI368 XBSYSAPI EXPORTNUM(368) NTSTATUS NTAPI UnknownAPI368
( (
// UNKNOWN ARGUMENTS // UNKNOWN ARGUMENTS
); );
XBSYSAPI EXPORTNUM(369) ntstatus_xt NTAPI UnknownAPI369 XBSYSAPI EXPORTNUM(369) NTSTATUS NTAPI UnknownAPI369
( (
// UNKNOWN ARGUMENTS // UNKNOWN ARGUMENTS
); );
XBSYSAPI EXPORTNUM(370) ntstatus_xt NTAPI XProfpControl // PROFILING XBSYSAPI EXPORTNUM(370) NTSTATUS NTAPI XProfpControl // PROFILING
( (
ulong_xt Action, ULONG Action,
ulong_xt Param ULONG Param
); );
XBSYSAPI EXPORTNUM(371) ntstatus_xt NTAPI XProfpGetData // PROFILING XBSYSAPI EXPORTNUM(371) NTSTATUS NTAPI XProfpGetData // PROFILING
( (
// NO ARGUMENTS // NO ARGUMENTS
); );
XBSYSAPI EXPORTNUM(372) ntstatus_xt NTAPI IrtClientInitFast // PROFILING XBSYSAPI EXPORTNUM(372) NTSTATUS NTAPI IrtClientInitFast // PROFILING
( (
// UNKNOWN ARGUMENTS // UNKNOWN ARGUMENTS
); );
XBSYSAPI EXPORTNUM(373) ntstatus_xt NTAPI IrtSweep // PROFILING XBSYSAPI EXPORTNUM(373) NTSTATUS NTAPI IrtSweep // PROFILING
( (
// UNKNOWN ARGUMENTS // UNKNOWN ARGUMENTS
); );
}
#endif #endif

@ -1 +1 @@
Subproject commit fa24d868ac2f8fd558e4e914c9863411245db8fd Subproject commit c7b8b49ef8691ac85ad18298468f7e4a616290ed

@ -1 +1 @@
Subproject commit 6de71a326b094377f8773817e1f228a4e435496a Subproject commit 0f2794cac610fad4f1955241ef43e6254fd11205

@ -1 +1 @@
Subproject commit f8a95b7afa963c90b01a9e7cd758346f95c90f50 Subproject commit 7c491b6ef7e49c7f35dcdd39f99f1f5943e48e9e

@ -1 +0,0 @@
Subproject commit 8ced41570e4692b0d556503683ae45f92416f5f1

@ -1 +0,0 @@
Subproject commit cf178f1fac38426990425cc034f7d4b8c9e1e388

@ -1 +0,0 @@
Subproject commit 3f86a95c0784d73ce6815237ec33ed25f233b643

@ -1 +0,0 @@
Subproject commit ead0af5dee49e408c005151393f8a7dbcd27026c

@ -1 +1 @@
Subproject commit 83d4e1ebef3588fae48b69a7352cc21801cb70bc Subproject commit 29cb47ea7674b36cf2b742c11cf2568add1f47fc

@ -1 +0,0 @@
Subproject commit 94e5f23e736f2bb67ebdf90727353e65344f9fc0

View File

@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.12)
project(cxbx) project(cxbx)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 17)
# Suppress extra stuff from generated solution # Suppress extra stuff from generated solution
set(CMAKE_SUPPRESS_REGENERATION true) set(CMAKE_SUPPRESS_REGENERATION true)
@ -12,13 +12,16 @@ include_directories(
"${CXBXR_ROOT_DIR}/src/common" "${CXBXR_ROOT_DIR}/src/common"
"${CXBXR_ROOT_DIR}/src/common/Win32" "${CXBXR_ROOT_DIR}/src/common/Win32"
"${CXBXR_ROOT_DIR}/import/OpenXDK/include" "${CXBXR_ROOT_DIR}/import/OpenXDK/include"
"${CXBXR_ROOT_DIR}/import/DirectX9/include"
"${CXBXR_ROOT_DIR}/import/distorm/include" "${CXBXR_ROOT_DIR}/import/distorm/include"
"${CXBXR_ROOT_DIR}/import/glew-2.0.0/include" "${CXBXR_ROOT_DIR}/import/glew-2.0.0/include"
"${CXBXR_ROOT_DIR}/import/libusb/libusb" "${CXBXR_ROOT_DIR}/import/subhook"
"${CXBXR_ROOT_DIR}/import/DirectX9/include"
"${CXBXR_ROOT_DIR}/import/XbSymbolDatabase"
"${CXBXR_ROOT_DIR}/import/simpleini" "${CXBXR_ROOT_DIR}/import/simpleini"
"${CXBXR_ROOT_DIR}/import/libtommath"
"${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers"
"${CXBXR_ROOT_DIR}/import/winpcap/Include" "${CXBXR_ROOT_DIR}/import/winpcap/Include"
"${CXBXR_ROOT_DIR}/import/xxHash" "${CXBXR_ROOT_DIR}/import/SDL2/include"
) )
link_directories( link_directories(
@ -43,8 +46,8 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
LTC_NO_MISC LTC_NO_MISC
LTC_NO_PROTOTYPES LTC_NO_PROTOTYPES
# Enable Chihiro work # Use inline XXHash version
CHIHIRO_WORK XXH_INLINE_ALL
) )
# Reference: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically # Reference: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically
@ -62,9 +65,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
endif() endif()
add_compile_definitions(NOMINMAX add_compile_definitions(NOMINMAX
# Use inline XXHash version
XXH_INLINE_ALL
) )
file (GLOB RESOURCES file (GLOB RESOURCES
@ -72,27 +72,24 @@ file (GLOB RESOURCES
"${CXBXR_ROOT_DIR}/CONTRIBUTORS" "${CXBXR_ROOT_DIR}/CONTRIBUTORS"
"${CXBXR_ROOT_DIR}/COPYING" "${CXBXR_ROOT_DIR}/COPYING"
"${CXBXR_ROOT_DIR}/README.md" "${CXBXR_ROOT_DIR}/README.md"
"${CXBXR_ROOT_DIR}/src/gui/resource/.editorconfig" "${CXBXR_ROOT_DIR}/resource/.editorconfig"
"${CXBXR_ROOT_DIR}/src/gui/resource/Cxbx.rc" "${CXBXR_ROOT_DIR}/resource/Cxbx.rc"
"${CXBXR_ROOT_DIR}/src/gui/resource/Cxbx-R.ico" "${CXBXR_ROOT_DIR}/resource/Cxbx-R.ico"
"${CXBXR_ROOT_DIR}/src/gui/resource/Logo.bmp" "${CXBXR_ROOT_DIR}/resource/Logo.bmp"
"${CXBXR_ROOT_DIR}/src/gui/resource/Logo-License-CC4.bmp" "${CXBXR_ROOT_DIR}/resource/Logo-License-CC4.bmp"
"${CXBXR_ROOT_DIR}/src/gui/resource/ResCxbx.h"
"${CXBXR_ROOT_DIR}/src/.editorconfig" "${CXBXR_ROOT_DIR}/src/.editorconfig"
) )
source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX header FILES source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX header FILES
${CXBXR_HEADER_GUIv1} ${CXBXR_HEADER_GUIv1}
${CXBXR_HEADER_COMMON} ${CXBXR_HEADER_COMMON}
) ${CXBXR_HEADER_EMU}
source_group(TREE ${CXBXR_ROOT_DIR}/import PREFIX import FILES
${CXBXR_SOURCE_EMU_IMPORT}
) )
source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX source FILES source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX source FILES
${CXBXR_SOURCE_GUIv1} ${CXBXR_SOURCE_GUIv1}
${CXBXR_SOURCE_COMMON} ${CXBXR_SOURCE_COMMON}
${CXBXR_SOURCE_EMU}
) )
source_group(TREE ${CXBXR_ROOT_DIR} FILES ${RESOURCES}) source_group(TREE ${CXBXR_ROOT_DIR} FILES ${RESOURCES})
@ -100,8 +97,10 @@ source_group(TREE ${CXBXR_ROOT_DIR} FILES ${RESOURCES})
add_executable(cxbx WIN32 ${RESOURCES} add_executable(cxbx WIN32 ${RESOURCES}
${CXBXR_HEADER_GUIv1} ${CXBXR_HEADER_GUIv1}
${CXBXR_HEADER_COMMON} ${CXBXR_HEADER_COMMON}
${CXBXR_HEADER_EMU}
${CXBXR_SOURCE_GUIv1} ${CXBXR_SOURCE_GUIv1}
${CXBXR_SOURCE_COMMON} ${CXBXR_SOURCE_COMMON}
${CXBXR_SOURCE_EMU}
${CXBXR_GIT_VERSION_H} ${CXBXR_GIT_VERSION_H}
) )
@ -111,17 +110,25 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Reference: https://docs.microsoft.com/en-us/cpp/build/reference/linker-options # Reference: https://docs.microsoft.com/en-us/cpp/build/reference/linker-options
set_target_properties(cxbx PROPERTIES set_target_properties(cxbx PROPERTIES
LINK_FLAGS " LINK_FLAGS "
/NODEFAULTLIB:libcmt \ /INCREMENTAL:NO
/LARGEADDRESSAWARE
/FIXED
/SAFESEH:NO
/DYNAMICBASE:NO
/BASE:0x10000
/STACK:65536,65536
/NODEFAULTLIB:libcmt
/DELAYLOAD:wpcap.dll
" "
LINK_FLAGS_RELEASE " LINK_FLAGS_RELEASE "
/LTCG \ /LTCG
/DEBUG \ /DEBUG
" "
) )
# Reference: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically # Reference: https://docs.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically
# /Zi = create a PDB file without affecting optimization # /Zi = create a PDB file without affecting optimization
# /Ob3 = Controls inline expansion of functions. # /Ob2 = Controls inline expansion of functions.
# /Oi = Generate intrinsic functions # /Oi = Generate intrinsic functions
# /Ot = In favor of using fast code than small code # /Ot = In favor of using fast code than small code
# /GL = Whole program optimization # /GL = Whole program optimization
@ -130,16 +137,16 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# /Qpar = Enable automatic parallelize loops in the code # /Qpar = Enable automatic parallelize loops in the code
# Set optimization options for release build # Set optimization options for release build
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} \ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}
/Zi \ /Zi
/Ob3 \ /Ob2
/Oi \ /Oi
/Ot \ /Ot
/GL \ /GL
\
/GS- \ /GS-
/Gy \ /Gy
/Qpar \ /Qpar
" "
) )
@ -154,7 +161,6 @@ set(WINS_LIB
legacy_stdio_definitions legacy_stdio_definitions
d3d9 d3d9
d3dcompiler d3dcompiler
delayimp
dinput8 dinput8
dxguid dxguid
odbc32 odbc32
@ -170,36 +176,25 @@ set(WINS_LIB
comctl32 comctl32
XINPUT9_1_0 XINPUT9_1_0
Iphlpapi Iphlpapi
Dwmapi wpcap
) )
target_link_libraries(cxbx target_link_libraries(cxbx
PUBLIC libXbSymbolDatabase PUBLIC XbSymbolDatabase
subhook subhook
libtomcrypt libtomcrypt
SDL2 SDL2
imgui
libusb
mio::mio_min_winapi
${WINS_LIB} ${WINS_LIB}
) )
install(TARGETS ${PROJECT_NAME} if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])")
RUNTIME DESTINATION bin
)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^9]|[9][0-9])" AND BUILD_CXBXR_DEBUGGER)
add_dependencies(cxbx cxbxr-debugger) add_dependencies(cxbx cxbxr-debugger)
endif() endif()
add_dependencies(cxbx cxbxr-ldr cxbxr-emu misc-batch) set(CXBXR_GLEW_DLL "${CXBXR_ROOT_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll")
# Try to stop cmake from building hlsl files # Copy glew32.dll to build type's folder after build.
# Which are all currently loaded at runtime only add_custom_command(TARGET cxbx POST_BUILD
set_source_files_properties( COMMAND ${CMAKE_COMMAND} -E copy ${CXBXR_GLEW_DLL} $<TARGET_FILE_DIR:cxbx>
${CXBXR_HEADER_HLSL}
PROPERTIES
HEADER_FILE_ONLY TRUE
VS_TOOL_OVERRIDE "None"
) )

View File

@ -1,196 +0,0 @@
cmake_minimum_required (VERSION 3.12)
project(cxbxr-emu)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
# Suppress extra stuff from generated solution
set(CMAKE_SUPPRESS_REGENERATION true)
# Force exclude default libraries being included
#set(CMAKE_CXX_STANDARD_LIBRARIES "")
include_directories(
"${CXBXR_ROOT_DIR}/src"
"${CXBXR_ROOT_DIR}/src/common"
"${CXBXR_ROOT_DIR}/src/common/Win32"
"${CXBXR_ROOT_DIR}/import/OpenXDK/include"
"${CXBXR_ROOT_DIR}/import/DirectX9/include"
"${CXBXR_ROOT_DIR}/import/distorm/include"
"${CXBXR_ROOT_DIR}/import/glew-2.0.0/include"
"${CXBXR_ROOT_DIR}/import/libusb/libusb"
"${CXBXR_ROOT_DIR}/import/simpleini"
"${CXBXR_ROOT_DIR}/import/winpcap/Include"
"${CXBXR_ROOT_DIR}/import/xxHash"
)
link_directories(
"${CXBXR_ROOT_DIR}/import/distorm/lib/Win32"
"${CXBXR_ROOT_DIR}/import/glew-2.0.0/lib/Release/Win32"
"${CXBXR_ROOT_DIR}/import/DirectX9/lib"
"${CXBXR_ROOT_DIR}/import/winpcap/Lib"
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS
# Windows 7 minimum requirement
_WIN32_WINNT=0x0601
LTM_DESC
USE_LTM
LTC_NO_TEST
LTC_NO_CIPHERS
LTC_NO_HASHES
LTC_NO_MACS
LTC_NO_PRNGS
LTC_NO_MISC
LTC_NO_PROTOTYPES
# Use inline XXHash version
XXH_INLINE_ALL
# Enable Chihiro work
CHIHIRO_WORK
)
add_compile_options(
/EHs
/MP
/GF
/arch:SSE2
)
endif()
add_compile_definitions(
NOMINMAX
CXBXR_EMU
CXBXR_EMU_EXPORTS
)
file (GLOB RESOURCES
"${CXBXR_ROOT_DIR}/CONTRIBUTORS"
"${CXBXR_ROOT_DIR}/COPYING"
"${CXBXR_ROOT_DIR}/README.md"
)
source_group(TREE ${CXBXR_ROOT_DIR}/import PREFIX import FILES
${CXBXR_HEADER_EMU_IMPORT}
)
source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX header FILES
${CXBXR_HEADER_GUIv1}
${CXBXR_HEADER_COMMON}
${CXBXR_HEADER_EMU}
"${CXBXR_ROOT_DIR}/src/emulator/targetver.h"
)
source_group(TREE ${CXBXR_ROOT_DIR}/import PREFIX import FILES
${CXBXR_SOURCE_EMU_IMPORT}
)
source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX source FILES
${CXBXR_SOURCE_GUIv1}
${CXBXR_SOURCE_COMMON}
${CXBXR_SOURCE_EMU}
"${CXBXR_ROOT_DIR}/src/emulator/cxbxr-emu.cpp"
"${CXBXR_ROOT_DIR}/src/emulator/dllmain.cpp"
)
source_group(TREE ${CXBXR_ROOT_DIR} FILES ${RESOURCES})
add_library(cxbxr-emu SHARED ${RESOURCES}
${CXBXR_HEADER_COMMON}
${CXBXR_HEADER_EMU_IMPORT}
${CXBXR_HEADER_EMU}
"${CXBXR_ROOT_DIR}/src/emulator/targetver.h"
${CXBXR_SOURCE_COMMON}
${CXBXR_SOURCE_EMU_IMPORT}
${CXBXR_SOURCE_EMU}
${CXBXR_GIT_VERSION_H}
"${CXBXR_ROOT_DIR}/src/emulator/cxbxr-emu.cpp"
"${CXBXR_ROOT_DIR}/src/emulator/dllmain.cpp"
)
# Link and compile flags
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_target_properties(cxbxr-emu PROPERTIES
LINK_FLAGS "
/INCREMENTAL:NO \
/LARGEADDRESSAWARE \
/SAFESEH:NO \
/STACK:65536,65536 \
/NODEFAULTLIB:libcmt \
/DELAYLOAD:wpcap.dll \
"
LINK_FLAGS_RELEASE "
/LTCG \
/DEBUG \
"
)
# Set optimization options for release build
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} \
/Zi \
/Ob3 \
/Oi \
/Ot \
/GL \
\
/GS- \
/Gy \
/Qpar \
"
)
endif()
# Windows libraries
set(WINS_LIB
legacy_stdio_definitions
d3d9
d3dcompiler
delayimp
dinput8
dxguid
odbc32
odbccp32
Shlwapi
dxerr9
ws2_32
dsound
winmm
ddraw
d3dx9
dbghelp
comctl32
XINPUT9_1_0
Iphlpapi
wpcap
)
target_link_libraries(cxbxr-emu
PUBLIC libXbSymbolDatabase
subhook
libtomcrypt
SDL2
imgui
libusb
nv2a_vsh_emulator
mio::mio_min_winapi
${WINS_LIB}
)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
add_dependencies(cxbxr-emu cxbxr-ldr misc-batch)
# Try to stop cmake from building hlsl files
# Which are all currently loaded at runtime only
set_source_files_properties(
${CXBXR_HEADER_HLSL}
PROPERTIES
HEADER_FILE_ONLY TRUE
VS_TOOL_OVERRIDE "None"
)

View File

@ -1,75 +0,0 @@
cmake_minimum_required (VERSION 3.12)
project(cxbxr-ldr)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)
# Suppress extra stuff from generated solution
set(CMAKE_SUPPRESS_REGENERATION true)
# Force exclude default libraries being included
set(CMAKE_CXX_STANDARD_LIBRARIES "")
# Force set BasicRunTimeChecks to default
STRING (REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS
)
add_compile_options(
/sdl-
)
endif()
file (GLOB HEADERS
"${CXBXR_ROOT_DIR}/src/common/AddressRanges.h"
"${CXBXR_ROOT_DIR}/src/common/ReserveAddressRanges.h"
"${CXBXR_ROOT_DIR}/src/CxbxVersion.h"
"${CXBXR_ROOT_DIR}/src/version.h"
)
file (GLOB SOURCES
"${CXBXR_ROOT_DIR}/src/common/AddressRanges.cpp"
"${CXBXR_ROOT_DIR}/src/common/ReserveAddressRanges.cpp"
"${CXBXR_ROOT_DIR}/src/CxbxVersion.cpp"
"${CXBXR_ROOT_DIR}/src/loader/cxbxr-ldr.cpp"
)
source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX header FILES ${HEADERS})
source_group(TREE ${CXBXR_ROOT_DIR}/src PREFIX source FILES ${SOURCES})
add_executable(cxbxr-ldr ${HEADERS} ${SOURCES})
# Link and compile flags
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set_target_properties(cxbxr-ldr PROPERTIES
LINK_FLAGS "
/LARGEADDRESSAWARE \
/FIXED \
/DYNAMICBASE:NO \
/BASE:0x10000 \
/STACK:65536,65536 \
/NODEFAULTLIB \
/ENTRY:rawMain \
"
)
# Set optimization options for release build
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} \
/Oi \
"
)
endif()
target_link_libraries(cxbxr-ldr
PUBLIC kernel32.lib
)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)
add_dependencies(cxbxr-ldr misc-batch)

View File

@ -1,42 +0,0 @@
cmake_minimum_required (VERSION 3.12)
project(imgui LANGUAGES CXX)
# Since imgui doesn't have CMake, we'll make an interface project here.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_DEPRECATE
)
endif()
# Add any defines from imconfig.h file in here without need to edit import file directly.
add_compile_definitions(
IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS
IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS
)
file (GLOB HEADERS
"${CXBXR_ROOT_DIR}/import/imgui/imconfig.h"
"${CXBXR_ROOT_DIR}/import/imgui/imgui.h"
"${CXBXR_ROOT_DIR}/import/imgui/imgui_internal.h"
"${CXBXR_ROOT_DIR}/import/imgui/imstb_rectpack.h"
"${CXBXR_ROOT_DIR}/import/imgui/imstb_textedit.h"
"${CXBXR_ROOT_DIR}/import/imgui/imstb_truetype.h"
)
file (GLOB SOURCES
"${CXBXR_ROOT_DIR}/import/imgui/imgui.cpp"
"${CXBXR_ROOT_DIR}/import/imgui/imgui_draw.cpp"
"${CXBXR_ROOT_DIR}/import/imgui/imgui_tables.cpp"
"${CXBXR_ROOT_DIR}/import/imgui/imgui_widgets.cpp"
)
source_group(TREE ${CXBXR_ROOT_DIR}/import/imgui PREFIX header FILES ${HEADERS})
source_group(TREE ${CXBXR_ROOT_DIR}/import/imgui PREFIX source FILES ${SOURCES})
add_library(${PROJECT_NAME} ${HEADERS} ${SOURCES})
target_include_directories(${PROJECT_NAME}
PUBLIC "${CXBXR_ROOT_DIR}/import/imgui"
)

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.12) cmake_minimum_required (VERSION 3.8)
project(libtomcrypt) project(libtomcrypt)
# Suppress extra stuff from generated solution # Suppress extra stuff from generated solution
@ -12,11 +12,17 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
endif() endif()
add_compile_definitions( add_compile_definitions(
LTM_DESC
LTC_SOURCE LTC_SOURCE
LTC_NO_TEST LTC_NO_TEST
LTC_NO_PROTOTYPES LTC_NO_PROTOTYPES
) )
include_directories(
"${CXBXR_ROOT_DIR}/import/libtommath"
"${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers"
)
file (GLOB HEADERS file (GLOB HEADERS
"${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers/tomcrypt.h" "${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers/tomcrypt.h"
"${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers/tomcrypt_argchk.h" "${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers/tomcrypt_argchk.h"
@ -455,12 +461,6 @@ source_group(TREE ${CXBXR_ROOT_DIR}/import/libtomcrypt/src PREFIX source FILES $
add_library(libtomcrypt ${HEADERS} ${SOURCES}) add_library(libtomcrypt ${HEADERS} ${SOURCES})
target_compile_definitions(libtomcrypt PUBLIC LTM_DESC=1)
target_include_directories(libtomcrypt
PUBLIC "${CXBXR_ROOT_DIR}/import/libtomcrypt/src/headers"
)
target_link_libraries(libtomcrypt target_link_libraries(libtomcrypt
PUBLIC libtommath PUBLIC libtommath

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.12) cmake_minimum_required (VERSION 3.8)
project(libtommath) project(libtommath)
# Suppress extra stuff from generated solution # Suppress extra stuff from generated solution
@ -11,6 +11,11 @@ if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
) )
endif() endif()
include_directories(
"${CXBXR_ROOT_DIR}/import/libtommath"
)
file (GLOB HEADERS file (GLOB HEADERS
"${CXBXR_ROOT_DIR}/import/libtommath/tommath.h" "${CXBXR_ROOT_DIR}/import/libtommath/tommath.h"
"${CXBXR_ROOT_DIR}/import/libtommath/tommath_class.h" "${CXBXR_ROOT_DIR}/import/libtommath/tommath_class.h"
@ -165,7 +170,3 @@ source_group(TREE ${CXBXR_ROOT_DIR}/import/libtommath PREFIX header FILES ${HEAD
source_group(TREE ${CXBXR_ROOT_DIR}/import/libtommath PREFIX source FILES ${SOURCES}) source_group(TREE ${CXBXR_ROOT_DIR}/import/libtommath PREFIX source FILES ${SOURCES})
add_library(libtommath ${HEADERS} ${SOURCES}) add_library(libtommath ${HEADERS} ${SOURCES})
target_include_directories(libtommath
PUBLIC "${CXBXR_ROOT_DIR}/import/libtommath"
)

View File

@ -1,51 +0,0 @@
cmake_minimum_required (VERSION 3.12)
project(libusb LANGUAGES CXX)
# Since libusb doesn't have CMake, we'll make an interface project here.
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions(
_CRT_SECURE_NO_WARNINGS
_CRT_NONSTDC_NO_DEPRECATE
)
endif()
include_directories(
"${CXBXR_ROOT_DIR}/import/libusb/msvc"
"${CXBXR_ROOT_DIR}/import/libusb/libusb")
file (GLOB HEADERS
"${CXBXR_ROOT_DIR}/import/libusb/libusb/libusb.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/libusbi.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/version.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/version_nano.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/msvc/config.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/events_windows.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/threads_windows.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/windows_common.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/windows_usbdk.h"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/windows_winusb.h"
)
file (GLOB SOURCES
"${CXBXR_ROOT_DIR}/import/libusb/libusb/core.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/descriptor.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/hotplug.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/io.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/strerror.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/sync.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/events_windows.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/threads_windows.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/windows_common.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/windows_usbdk.c"
"${CXBXR_ROOT_DIR}/import/libusb/libusb/os/windows_winusb.c"
)
source_group(TREE ${CXBXR_ROOT_DIR}/import/libusb/libusb PREFIX header FILES ${HEADERS})
source_group(TREE ${CXBXR_ROOT_DIR}/import/libusb/libusb PREFIX source FILES ${SOURCES})
add_library(${PROJECT_NAME} ${HEADERS} ${SOURCES})
target_include_directories(${PROJECT_NAME}
PUBLIC "${CXBXR_ROOT_DIR}/import/libusb"
)

View File

@ -1,29 +0,0 @@
find_package(Git)
if(Git_FOUND)
message("Git found: ${GIT_EXECUTABLE}")
execute_process(
COMMAND git describe --always --tags --first-parent --dirty
OUTPUT_VARIABLE _GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message("Git version: " ${_GIT_VERSION})
else()
set(_GIT_VERSION "unknown")
endif()
# Appears to update whenever define has changed.
configure_file(
"${CMAKE_SOURCE_DIR}/src/version.h.in" "${CMAKE_SOURCE_DIR}/src/version.h" @ONLY
NEWLINE_STYLE LF
)
message("Runtime Build Directory: ${TargetRunTimeDir}")
# Copy glew32.dll to build type's folder.
set(CXBXR_GLEW_DLL "${CMAKE_SOURCE_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll")
file(COPY ${CXBXR_GLEW_DLL} DESTINATION ${TargetRunTimeDir})

View File

@ -0,0 +1,40 @@
cmake_minimum_required (VERSION 3.8)
project(vsbc)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
# Suppress extra stuff from generated solution
set(CMAKE_SUPPRESS_REGENERATION true)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS
)
endif()
add_compile_definitions(CXBXVSBC_EXPORTS
)
file (GLOB HEADERS
"${CXBXR_ROOT_DIR}/src/vsbc/CxbxVSBC.h"
"${CXBXR_ROOT_DIR}/src/vsbc/DlgVirtualSBCFeedback.h"
"${CXBXR_ROOT_DIR}/src/vsbc/stdafx.h"
"${CXBXR_ROOT_DIR}/src/vsbc/targetver.h"
)
file (GLOB SOURCES
"${CXBXR_ROOT_DIR}/src/vsbc/CxbxVSBC.cpp"
"${CXBXR_ROOT_DIR}/src/vsbc/DlgVirtualSBCFeedback.cpp"
"${CXBXR_ROOT_DIR}/src/vsbc/dllmain.cpp"
"${CXBXR_ROOT_DIR}/src/vsbc/stdafx.cpp"
)
source_group(TREE ${CXBXR_ROOT_DIR}/src/vsbc PREFIX header FILES ${HEADERS})
source_group(TREE ${CXBXR_ROOT_DIR}/src/vsbc PREFIX source FILES ${SOURCES})
add_library(vsbc SHARED ${HEADERS} ${SOURCES})
set_target_properties(vsbc PROPERTIES
OUTPUT_NAME CxbxVSBC
)

View File

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 281 KiB

View File

@ -1,6 +1,6 @@
// Microsoft Visual C++ generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "ResCxbx.h" #include "..\src\gui\ResCxbx.h"
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -27,22 +27,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO GUIDELINES DESIGNINFO
BEGIN BEGIN
IDD_INPUT_CFG, DIALOG IDD_VIRTUAL_SBC_FEEDBACK, DIALOG
BEGIN BEGIN
BOTTOMMARGIN, 188 LEFTMARGIN, 7
END RIGHTMARGIN, 1032
TOPMARGIN, 7
IDD_XID_DUKE_CFG, DIALOG BOTTOMMARGIN, 207
BEGIN
END
IDD_LIGHTGUN_CFG, DIALOG
BEGIN
END
IDD_SBC_CFG, DIALOG
BEGIN
BOTTOMMARGIN, 269
END END
IDD_VIDEO_CFG, DIALOG IDD_VIDEO_CFG, DIALOG
@ -71,7 +61,7 @@ BEGIN
VERTGUIDE, 178 VERTGUIDE, 178
VERTGUIDE, 234 VERTGUIDE, 234
VERTGUIDE, 246 VERTGUIDE, 246
BOTTOMMARGIN, 360 BOTTOMMARGIN, 347
HORZGUIDE, 54 HORZGUIDE, 54
HORZGUIDE, 69 HORZGUIDE, 69
HORZGUIDE, 84 HORZGUIDE, 84
@ -83,8 +73,6 @@ BEGIN
HORZGUIDE, 168 HORZGUIDE, 168
HORZGUIDE, 182 HORZGUIDE, 182
HORZGUIDE, 195 HORZGUIDE, 195
HORZGUIDE, 205
HORZGUIDE, 216
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@ -95,45 +83,38 @@ END
// Dialog // Dialog
// //
IDD_INPUT_CFG DIALOGEX 0, 0, 265, 192 IDD_INPUT_CFG DIALOGEX 0, 0, 243, 124
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx-Reloaded : Input Configuration" CAPTION "Cxbx-Reloaded : Input Configuration"
FONT 8, "Verdana", 0, 0, 0x1 FONT 8, "Verdana", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "Xbox device configuration",IDC_DEVICE,13,10,240,103,WS_GROUP,WS_EX_CLIENTEDGE GROUPBOX "Xbox device configuration",IDC_XID_CONFIG,13,10,217,103,WS_GROUP,WS_EX_CLIENTEDGE
COMBOBOX IDC_DEVICE_PORT1,50,25,134,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE_PORT1,50,25,110,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_DEVICE_PORT2,50,46,134,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE_PORT2,50,46,110,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_DEVICE_PORT3,50,67,134,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE_PORT3,50,67,110,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_DEVICE_PORT4,50,88,134,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE_PORT4,50,88,110,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Configure",IDC_CONFIGURE_PORT1,192,25,50,14,BS_FLAT PUSHBUTTON "Configure",IDC_CONFIGURE_PORT1,166,25,50,14,BS_FLAT
PUSHBUTTON "Configure",IDC_CONFIGURE_PORT2,192,46,50,14,BS_FLAT PUSHBUTTON "Configure",IDC_CONFIGURE_PORT2,166,46,50,14,BS_FLAT
PUSHBUTTON "Configure",IDC_CONFIGURE_PORT3,192,67,50,14,BS_FLAT PUSHBUTTON "Configure",IDC_CONFIGURE_PORT3,166,67,50,14,BS_FLAT
PUSHBUTTON "Configure",IDC_CONFIGURE_PORT4,192,88,50,14,BS_FLAT PUSHBUTTON "Configure",IDC_CONFIGURE_PORT4,166,88,50,14,BS_FLAT
LTEXT "Port 1",IDC_STATIC,23,27,20,10 LTEXT "Port 1",IDC_STATIC,23,27,20,10
LTEXT "Port 2",IDC_STATIC,23,48,20,10 LTEXT "Port 2",IDC_STATIC,23,48,20,10
LTEXT "Port 3",IDC_STATIC,23,69,20,10 LTEXT "Port 3",IDC_STATIC,23,69,20,10
LTEXT "Port 4",IDC_STATIC,23,90,20,10 LTEXT "Port 4",IDC_STATIC,23,90,20,10
GROUPBOX "Options",IDC_INPUT_OPTIONS,13,119,240,64,WS_GROUP,WS_EX_CLIENTEDGE
EDITTEXT IDC_MOUSE_RANGE,95,129,121,14
EDITTEXT IDC_WHEEL_RANGE,95,147,121,14
LTEXT "Mouse axis range",IDC_STATIC,23,129,69,14,SS_CENTERIMAGE
LTEXT "Mouse wheel range",IDC_STATIC,23,146,68,14,SS_CENTERIMAGE
CONTROL "Ignore Keyboard/Mouse when unfocus",IDC_IGNORE_KBMO_UNFOCUS,
"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,23,166,139,10
END END
IDD_XID_DUKE_CFG DIALOGEX 0, 0, 528, 300 IDD_XID_DUKE_CFG DIALOGEX 0, 0, 528, 280
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "Verdana", 0, 0, 0x1 FONT 8, "Verdana", 0, 0, 0x1
BEGIN BEGIN
GROUPBOX "Device",IDC_DEVICE,12,10,175,35,WS_GROUP GROUPBOX "Device",IDC_XID_CONFIG,12,10,175,35,WS_GROUP
COMBOBOX IDC_DEVICE_LIST,21,23,101,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DEVICE_LIST,21,23,101,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Refresh",IDC_REFRESH_DEVICES,128,23,50,14,BS_FLAT PUSHBUTTON "Refresh",IDC_REFRESH_DEVICES,128,23,50,14,BS_FLAT
GROUPBOX "Profile",IDC_PROFILE,197,10,320,35,WS_GROUP GROUPBOX "Profile",IDC_XID_PROFILE,197,10,320,35,WS_GROUP
COMBOBOX IDC_PROFILE_NAME,207,24,194,10,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_XID_PROFILE_NAME,207,24,194,10,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Save",IDC_PROFILE_SAVE,405,23,50,14,BS_FLAT PUSHBUTTON "Save",IDC_XID_PROFILE_SAVE,405,23,50,14,BS_FLAT
PUSHBUTTON "Delete",IDC_PROFILE_DELETE,459,23,50,14,BS_FLAT PUSHBUTTON "Delete",IDC_XID_PROFILE_DELETE,459,23,50,14,BS_FLAT
GROUPBOX "Buttons",IDC_BUTTONS,12,65,121,181,WS_GROUP GROUPBOX "Buttons",IDC_XID_BUTTONS,12,65,121,181,WS_GROUP
PUSHBUTTON "",IDC_SET_A,59,75,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_A,59,75,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_B,59,93,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_B,59,93,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_X,59,111,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_X,59,111,57,14,BS_FLAT
@ -150,7 +131,7 @@ BEGIN
LTEXT "White",IDC_STATIC,28,165,20,14,SS_CENTERIMAGE LTEXT "White",IDC_STATIC,28,165,20,14,SS_CENTERIMAGE
LTEXT "Back",IDC_STATIC,28,183,20,14,SS_CENTERIMAGE LTEXT "Back",IDC_STATIC,28,183,20,14,SS_CENTERIMAGE
LTEXT "Start",IDC_STATIC,28,201,20,14,SS_CENTERIMAGE LTEXT "Start",IDC_STATIC,28,201,20,14,SS_CENTERIMAGE
GROUPBOX "L Stick",IDC_LSTICK,140,65,121,181,WS_GROUP GROUPBOX "L Stick",IDC_XID_LSTICK,140,65,121,181,WS_GROUP
PUSHBUTTON "",IDC_SET_LEFT_POSY,187,75,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_LEFT_POSY,187,75,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_LEFT_NEGY,187,93,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_LEFT_NEGY,187,93,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_LEFT_NEGX,187,111,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_LEFT_NEGX,187,111,57,14,BS_FLAT
@ -160,8 +141,8 @@ BEGIN
LTEXT "Down",IDC_STATIC,156,93,20,14,SS_CENTERIMAGE LTEXT "Down",IDC_STATIC,156,93,20,14,SS_CENTERIMAGE
LTEXT "Left",IDC_STATIC,156,111,20,14,SS_CENTERIMAGE LTEXT "Left",IDC_STATIC,156,111,20,14,SS_CENTERIMAGE
LTEXT "Right",IDC_STATIC,156,129,20,14,SS_CENTERIMAGE LTEXT "Right",IDC_STATIC,156,129,20,14,SS_CENTERIMAGE
LTEXT "Click",IDC_STATIC,156,147,27,14,SS_CENTERIMAGE LTEXT "L Click",IDC_STATIC,156,147,27,14,SS_CENTERIMAGE
GROUPBOX "R Stick",IDC_RSTICK,268,65,121,181,WS_GROUP GROUPBOX "R Stick",IDC_XID_RSTICK,268,65,121,181,WS_GROUP
PUSHBUTTON "",IDC_SET_RIGHT_POSY,315,75,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_RIGHT_POSY,315,75,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_RIGHT_NEGY,315,93,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_RIGHT_NEGY,315,93,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_RIGHT_NEGX,315,111,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_RIGHT_NEGX,315,111,57,14,BS_FLAT
@ -171,8 +152,8 @@ BEGIN
LTEXT "Down",IDC_STATIC,284,93,20,14,SS_CENTERIMAGE LTEXT "Down",IDC_STATIC,284,93,20,14,SS_CENTERIMAGE
LTEXT "Left",IDC_STATIC,284,111,20,14,SS_CENTERIMAGE LTEXT "Left",IDC_STATIC,284,111,20,14,SS_CENTERIMAGE
LTEXT "Right",IDC_STATIC,284,129,20,14,SS_CENTERIMAGE LTEXT "Right",IDC_STATIC,284,129,20,14,SS_CENTERIMAGE
LTEXT "Click",IDC_STATIC,284,147,27,14,SS_CENTERIMAGE LTEXT "R Click",IDC_STATIC,284,147,27,14,SS_CENTERIMAGE
GROUPBOX "D Pad",IDC_DPAD,396,65,121,88,WS_GROUP GROUPBOX "D Pad",IDC_XID_DPAD,396,65,121,88,WS_GROUP
PUSHBUTTON "",IDC_SET_DPAD_UP,443,75,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_DPAD_UP,443,75,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_DPAD_DOWN,443,93,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_DPAD_DOWN,443,93,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_DPAD_LEFT,443,111,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_DPAD_LEFT,443,111,57,14,BS_FLAT
@ -181,20 +162,16 @@ BEGIN
LTEXT "Down",IDC_STATIC,412,93,20,14,SS_CENTERIMAGE LTEXT "Down",IDC_STATIC,412,93,20,14,SS_CENTERIMAGE
LTEXT "Left",IDC_STATIC,412,111,20,14,SS_CENTERIMAGE LTEXT "Left",IDC_STATIC,412,111,20,14,SS_CENTERIMAGE
LTEXT "Right",IDC_STATIC,412,129,20,14,SS_CENTERIMAGE LTEXT "Right",IDC_STATIC,412,129,20,14,SS_CENTERIMAGE
GROUPBOX "Triggers",IDC_TRIGGERS,396,157,121,52,WS_GROUP GROUPBOX "Triggers",IDC_XID_TRIGGERS,396,157,121,52,WS_GROUP
PUSHBUTTON "",IDC_SET_LTRIGGER,443,168,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_LTRIGGER,443,168,57,14,BS_FLAT
PUSHBUTTON "",IDC_SET_RTRIGGER,443,187,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_RTRIGGER,443,187,57,14,BS_FLAT
LTEXT "Left",IDC_STATIC,412,168,20,14,SS_CENTERIMAGE LTEXT "Left",IDC_STATIC,412,168,20,14,SS_CENTERIMAGE
LTEXT "Right",IDC_STATIC,412,187,20,14,SS_CENTERIMAGE LTEXT "Right",IDC_STATIC,412,187,20,14,SS_CENTERIMAGE
GROUPBOX "Rumble",IDC_RUMBLE,396,212,121,34,WS_GROUP GROUPBOX "Rumble",IDC_XID_RUMBLE,396,212,121,34,WS_GROUP
PUSHBUTTON "",IDC_SET_MOTOR,443,224,57,14,BS_FLAT PUSHBUTTON "",IDC_SET_MOTOR,443,224,57,14,BS_FLAT
LTEXT "Motor",IDC_STATIC,412,224,26,14,SS_CENTERIMAGE LTEXT "Motor",IDC_STATIC,412,224,26,14,SS_CENTERIMAGE
PUSHBUTTON "Default Bindings",IDC_DEFAULT,362,265,69,14,BS_FLAT PUSHBUTTON "Default Bindings",IDC_XID_DEFAULT,362,256,69,14,BS_FLAT
PUSHBUTTON "Clear",IDC_CLEAR,443,265,50,14,BS_FLAT PUSHBUTTON "Clear",IDC_XID_CLEAR,443,256,50,14,BS_FLAT
GROUPBOX "Top Slot",IDC_DEVICE_TOP_SLOT,12,254,97,35,WS_GROUP
COMBOBOX IDC_DEVICE_LIST_TOP_SLOT,21,267,79,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Bottom Slot",IDC_DEVICE_BOTTOM_SLOT,117,254,97,35,WS_GROUP
COMBOBOX IDC_DEVICE_LIST_BOTTOM_SLOT,126,267,79,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END END
IDD_RUMBLE_CFG DIALOGEX 0, 0, 155, 35 IDD_RUMBLE_CFG DIALOGEX 0, 0, 155, 35
@ -206,197 +183,121 @@ BEGIN
PUSHBUTTON "Test",IDC_RUMBLE_TEST,95,11,45,14,BS_FLAT PUSHBUTTON "Test",IDC_RUMBLE_TEST,95,11,45,14,BS_FLAT
END END
IDD_LIGHTGUN_CFG DIALOGEX 0, 0, 529, 225 IDD_VIRTUAL_SBC_FEEDBACK DIALOGEX 0, 0, 1039, 214
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "Verdana", 0, 0, 0x1 CAPTION "Virtual SteelBattalion Controller"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
GROUPBOX "Device",IDC_DEVICE,12,10,175,35,WS_GROUP GROUPBOX "Left Block",IDC_LEFTBLOCK,7,7,329,200,0,WS_EX_CLIENTEDGE | WS_EX_RIGHT
COMBOBOX IDC_DEVICE_LIST,21,23,101,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Left Block",IDC_LEFTBLOCK2,7,7,329,200,0,WS_EX_RIGHT
PUSHBUTTON "Refresh",IDC_REFRESH_DEVICES,128,23,50,14,BS_FLAT GROUPBOX "Right Block",IDC_RIGHTBLOCK,703,7,329,200,0,WS_EX_CLIENTEDGE
GROUPBOX "Profile",IDC_PROFILE,197,10,320,35,WS_GROUP GROUPBOX "Gear Lever",IDC_GEAR_LEVER,24,25,92,174,WS_GROUP,WS_EX_CLIENTEDGE
COMBOBOX IDC_PROFILE_NAME,207,24,194,10,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP GROUPBOX "Toggle Switches",IDC_STATIC,131,102,191,95,0,WS_EX_CLIENTEDGE
PUSHBUTTON "Save",IDC_PROFILE_SAVE,405,23,50,14,BS_FLAT CONTROL "N",IDC_GEAR_0,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,37,131,21,10
PUSHBUTTON "Delete",IDC_PROFILE_DELETE,459,23,50,14,BS_FLAT CONTROL "1",IDC_GEAR_1,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,38,113,20,10
GROUPBOX "Buttons",IDC_BUTTONS,12,65,121,121,WS_GROUP CONTROL "2",IDC_GEAR_2,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,38,95,20,10
PUSHBUTTON "",IDC_LG_A,59,110,57,14,BS_FLAT CONTROL "3",IDC_GEAR_3,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,38,77,20,10
PUSHBUTTON "",IDC_LG_B,59,127,57,14,BS_FLAT CONTROL "4",IDC_GEAR_4,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,38,59,20,10
PUSHBUTTON "",IDC_LG_TRIGGER,59,76,57,14,BS_FLAT CONTROL "5",IDC_GEAR_5,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,38,41,20,10
PUSHBUTTON "",IDC_LG_GRIP,59,93,57,14,BS_FLAT CONTROL "R",IDC_GEAR_R,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,37,149,21,10
PUSHBUTTON "",IDC_LG_SEBA,59,144,57,14,BS_FLAT CONTROL "",IDC_ROTATION_LEVER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,129,38,188,15
PUSHBUTTON "",IDC_LG_START,59,161,57,14,BS_FLAT CTEXT "Rotation Lever",IDC_TXT_ROTATION_LEVER,199,27,48,8
LTEXT "A",IDC_STATIC,28,110,20,14,SS_CENTERIMAGE CONTROL "VT-LOCATION MEASUREMENT",IDC_VT_LOCATION_MEASUREMENT,
LTEXT "B",IDC_STATIC,28,127,20,14,SS_CENTERIMAGE "Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,120,113,10
LTEXT "Trigger",IDC_STATIC,28,76,27,14,SS_CENTERIMAGE CONTROL "BUFFER MATERIAL",IDC_BUFFER_MATERIAL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,150,77,10
LTEXT "Grip",IDC_STATIC,28,93,20,14,SS_CENTERIMAGE CONTROL "FUEL FLOW RATE",IDC_FUEL_FLOW_RATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,208,180,73,10
LTEXT "SE/BA",IDC_STATIC,28,144,25,14,SS_CENTERIMAGE CONTROL "OXYGEN SUPPLY SYSTEM",IDC_OXYGEN_SUPPLY_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,135,96,10
LTEXT "START",IDC_STATIC,28,161,27,14,SS_CENTERIMAGE CONTROL "FILT CONTROL SYSTEM",IDC_FILT_CONTROL_SYSTEM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,165,91,10
GROUPBOX "Aim",IDC_LSTICK,140,65,121,121,WS_GROUP PUSHBUTTON "Eject",IDC_BTN_EJECT,958,42,60,11
PUSHBUTTON "",IDC_LG_AIM_POSY,187,75,57,14,BS_FLAT PUSHBUTTON "COCKPIT HATCH",IDC_BTN_COCKPIT_HATCH,958,93,60,12,BS_BOTTOM
PUSHBUTTON "",IDC_LG_AIM_NEGY,187,93,57,14,BS_FLAT PUSHBUTTON "IGNITION",IDC_BTN_IGNITION,958,144,60,11,BS_BOTTOM
PUSHBUTTON "",IDC_LG_AIM_NEGX,187,111,57,14,BS_FLAT PUSHBUTTON "START",IDC_BTN_START,958,192,60,10,BS_BOTTOM
PUSHBUTTON "",IDC_LG_AIM_POSX,187,129,57,14,BS_FLAT CONTROL "",IDC_PB_EJECT,"msctls_progress32",WS_BORDER,958,15,60,26
LTEXT "Up",IDC_STATIC,156,75,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_COCKPIT_HATCH,"msctls_progress32",WS_BORDER,958,67,60,26
LTEXT "Down",IDC_STATIC,156,93,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_IGNITION,"msctls_progress32",WS_BORDER,958,117,60,26
LTEXT "Left",IDC_STATIC,156,111,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_START,"msctls_progress32",WS_BORDER,958,165,60,26
LTEXT "Right",IDC_STATIC,156,129,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_GEARLEVER_5,"msctls_progress32",WS_BORDER,62,41,29,10
GROUPBOX "Stick",IDC_DPAD,268,65,121,121,WS_GROUP CONTROL "",IDC_PB_GEARLEVER_1,"msctls_progress32",WS_BORDER,62,113,29,10
PUSHBUTTON "",IDC_LG_STICK_UP,315,75,57,14,BS_FLAT CONTROL "",IDC_PB_GEARLEVER_2,"msctls_progress32",WS_BORDER,62,95,29,10
PUSHBUTTON "",IDC_LG_STICK_DOWN,315,93,57,14,BS_FLAT CONTROL "",IDC_PB_GEARLEVER_3,"msctls_progress32",WS_BORDER,62,77,29,10
PUSHBUTTON "",IDC_LG_STICK_LEFT,315,111,57,14,BS_FLAT CONTROL "",IDC_PB_GEARLEVER_4,"msctls_progress32",WS_BORDER,62,59,29,10
PUSHBUTTON "",IDC_LG_STICK_RIGHT,315,129,57,14,BS_FLAT CONTROL "",IDC_PB_GEARLEVER_N,"msctls_progress32",WS_BORDER,62,131,29,10
LTEXT "Up",IDC_STATIC,285,75,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_GEARLEVER_R,"msctls_progress32",WS_BORDER,62,149,29,10
LTEXT "Down",IDC_STATIC,285,93,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_COM5,"msctls_progress32",WS_BORDER,455,12,14,27
LTEXT "Left",IDC_STATIC,285,111,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_COM1,"msctls_progress32",WS_BORDER,343,12,14,27
LTEXT "Right",IDC_STATIC,285,129,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_COM2,"msctls_progress32",WS_BORDER,371,12,14,27
PUSHBUTTON "Default Bindings",IDC_DEFAULT,362,200,69,14,BS_FLAT CONTROL "",IDC_PB_COM3,"msctls_progress32",WS_BORDER,399,12,14,27
PUSHBUTTON "Clear",IDC_CLEAR,443,200,50,14,BS_FLAT CONTROL "",IDC_PB_COM4,"msctls_progress32",WS_BORDER,427,12,14,27
GROUPBOX "Turbo switch",IDC_POWER_SWITCH,396,66,121,52,WS_GROUP CONTROL "",IDC_PB_WASHING,"msctls_progress32",WS_BORDER,359,151,86,13
PUSHBUTTON "",IDC_TURBO_LEFT,443,76,57,14,BS_FLAT CONTROL "",IDC_PB_MAIN_WEAPON_CONTROL,"msctls_progress32",WS_BORDER,359,179,86,13
PUSHBUTTON "",IDC_TURBO_RIGHT,443,94,57,14,BS_FLAT CONTROL "",IDC_PB_EXTINGUISHER,"msctls_progress32",WS_BORDER,481,151,86,13
LTEXT "Left",IDC_STATIC,412,76,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_SUB_WEAPON_CONTROL,"msctls_progress32",WS_BORDER,481,179,86,13
LTEXT "Right",IDC_STATIC,412,94,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_CHAFF,"msctls_progress32",WS_BORDER,603,151,86,13
GROUPBOX "Power switch",IDC_TURBO,396,121,121,66,WS_GROUP CONTROL "",IDC_PB_MAGAZINE_CHANGE,"msctls_progress32",WS_BORDER,603,179,86,13
PUSHBUTTON "",IDC_LASER,443,132,57,14,BS_FLAT CONTROL "",IDC_PB_FUNC1,"msctls_progress32",WS_BORDER,507,20,14,27
LTEXT "Laser",IDC_STATIC,412,132,20,14,SS_CENTERIMAGE CONTROL "",IDC_PB_FUNC2,"msctls_progress32",WS_BORDER,507,64,14,27
END CONTROL "",IDC_PB_FUNC3,"msctls_progress32",WS_BORDER,507,106,14,27
CONTROL "",IDC_PB_TANK_DETACH,"msctls_progress32",WS_BORDER,583,20,14,27
IDD_LIBUSB_CFG DIALOGEX 0, 0, 250, 35 CONTROL "",IDC_PB_OVERRIDE,"msctls_progress32",WS_BORDER,583,64,14,27
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CONTROL "",IDC_PB_NIGHT_SCOPE,"msctls_progress32",WS_BORDER,583,106,14,27
FONT 8, "Verdana", 0, 0, 0x1 CONTROL "",IDC_PB_FSS,"msctls_progress32",WS_BORDER,658,20,14,27
BEGIN CONTROL "",IDC_PB_MANIPULATOR,"msctls_progress32",WS_BORDER,658,64,14,27
COMBOBOX IDC_LIBUSB_LIST,15,11,120,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_PB_LINE_COLOR_CHANGE,"msctls_progress32",WS_BORDER,658,106,14,27
PUSHBUTTON "Refresh",IDC_REFRESH_DEVICES,140,11,45,14,BS_FLAT CONTROL "",IDC_PB_OPEN_CLOSE,"msctls_progress32",WS_BORDER,788,98,56,13
PUSHBUTTON "Test",IDC_LIBUSB_TEST,190,11,45,14,BS_FLAT CONTROL "",IDC_PB_MAP_ZOOM_IN_OUT,"msctls_progress32",WS_BORDER,861,98,56,13
END CONTROL "",IDC_PB_ZOOM_IN,"msctls_progress32",WS_BORDER,788,154,56,13
CONTROL "",IDC_PB_ZOOM_OUT,"msctls_progress32",WS_BORDER,861,154,56,13
IDD_SBC_CFG DIALOGEX 0, 0, 854, 280 CONTROL "",IDC_PB_MODE_SELECT,"msctls_progress32",WS_BORDER,788,135,56,13
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CONTROL "",IDC_PB_SUB_MONITOR_MODE_SELECT,"msctls_progress32",WS_BORDER,861,135,56,13
FONT 8, "Verdana", 0, 0, 0x1 PUSHBUTTON "ZOOM IN",IDC_BTN_ZOOM_IN,788,167,56,21
BEGIN PUSHBUTTON "ZOOM OUT",IDC_BTN_ZOOM_OUT,861,167,56,21
GROUPBOX "Device",IDC_DEVICE,12,10,175,35,WS_GROUP PUSHBUTTON "MODE SELECT",IDC_BTN_MODE_SELECT,788,114,56,21
COMBOBOX IDC_DEVICE_LIST,21,23,101,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "SUB MONITOR MODE SELECT",IDC_BTN_SUB_MONITOR_MODE_SELECT,861,113,56,21,BS_MULTILINE
PUSHBUTTON "Refresh",IDC_REFRESH_DEVICES,128,23,50,14,BS_FLAT PUSHBUTTON "OPEN/CLOSE",IDC_BTN_OPEN_CLOSE,788,77,56,21
GROUPBOX "Profile",IDC_PROFILE,196,10,320,35,WS_GROUP PUSHBUTTON "MAP ZOOM IN/OUT",IDC_BTN_MAP_ZOON_IN_OUT,860,77,56,21,BS_MULTILINE
COMBOBOX IDC_PROFILE_NAME,206,23,194,10,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "MULTI MONITOR",IDC_STATIC,716,99,55,8
PUSHBUTTON "Save",IDC_PROFILE_SAVE,404,23,50,14,BS_FLAT LTEXT "MAIN MONITOR ZOOM",IDC_STATIC,718,163,61,8
PUSHBUTTON "Delete",IDC_PROFILE_DELETE,458,23,50,14,BS_FLAT GROUPBOX "",IDC_STATIC,949,59,83,148,0,WS_EX_CLIENTEDGE
PUSHBUTTON "Clear",IDC_CLEAR,774,23,50,14,BS_FLAT PUSHBUTTON "MAIN WAPON CONTROL",IDC_BTN_MAIN_WEAPON_CONTROL,359,193,86,13
GROUPBOX "Left Block",IDC_LEFTBLOCK,12,50,281,167 PUSHBUTTON "SUB WAPON CTONTROL",IDC_BTN_SUB_WEAPON_CONTROL,481,192,86,13
GROUPBOX "Center Block",IDC_CENTERBLOCK,299,50,281,218 PUSHBUTTON "EXTINGUISHER",IDC_BTN_EXTINGUISHER,481,162,86,13
GROUPBOX "Right Block",IDC_RIGHTBLOCK,586,50,255,218 PUSHBUTTON "MAGAZINE CHANGE",IDC_BTN_MAGAZINE_CHANGE,603,192,86,13
PUSHBUTTON "",IDC_GEAR_UP,67,64,57,14,BS_FLAT PUSHBUTTON "CHAFF",IDC_BTN_CHAFF,603,162,86,13
LTEXT "Gear Up",IDC_STATIC,25,64,38,14,SS_CENTERIMAGE PUSHBUTTON "WASHING",IDC_BTN_WASHING,359,163,86,13
PUSHBUTTON "",IDC_GEAR_DOWN,67,82,57,14,BS_FLAT PUSHBUTTON "COM1",IDC_BTN_COM1,338,42,24,13
LTEXT "Gear Down",IDC_STATIC,25,82,38,14,SS_CENTERIMAGE PUSHBUTTON "COM2",IDC_BTN_COM2,366,42,24,13
PUSHBUTTON "",IDC_VT_LOCATION_MEASUREMENT,223,64,57,14,BS_FLAT PUSHBUTTON "COM3",IDC_BTN_COM3,394,42,24,13
LTEXT "VT-Location Measurement",IDC_STATIC,133,64,90,14,SS_CENTERIMAGE PUSHBUTTON "COM4",IDC_BTN_COM4,422,42,24,13
PUSHBUTTON "",IDC_BUFFER_MATERIAL,223,82,57,14,BS_FLAT PUSHBUTTON "COM5",IDC_BTN_COM5,450,42,24,13
LTEXT "Buffer Material",IDC_STATIC,133,82,80,14,SS_CENTERIMAGE PUSHBUTTON "FUNC1",IDC_BTN_FUNC1,476,7,76,13
PUSHBUTTON "",IDC_FUEL_FLOW_RATE,223,100,57,14,BS_FLAT PUSHBUTTON "FUNC2",IDC_BTN_FUNC2,476,51,76,13
LTEXT "Fuel Flow Rate",IDC_STATIC,133,100,80,14,SS_CENTERIMAGE PUSHBUTTON "FUNC2",IDC_BTN_FUNC3,476,93,76,13
PUSHBUTTON "",IDC_OXYGEN_SUPPLY_SYSTEM,223,118,57,14,BS_FLAT PUSHBUTTON "TANK DETACH",IDC_BTN_TANK_DETACH,552,7,76,13
LTEXT "Oxygen Supply System",IDC_STATIC,133,118,80,14,SS_CENTERIMAGE PUSHBUTTON "F.S.S.",IDC_BTN_FSS,627,7,76,13
PUSHBUTTON "",IDC_FILT_CONTROL_SYSTEM,223,136,57,14,BS_FLAT PUSHBUTTON "OVERRIDE",IDC_BTN_OVERRIDE,552,51,76,13
LTEXT "Filt Control System",IDC_STATIC,133,136,80,14,SS_CENTERIMAGE PUSHBUTTON "NIGHT SCOPE",IDC_BTN_NIGHT_SCOPE,552,93,76,13
PUSHBUTTON "",IDC_BTN_SIGHT_CHANGE,223,154,57,14,BS_FLAT PUSHBUTTON "MANIPULATOR",IDC_BTN_MANIPULATOR,627,51,76,13
LTEXT "Sight Change",IDC_STATIC,133,154,80,14,SS_CENTERIMAGE PUSHBUTTON "LINE COLOR CHANGE",IDC_BTN_LINE_COLOR_CHANGE,627,93,76,13
PUSHBUTTON "",IDC_LEVER_LEFT,67,172,57,14,BS_FLAT LTEXT "TUNER DIAL",IDC_STATIC,389,105,40,8
LTEXT "Lever Left",IDC_STATIC,25,172,42,14,SS_CENTERIMAGE GROUPBOX "Tuner Dial",IDC_STATIC,344,58,129,90,WS_GROUP,WS_EX_CLIENTEDGE
PUSHBUTTON "",IDC_LEVER_RIGHT,67,191,57,14,BS_FLAT CONTROL "0",IDC_RADIO_TD0,"Button",BS_AUTORADIOBUTTON,360,100,20,10
LTEXT "Lever Right",IDC_STATIC,25,191,42,14,SS_CENTERIMAGE CONTROL "1",IDC_RADIO_TD1,"Button",BS_AUTORADIOBUTTON,369,91,20,10
PUSHBUTTON "",IDC_SIGHT_CHANGE_POSY,67,100,57,14,BS_FLAT CONTROL "2",IDC_RADIO_TD2,"Button",BS_AUTORADIOBUTTON,380,82,20,10
LTEXT "Sight Up",IDC_STATIC,25,100,37,14,SS_CENTERIMAGE CONTROL "3",IDC_RADIO_TD3,"Button",BS_AUTORADIOBUTTON,390,73,20,10
PUSHBUTTON "",IDC_SIGHT_CHANGE_NEGY,67,118,57,14,BS_FLAT CONTROL "4",IDC_RADIO_TD4,"Button",BS_AUTORADIOBUTTON,403,64,20,10
LTEXT "Sight Down",IDC_STATIC,25,118,40,14,SS_CENTERIMAGE CONTROL "5",IDC_RADIO_TD5,"Button",BS_AUTORADIOBUTTON,419,73,20,10
PUSHBUTTON "",IDC_SIGHT_CHANGE_NEGX,67,136,57,14,BS_FLAT CONTROL "6",IDC_RADIO_TD6,"Button",BS_AUTORADIOBUTTON,430,82,20,10
LTEXT "Sight Left",IDC_STATIC,25,136,38,14,SS_CENTERIMAGE CONTROL "7",IDC_RADIO_TD7,"Button",BS_AUTORADIOBUTTON,439,91,20,10
PUSHBUTTON "",IDC_SIGHT_CHANGE_POSX,67,154,57,14,BS_FLAT CONTROL "8",IDC_RADIO_TD8,"Button",BS_AUTORADIOBUTTON,447,100,20,10
LTEXT "Sight Right",IDC_STATIC,25,154,39,14,SS_CENTERIMAGE CONTROL "9",IDC_RADIO_TD9,"Button",BS_AUTORADIOBUTTON,439,109,20,10
PUSHBUTTON "",IDC_BTN_COM1,375,64,57,14,BS_FLAT CONTROL "10",IDC_RADIO_TD10,"Button",BS_AUTORADIOBUTTON,431,118,24,10
PUSHBUTTON "",IDC_BTN_COM2,375,82,57,14,BS_FLAT CONTROL "11",IDC_RADIO_TD11,"Button",BS_AUTORADIOBUTTON,417,127,24,10
PUSHBUTTON "",IDC_BTN_COM3,375,100,57,14,BS_FLAT CONTROL "12",IDC_RADIO_TD12,"Button",BS_AUTORADIOBUTTON,405,136,24,10
PUSHBUTTON "",IDC_BTN_COM4,375,118,57,14,BS_FLAT CONTROL "",IDC_PB_VT_LOCATION_MEASUREMENT,"msctls_progress32",WS_BORDER,188,120,14,10
PUSHBUTTON "",IDC_BTN_COM5,375,136,57,14,BS_FLAT CONTROL "",IDC_PB_OXYGEN_SUPPLY_SYSTEM,"msctls_progress32",WS_BORDER,169,135,14,10
LTEXT "Extinguisher",IDC_STATIC,444,136,65,14,SS_CENTERIMAGE CONTROL "",IDC_PB_BUFFER_MATERIAL,"msctls_progress32",WS_BORDER,188,150,14,10
PUSHBUTTON "",IDC_BTN_MAIN_WEAPON_CONTROL,511,172,57,14,BS_FLAT CONTROL "",IDC_PB_VT_LOCATION_MEASUREMENT4,"msctls_progress32",WS_BORDER,188,180,14,10
LTEXT "Main Weapon",IDC_STATIC,444,172,65,14,SS_CENTERIMAGE CONTROL "",IDC_PB_FILT_CONTROL_SYSTEM,"msctls_progress32",WS_BORDER,169,165,14,10
PUSHBUTTON "",IDC_BTN_SUB_WEAPON_CONTROL,511,190,57,14,BS_FLAT
LTEXT "Magazine Change",IDC_STATIC,444,208,60,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_MAGAZINE_CHANGE,511,208,57,14,BS_FLAT
LTEXT "Washing",IDC_STATIC,444,118,65,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_WASHING,511,118,57,14,BS_FLAT
LTEXT "Chaff",IDC_STATIC,444,154,65,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_EXTINGUISHER,511,136,57,14,BS_FLAT
LTEXT "Sub Weapon",IDC_STATIC,444,190,40,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_CHAFF,511,154,57,14,BS_FLAT
LTEXT "Function 3",IDC_STATIC,311,191,44,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_FUNC3,375,190,57,14,BS_FLAT
LTEXT "Night Scope",IDC_STATIC,311,244,51,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_NIGHT_SCOPE,375,244,57,14,BS_FLAT
LTEXT "Line Color Change",IDC_STATIC,444,100,60,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_LINE_COLOR_CHANGE,511,100,57,14,BS_FLAT
LTEXT "Function 2",IDC_STATIC,311,172,46,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_FUNC2,375,172,57,14,BS_FLAT
LTEXT "Override",IDC_STATIC,311,226,47,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_OVERRIDE,375,226,57,14,BS_FLAT
LTEXT "Manipulator",IDC_STATIC,444,82,40,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_MANIPULATOR,511,82,57,14,BS_FLAT
LTEXT "Function 1",IDC_STATIC,311,154,37,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_FUNC1,375,154,57,14,BS_FLAT
LTEXT "Tank Detach",IDC_STATIC,311,208,52,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_TANK_DETACH,375,208,57,14,BS_FLAT
LTEXT "F.S.S",IDC_STATIC,444,64,40,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_BTN_FSS,511,64,57,14,BS_FLAT
LTEXT "Slide-step",IDC_STATIC,17,239,40,14,SS_CENTERIMAGE
LTEXT "Brake",IDC_STATIC,120,239,26,14,SS_CENTERIMAGE
LTEXT "Accel",IDC_STATIC,209,239,23,14,SS_CENTERIMAGE
LTEXT "Communication 1",IDC_STATIC,311,64,64,14,SS_CENTERIMAGE
LTEXT "Communication 2",IDC_STATIC,311,82,64,14,SS_CENTERIMAGE
LTEXT "Communication 3",IDC_STATIC,311,100,64,14,SS_CENTERIMAGE
LTEXT "Communication 4",IDC_STATIC,311,118,64,14,SS_CENTERIMAGE
LTEXT "Communication 5",IDC_STATIC,311,136,64,14,SS_CENTERIMAGE
GROUPBOX "Pedals",IDC_BLOCK_PEDALS,12,220,281,48
PUSHBUTTON "",IDC_BTN_LEFT_PEDAL,55,239,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_MIDDLE_PEDAL,144,239,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_RIGHT_PEDAL,230,239,57,14,BS_FLAT
LTEXT "Tuner Up",IDC_STATIC,444,226,60,14,SS_CENTERIMAGE
LTEXT "Tuner Down",IDC_STATIC,444,244,60,14,SS_CENTERIMAGE
PUSHBUTTON "",IDC_RADIO_TD_UP,511,226,57,14,BS_FLAT
PUSHBUTTON "",IDC_RADIO_TD_DOWN,511,244,57,14,BS_FLAT
PUSHBUTTON "",IDC_AIMING_POSY,650,64,57,14,BS_FLAT
PUSHBUTTON "",IDC_AIMING_NEGY,650,82,57,14,BS_FLAT
PUSHBUTTON "",IDC_AIMING_NEGX,650,100,57,14,BS_FLAT
PUSHBUTTON "",IDC_AIMING_POSX,650,118,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_MAIN_WEAPON,650,136,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_SUB_WEAPON,650,154,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_LOCK_ON,650,172,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_OPEN_CLOSE,650,190,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_MODE_SELECT,650,208,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_ZOOM_IN,650,226,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_MAP_ZOOM_IN_OUT,650,244,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_START,771,154,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_IGNITION,771,136,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_COCKPIT_HATCH,771,118,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_EJECT,771,100,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_ZOOM_OUT,771,82,57,14,BS_FLAT
PUSHBUTTON "",IDC_BTN_SUB_MONITOR_MODE_SELECT,771,64,57,14,BS_FLAT
LTEXT "Aim Up",IDC_STATIC,599,64,51,14,SS_CENTERIMAGE
LTEXT "Aim Down",IDC_STATIC,599,82,51,14,SS_CENTERIMAGE
LTEXT "Aim Left",IDC_STATIC,599,100,51,14,SS_CENTERIMAGE
LTEXT "Aim Right",IDC_STATIC,599,118,51,14,SS_CENTERIMAGE
LTEXT "Main Weapon",IDC_STATIC,599,136,51,14,SS_CENTERIMAGE
LTEXT "Sub Weapon",IDC_STATIC,599,154,51,14,SS_CENTERIMAGE
LTEXT "Lock On",IDC_STATIC,599,172,51,14,SS_CENTERIMAGE
LTEXT "Open Close",IDC_STATIC,599,190,51,14,SS_CENTERIMAGE
LTEXT "Mode Select",IDC_STATIC,599,208,51,14,SS_CENTERIMAGE
LTEXT "Zoom In",IDC_STATIC,599,226,51,14,SS_CENTERIMAGE
LTEXT "Map Zoom",IDC_STATIC,599,244,51,14,SS_CENTERIMAGE
LTEXT "Start",IDC_STATIC,720,154,51,14,SS_CENTERIMAGE
LTEXT "Ignition",IDC_STATIC,720,136,51,14,SS_CENTERIMAGE
LTEXT "Cockpit Hatch",IDC_STATIC,720,118,51,14,SS_CENTERIMAGE
LTEXT "Eject",IDC_STATIC,720,100,51,14,SS_CENTERIMAGE
LTEXT "Zoom Out",IDC_STATIC,720,82,51,14,SS_CENTERIMAGE
LTEXT "Sub Monitor",IDC_STATIC,720,64,51,14,SS_CENTERIMAGE
END END
IDD_VIDEO_CFG DIALOGEX 0, 0, 259, 150 IDD_VIDEO_CFG DIALOGEX 0, 0, 259, 150
@ -416,7 +317,7 @@ BEGIN
LTEXT "Direct3D Device:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT LTEXT "Direct3D Device:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT
LTEXT "Display Resolution:",IDC_STATIC,6,52,64,8,0,WS_EX_RIGHT LTEXT "Display Resolution:",IDC_STATIC,6,52,64,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,21,89,49,8,0,WS_EX_RIGHT LTEXT "Other Options:",IDC_STATIC,21,89,49,8,0,WS_EX_RIGHT
CONTROL "Maintain Aspect Ratio",IDC_CV_MAINTAINASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,102,123,11 CONTROL "Enable Hardware YUV Overlays",IDC_CV_HARDWAREYUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,102,123,11
COMBOBOX IDC_VC_RENDER_RESOLUTION,76,68,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_VC_RENDER_RESOLUTION,76,68,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Render Resolution:",IDC_STATIC,7,70,63,8,0,WS_EX_RIGHT LTEXT "Render Resolution:",IDC_STATIC,7,70,63,8,0,WS_EX_RIGHT
END END
@ -436,7 +337,8 @@ BEGIN
LTEXT "Audio Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT LTEXT "Audio Adapter:",IDC_STATIC,13,14,57,8,0,WS_EX_RIGHT
LTEXT "Codec Options:",IDC_STATIC,13,34,57,8,0,WS_EX_RIGHT LTEXT "Codec Options:",IDC_STATIC,13,34,57,8,0,WS_EX_RIGHT
LTEXT "Other Options:",IDC_STATIC,13,60,57,8,0,WS_EX_RIGHT LTEXT "Other Options:",IDC_STATIC,13,60,57,8,0,WS_EX_RIGHT
CONTROL "Mute when unfocus",IDC_AC_MUTE_WHEN_UNFOCUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,60,78,10 CONTROL "Disable mute on unfocus",IDC_AC_MUTE_ON_UNFOCUS_DISABLE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,60,97,10
END END
IDD_NETWORK_CFG DIALOGEX 0, 0, 404, 76 IDD_NETWORK_CFG DIALOGEX 0, 0, 404, 76
@ -457,17 +359,17 @@ CAPTION "Cxbx-Reloaded : Eeprom Configuration"
FONT 8, "Verdana", 0, 0, 0x1 FONT 8, "Verdana", 0, 0, 0x1
BEGIN BEGIN
EDITTEXT IDC_EE_CONFOUNDER,100,10,140,12 EDITTEXT IDC_EE_CONFOUNDER,100,10,140,12
EDITTEXT IDC_EE_HDDKEY,100,25,140,12,ES_AUTOHSCROLL EDITTEXT IDC_EE_HDDKEY,100,25,140,12
COMBOBOX IDC_EE_XBOX_REGION,100,40,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_XBOX_REGION,100,40,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_EE_SERIAL_NUMBER,100,56,140,12 EDITTEXT IDC_EE_SERIAL_NUMBER,100,56,140,12
EDITTEXT IDC_EE_MAC_ADDRESS,100,72,140,12 EDITTEXT IDC_EE_MAC_ADDRESS,100,72,140,12
EDITTEXT IDC_EE_ONLINE_KEY,100,88,140,12,ES_AUTOHSCROLL EDITTEXT IDC_EE_ONLINE_KEY,100,88,140,12
COMBOBOX IDC_EE_AVREGION,100,103,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_AVREGION,100,103,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_EE_LANGUAGE,100,119,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_LANGUAGE,100,119,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_EE_AVSETTINGS,100,135,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_AVSETTINGS,100,135,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_EE_AUDIOSETTINGS,100,150,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_AUDIOSETTINGS,100,150,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_EE_GAME_PRTL_CRTL,100,166,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_GAME_PRTL_CRTL,100,166,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_EE_PRTL_PASS,100,183,140,12,ES_PASSWORD EDITTEXT IDC_EE_PRTL_PASS,100,183,140,12
COMBOBOX IDC_EE_MOVIE_PRTL_CRTL,100,198,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_MOVIE_PRTL_CRTL,100,198,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_EE_DVDREGION,100,214,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EE_DVDREGION,100,214,140,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "PAL 60Hz",IDC_EE_PAL60HZ,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP,13,235,50,10 CONTROL "PAL 60Hz",IDC_EE_PAL60HZ,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP,13,235,50,10
@ -493,15 +395,14 @@ BEGIN
PUSHBUTTON "Reset",IDC_EE_RESET,13,251,40,14,BS_FLAT PUSHBUTTON "Reset",IDC_EE_RESET,13,251,40,14,BS_FLAT
END END
IDD_LOGGING_CFG DIALOGEX 0, 0, 258, 366 IDD_LOGGING_CFG DIALOGEX 0, 0, 258, 355
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cxbx-Reloaded : Logging Configuration" CAPTION "Cxbx-Reloaded : Logging Configuration"
FONT 8, "Verdana", 0, 0, 0x1 FONT 8, "Verdana", 0, 0, 0x1
BEGIN BEGIN
COMBOBOX IDC_EVENT_LV,57,9,50,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_EVENT_LV,57,9,50,10,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CTEXT "Event Level",IDC_STATIC,10,11,40,10,0,WS_EX_RIGHT CTEXT "Event Level",IDC_STATIC,10,11,40,10,0,WS_EX_RIGHT
CONTROL "Enable Test Case Popup",IDC_LOG_POPUP_TESTCASE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,121,12,113,10 GROUPBOX "Emulator Event",IDC_CXBXR_EVENTS,12,26,234,186,WS_GROUP,WS_EX_CLIENTEDGE
GROUPBOX "Emulator Event",IDC_CXBXR_EVENTS,12,26,234,198,WS_GROUP,WS_EX_CLIENTEDGE
CONTROL "Enable all",IDC_LOG_ENABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,19,39,47,10 CONTROL "Enable all",IDC_LOG_ENABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,19,39,47,10
CONTROL "Disable all",IDC_LOG_DISABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,71,39,50,10 CONTROL "Disable all",IDC_LOG_DISABLE_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,71,39,50,10
CONTROL "Custom",IDC_LOG_CUSTOM_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,134,39,41,10 CONTROL "Custom",IDC_LOG_CUSTOM_GENERAL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,134,39,41,10
@ -547,36 +448,33 @@ BEGIN
CONTROL "XIDCTRL",IDC_LOG_XIDCTRL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,20,195,46,10 CONTROL "XIDCTRL",IDC_LOG_XIDCTRL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,20,195,46,10
CONTROL "ADM",IDC_LOG_ADM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,90,195,31,10 CONTROL "ADM",IDC_LOG_ADM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,90,195,31,10
CONTROL "INPSYS",IDC_LOG_INPSYS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,137,195,41,10 CONTROL "INPSYS",IDC_LOG_INPSYS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,137,195,41,10
GROUPBOX "Kernel Event",IDC_KERNEL_EVENTS,12,231,234,110,WS_GROUP,WS_EX_CLIENTEDGE GROUPBOX "Kernel Event",IDC_KERNEL_EVENTS,12,218,234,110,WS_GROUP,WS_EX_CLIENTEDGE
CONTROL "Enable all",IDC_LOG_ENABLE_KERNEL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,19,245,47,10 CONTROL "Enable all",IDC_LOG_ENABLE_KERNEL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,19,232,47,10
CONTROL "Disable all",IDC_LOG_DISABLE_KERNEL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,71,245,50,10 CONTROL "Disable all",IDC_LOG_DISABLE_KERNEL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,71,232,50,10
CONTROL "Custom",IDC_LOG_CUSTOM_KERNEL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,134,245,41,10 CONTROL "Custom",IDC_LOG_CUSTOM_KERNEL,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,134,232,41,10
CONTROL "KRNL",IDC_LOG_KRNL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,33,260,33,10 CONTROL "KRNL",IDC_LOG_KRNL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,33,247,33,10
CONTROL "LOG",IDC_LOG_LOG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,91,260,30,10 CONTROL "LOG",IDC_LOG_LOG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,91,247,30,10
CONTROL "XBOX",IDC_LOG_XBOX,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,141,260,35,10 CONTROL "XBOX",IDC_LOG_XBOX,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,141,247,35,10
CONTROL "XBDM",IDC_LOG_XBDM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,199,260,35,10 CONTROL "XBDM",IDC_LOG_XBDM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,199,247,35,10
CONTROL "AV",IDC_LOG_AV,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,41,275,25,10 CONTROL "AV",IDC_LOG_AV,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,41,262,25,10
CONTROL "DBG",IDC_LOG_DBG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,90,275,31,10 CONTROL "DBG",IDC_LOG_DBG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,90,262,31,10
CONTROL "EX",IDC_LOG_EX,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,150,275,25,10 CONTROL "EX",IDC_LOG_EX,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,150,262,25,10
CONTROL "FSC",IDC_LOG_FSC,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,205,275,29,10 CONTROL "FSC",IDC_LOG_FSC,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,205,262,29,10
CONTROL "HAL",IDC_LOG_HAL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,37,290,29,10 CONTROL "HAL",IDC_LOG_HAL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,37,277,29,10
CONTROL "IO",IDC_LOG_IO,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,97,290,24,10 CONTROL "IO",IDC_LOG_IO,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,97,277,24,10
CONTROL "KD",IDC_LOG_KD,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,149,290,26,10 CONTROL "KD",IDC_LOG_KD,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,149,277,26,10
CONTROL "KE",IDC_LOG_KE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,209,290,25,10 CONTROL "KE",IDC_LOG_KE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,209,277,25,10
CONTROL "KI",IDC_LOG_KI,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,43,305,23,10 CONTROL "KI",IDC_LOG_KI,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,43,292,23,10
CONTROL "MM",IDC_LOG_MM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,95,305,26,10 CONTROL "MM",IDC_LOG_MM,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,95,292,26,10
CONTROL "NT",IDC_LOG_NT,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,150,305,25,10 CONTROL "NT",IDC_LOG_NT,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,150,292,25,10
CONTROL "OB",IDC_LOG_OB,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,208,305,26,10 CONTROL "OB",IDC_LOG_OB,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,208,292,26,10
CONTROL "PS",IDC_LOG_PS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,41,321,25,10 CONTROL "PS",IDC_LOG_PS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,41,308,25,10
CONTROL "RTL",IDC_LOG_RTL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,93,321,28,10 CONTROL "RTL",IDC_LOG_RTL,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,93,308,28,10
CONTROL "XC",IDC_LOG_XC,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,149,321,26,10 CONTROL "XC",IDC_LOG_XC,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,149,308,26,10
CONTROL "XE",IDC_LOG_XE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,209,321,25,10 CONTROL "XE",IDC_LOG_XE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,209,308,25,10
PUSHBUTTON "Cancel",IDC_LOG_CANCEL,161,346,40,14,BS_FLAT PUSHBUTTON "Cancel",IDC_LOG_CANCEL,161,333,40,14,BS_FLAT
PUSHBUTTON "Accept",IDC_LOG_ACCEPT,206,346,40,14,BS_FLAT PUSHBUTTON "Accept",IDC_LOG_ACCEPT,206,333,40,14,BS_FLAT
CONTROL "VSHCACHE",IDC_LOG_VSHCACHE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,68,140,53,10 CONTROL "VSHCACHE",IDC_LOG_VSHCACHE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,68,140,53,10
CONTROL "RINP",IDC_LOG_RINP,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,202,195,32,10
CONTROL "JVS",IDC_LOG_JVS,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,38,206,28,10
CONTROL "LIBUSB",IDC_LOG_LIBUSB,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | WS_TABSTOP,80,206,41,10
END END
IDD_ABOUT DIALOGEX 0, 0, 310, 177 IDD_ABOUT DIALOGEX 0, 0, 310, 177
@ -633,26 +531,6 @@ BEGIN
0 0
END END
IDD_INPUT_CFG AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_SBC_CFG AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_XID_DUKE_CFG AFX_DIALOG_LAYOUT
BEGIN
0
END
IDD_LIGHTGUN_CFG AFX_DIALOG_LAYOUT
BEGIN
0
END
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -672,7 +550,7 @@ IDI_CXBX ICON "Cxbx-R.ico"
1 TEXTINCLUDE 1 TEXTINCLUDE
BEGIN BEGIN
"ResCxbx.h\0" "..\\src\\gui\\ResCxbx.h\0"
END END
2 TEXTINCLUDE 2 TEXTINCLUDE
@ -711,7 +589,10 @@ BEGIN
MENUITEM "&Open Xbe...", ID_FILE_OPEN_XBE,MFT_STRING,MFS_ENABLED MENUITEM "&Open Xbe...", ID_FILE_OPEN_XBE,MFT_STRING,MFS_ENABLED
MENUITEM "Open D&ashboard...\tF7", ID_FILE_OPEN_DASHBOARD,MFT_STRING,MFS_ENABLED MENUITEM "Open D&ashboard...\tF7", ID_FILE_OPEN_DASHBOARD,MFT_STRING,MFS_ENABLED
MENUITEM "&Close Xbe", ID_FILE_CLOSE_XBE,MFT_STRING,MFS_ENABLED MENUITEM "&Close Xbe", ID_FILE_CLOSE_XBE,MFT_STRING,MFS_ENABLED
MENUITEM "", -1, MFT_SEPARATOR MENUITEM MFT_SEPARATOR
MENUITEM "&Save Xbe", ID_FILE_SAVEXBEFILE,MFT_STRING,MFS_ENABLED
MENUITEM "Save Xbe &As...", ID_FILE_SAVEXBEFILEAS,MFT_STRING,MFS_ENABLED
MENUITEM MFT_SEPARATOR
POPUP "&Recent Xbe Files", 65535,MFT_STRING,MFS_ENABLED POPUP "&Recent Xbe Files", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
MENUITEM "&0 : Recent Placeholder", ID_FILE_RXBE_0,MFT_STRING,MFS_ENABLED MENUITEM "&0 : Recent Placeholder", ID_FILE_RXBE_0,MFT_STRING,MFS_ENABLED
@ -725,7 +606,7 @@ BEGIN
MENUITEM "&8 : Recent Placeholder", ID_FILE_RXBE_8,MFT_STRING,MFS_ENABLED MENUITEM "&8 : Recent Placeholder", ID_FILE_RXBE_8,MFT_STRING,MFS_ENABLED
MENUITEM "&9 : Recent Placeholder", ID_FILE_RXBE_9,MFT_STRING,MFS_ENABLED MENUITEM "&9 : Recent Placeholder", ID_FILE_RXBE_9,MFT_STRING,MFS_ENABLED
END END
MENUITEM "", -1, MFT_SEPARATOR MENUITEM MFT_SEPARATOR
MENUITEM "E&xit", ID_FILE_EXIT,MFT_STRING,MFS_ENABLED MENUITEM "E&xit", ID_FILE_EXIT,MFT_STRING,MFS_ENABLED
END END
POPUP "&Edit", 65535,MFT_STRING,MFS_ENABLED POPUP "&Edit", 65535,MFT_STRING,MFS_ENABLED
@ -735,7 +616,12 @@ BEGIN
MENUITEM "&Import...", ID_EDIT_LOGOBITMAP_IMPORT,MFT_STRING,MFS_ENABLED MENUITEM "&Import...", ID_EDIT_LOGOBITMAP_IMPORT,MFT_STRING,MFS_ENABLED
MENUITEM "&Export...", ID_EDIT_LOGOBITMAP_EXPORT,MFT_STRING,MFS_ENABLED MENUITEM "&Export...", ID_EDIT_LOGOBITMAP_EXPORT,MFT_STRING,MFS_ENABLED
END END
MENUITEM "", -1, MFT_SEPARATOR POPUP "&Patch", 65535,MFT_STRING,MFS_ENABLED
BEGIN
MENUITEM "&Allow >64 MB", ID_EDIT_PATCH_ALLOW64MB,MFT_STRING,MFS_ENABLED
MENUITEM "&Debug Mode", ID_EDIT_PATCH_DEBUGMODE,MFT_STRING,MFS_ENABLED
END
MENUITEM MFT_SEPARATOR
POPUP "Dump &Xbe Info To...", 65535,MFT_STRING,MFS_ENABLED POPUP "Dump &Xbe Info To...", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
MENUITEM "&File...", ID_EDIT_DUMPXBEINFOTO_FILE,MFT_STRING,MFS_ENABLED MENUITEM "&File...", ID_EDIT_DUMPXBEINFOTO_FILE,MFT_STRING,MFS_ENABLED
@ -763,13 +649,6 @@ BEGIN
MENUITEM "Config &Network...", ID_SETTINGS_CONFIG_NETWORK,MFT_STRING,MFS_ENABLED MENUITEM "Config &Network...", ID_SETTINGS_CONFIG_NETWORK,MFT_STRING,MFS_ENABLED
MENUITEM "Config &Eeprom...", ID_SETTINGS_CONFIG_EEPROM,MFT_STRING,MFS_ENABLED MENUITEM "Config &Eeprom...", ID_SETTINGS_CONFIG_EEPROM,MFT_STRING,MFS_ENABLED
MENUITEM "Config &Logging...", ID_SETTINGS_CONFIG_LOGGING,MFT_STRING,MFS_ENABLED MENUITEM "Config &Logging...", ID_SETTINGS_CONFIG_LOGGING,MFT_STRING,MFS_ENABLED
POPUP "Config &Console Type..."
BEGIN
MENUITEM "&Auto", ID_SETTINGS_CONFIG_CONT_AUTO
MENUITEM "&Retail", ID_SETTINGS_CONFIG_CONT_RETAIL
MENUITEM "&Devkit", ID_SETTINGS_CONFIG_CONT_DEVKIT
MENUITEM "&Chihiro", ID_SETTINGS_CONFIG_CONT_CHIHIRO
END
POPUP "Config &Data Location...", 65535,MFT_STRING,MFS_ENABLED POPUP "Config &Data Location...", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
MENUITEM "Store in AppData", ID_SETTINGS_CONFIG_DLOCAPPDATA,MFT_STRING,MFS_ENABLED MENUITEM "Store in AppData", ID_SETTINGS_CONFIG_DLOCAPPDATA,MFT_STRING,MFS_ENABLED
@ -781,14 +660,10 @@ BEGIN
MENUITEM "&Clear entire Symbol Cache", ID_CACHE_CLEARHLECACHE_ALL,MFT_STRING,MFS_ENABLED MENUITEM "&Clear entire Symbol Cache", ID_CACHE_CLEARHLECACHE_ALL,MFT_STRING,MFS_ENABLED
MENUITEM "&Rescan title Symbol Cache", ID_CACHE_CLEARHLECACHE_CURRENT,MFT_STRING,MFS_ENABLED MENUITEM "&Rescan title Symbol Cache", ID_CACHE_CLEARHLECACHE_CURRENT,MFT_STRING,MFS_ENABLED
END END
MENUITEM "Clear Cache Partitions", ID_SETTINGS_CLEAR_PARTITIONS,MFT_STRING,MFS_ENABLED MENUITEM MFT_SEPARATOR
MENUITEM "", -1, MFT_SEPARATOR POPUP "&LLE (Experimental)", 65535,MFT_STRING,MFS_ENABLED
POPUP "Experimental", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
POPUP "&LLE", 65535,MFT_STRING,MFS_ENABLED MENUITEM "LLE &GPU", ID_EMULATION_LLE_GPU,MFT_STRING,MFS_GRAYED
BEGIN
MENUITEM "LLE &GPU", ID_EMULATION_LLE_GPU,MFT_STRING,MFS_GRAYED
END
END END
POPUP "Hacks", 65535,MFT_STRING,MFS_ENABLED POPUP "Hacks", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
@ -799,23 +674,21 @@ BEGIN
MENUITEM "Disable Pixel Shaders", ID_HACKS_DISABLEPIXELSHADERS,MFT_STRING,MFS_ENABLED MENUITEM "Disable Pixel Shaders", ID_HACKS_DISABLEPIXELSHADERS,MFT_STRING,MFS_ENABLED
MENUITEM "Skip rdtsc patching", ID_HACKS_SKIPRDTSCPATCHING,MFT_STRING,MFS_ENABLED MENUITEM "Skip rdtsc patching", ID_HACKS_SKIPRDTSCPATCHING,MFT_STRING,MFS_ENABLED
END END
MENUITEM "Ignore Invalid Xbe Signature", ID_SETTINGS_IGNOREINVALIDXBESIG,MFT_STRING,MFS_ENABLED
MENUITEM "Ignore Invalid Xbe Sections", ID_SETTINGS_IGNOREINVALIDXBESEC,MFT_STRING,MFS_ENABLED
MENUITEM "Allow Admin Privilege", ID_SETTINGS_ALLOWADMINPRIVILEGE,MFT_STRING,MFS_ENABLED MENUITEM "Allow Admin Privilege", ID_SETTINGS_ALLOWADMINPRIVILEGE,MFT_STRING,MFS_ENABLED
MENUITEM "", -1, MFT_SEPARATOR MENUITEM MFT_SEPARATOR
MENUITEM "Reset To Defaults", ID_SETTINGS_INITIALIZE,MFT_STRING,MFS_ENABLED MENUITEM "Reset To Defaults", ID_SETTINGS_INITIALIZE,MFT_STRING,MFS_ENABLED
END END
POPUP "E&mulation", 65535,MFT_STRING,MFS_ENABLED POPUP "E&mulation", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
MENUITEM "&Start\tF5", ID_EMULATION_START,MFT_STRING,MFS_ENABLED MENUITEM "&Start\tF5", ID_EMULATION_START,MFT_STRING,MFS_ENABLED
MENUITEM "Start &Debugger...\tF9", ID_EMULATION_STARTDEBUGGER,MFT_STRING,MFS_ENABLED MENUITEM "Start &Debugger...\tF9", ID_EMULATION_STARTDEBUGGER,MFT_STRING,MFS_ENABLED
MENUITEM "", -1, MFT_SEPARATOR MENUITEM MFT_SEPARATOR
MENUITEM "S&top\tF6", ID_EMULATION_STOP,MFT_STRING,MFS_ENABLED MENUITEM "S&top\tF6", ID_EMULATION_STOP,MFT_STRING,MFS_ENABLED
END END
POPUP "&Help", 65535,MFT_STRING,MFS_ENABLED POPUP "&Help", 65535,MFT_STRING,MFS_ENABLED
BEGIN BEGIN
MENUITEM "&Go To The Official Cxbx Web Site...", ID_HELP_HOMEPAGE,MFT_STRING,MFS_ENABLED MENUITEM "&Go To The Official Cxbx Web Site...", ID_HELP_HOMEPAGE,MFT_STRING,MFS_ENABLED
MENUITEM "", -1, MFT_SEPARATOR MENUITEM MFT_SEPARATOR
MENUITEM "&About", ID_HELP_ABOUT,MFT_STRING,MFS_ENABLED MENUITEM "&About", ID_HELP_ABOUT,MFT_STRING,MFS_ENABLED
END END
MENUITEM " ", ID_FPS,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED MENUITEM " ", ID_FPS,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

View File

@ -1,10 +1,10 @@
@echo off @echo off
REM Cxbx-Reloaded setup script REM CXbx-Reloaded setup script
REM REM
REM Depends on git, cmake and Visual Studio being installed. REM Depends on git, cmake and Visual Studio being installed.
echo Pulling latest version from git... echo Pulling lastest version from git...
REM git clone --recurse-submodules https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/ REM git clone --recurse-submodules https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/
git pull --recurse-submodules git pull --recurse-submodules
@ -21,6 +21,6 @@ REM cmake .. -G "Visual Studio 16 2019" -A Win32
cmake .. -A Win32 cmake .. -A Win32
echo Building solution... echo Building solution...
cmake --build . -j %NUMBER_OF_PROCESSORS% cmake --build .
echo Done! Enjoy using Cxbx-Reloaded! echo Done! Enjoy using Cxbx-Reloaded!

View File

@ -3,5 +3,5 @@ root = true
[*] [*]
indent_size = 4 indent_size = 4
trim_trailing_whitespace = true trim_trailing_whitespace = true
end_of_line = lf end_of_line = crlf
insert_final_newline = true insert_final_newline = true

View File

@ -27,7 +27,14 @@
#include <cstdint> #include <cstdint>
#define FUNC_EXPORTS __pragma(comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)) /*! xbaddr is the type of a physical address */
typedef uint32_t xbaddr;
/*! xbnullptr is the type of null pointer address*/
#define xbnullptr nullptr
/*! xbnull is the type of null address or value*/
#define xbnull 0
#ifdef _DEBUG #ifdef _DEBUG
/*! define this to track memory allocations */ /*! define this to track memory allocations */
@ -61,14 +68,18 @@ enum DebugMode { DM_NONE, DM_CONSOLE, DM_FILE };
/*! debugger enable state */ /*! debugger enable state */
enum DebuggerState { debuggerOff, debuggerOn }; enum DebuggerState { debuggerOff, debuggerOn };
/*! indicates emulation of a Chihiro system */ /*! type of Xbe */
enum XbeType { xtRetail, xtDebug, xtChihiro };
extern XbeType g_XbeType;
/*! indicates emulation of an Chihiro (arcade, instead of Xbox console) executable */
extern bool g_bIsChihiro; extern bool g_bIsChihiro;
/*! indicates emulation of a DevKit system */ /*! indicates emulation of a Debug xbe executable */
/* Note: Our DevKit emulation lacks the kernel debugging interface and virtual dvd-rom emulator card, so this is actually a Debug Kit */ extern bool g_bIsDebug;
extern bool g_bIsDevKit;
/*! indicates emulation of a Retail system */ /*! indicates emulation of a Retail xbe executable*/
extern bool g_bIsRetail; extern bool g_bIsRetail;
/*! indicates ability to save on exit (needed for settings reset) */ /*! indicates ability to save on exit (needed for settings reset) */
@ -84,4 +95,6 @@ extern volatile bool g_bPrintfOn;
#define CxbxSetThreadName(Name) #define CxbxSetThreadName(Name)
#endif #endif
#include <filesystem>
#endif #endif

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.8" sku=".NETFramework,Version=v4.8"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup> </startup>
</configuration> </configuration>

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.12) cmake_minimum_required (VERSION 3.8)
project(cxbxr-debugger LANGUAGES CSharp) project(cxbxr-debugger LANGUAGES CSharp)
# Output all binary files into one folder # Output all binary files into one folder
@ -13,12 +13,6 @@ add_compile_options(
/langversion:6 /langversion:6
) )
# First, we must define .NET Framework version before include cs_x86's projects.
# Which then will pass down version we want unified.
set(DOTNET_TARGET_FRAMEWORK_VERSION "v4.8")
add_subdirectory("${CXBXR_ROOT_DIR}/import/cs_x86" "${CMAKE_BINARY_DIR}/import/cs_x86")
set(CXBXR_DEBUGGER_SRC_DIR "${CXBXR_ROOT_DIR}/src/CxbxDebugger") set(CXBXR_DEBUGGER_SRC_DIR "${CXBXR_ROOT_DIR}/src/CxbxDebugger")
file (GLOB SOURCES file (GLOB SOURCES
@ -43,15 +37,16 @@ file (GLOB SOURCES
"${CXBXR_DEBUGGER_SRC_DIR}/DebugOutputManager.cs" "${CXBXR_DEBUGGER_SRC_DIR}/DebugOutputManager.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/FileEventManager.cs" "${CXBXR_DEBUGGER_SRC_DIR}/FileEventManager.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/FileWatchManager.cs" "${CXBXR_DEBUGGER_SRC_DIR}/FileWatchManager.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/IDebugWindow.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Form1.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Form1.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.Designer.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Form1.resx"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.resx"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.resx"
"${CXBXR_DEBUGGER_SRC_DIR}/PatchManager.cs" "${CXBXR_DEBUGGER_SRC_DIR}/PatchManager.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Program.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Program.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/AssemblyInfo.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Resources.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Resources.resx"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Settings.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Settings.settings"
"${CXBXR_DEBUGGER_SRC_DIR}/Resources/BreakpointDisable_16x_24.bmp" "${CXBXR_DEBUGGER_SRC_DIR}/Resources/BreakpointDisable_16x_24.bmp"
"${CXBXR_DEBUGGER_SRC_DIR}/Resources/BreakpointEnable_16x_24.bmp" "${CXBXR_DEBUGGER_SRC_DIR}/Resources/BreakpointEnable_16x_24.bmp"
"${CXBXR_DEBUGGER_SRC_DIR}/Resources/Pause_16x_24.bmp" "${CXBXR_DEBUGGER_SRC_DIR}/Resources/Pause_16x_24.bmp"
@ -97,8 +92,10 @@ file (GLOB SOURCES
"${CXBXR_DEBUGGER_SRC_DIR}/Win32/Windows/NativeMethods.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Win32/Windows/NativeMethods.cs"
) )
file (GLOB PROPERTIES csharp_set_windows_forms_properties(
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Settings.settings" "${CXBXR_DEBUGGER_SRC_DIR}/Form1.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Form1.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Form1.resx"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/AssemblyInfo.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Properties/AssemblyInfo.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Resources.Designer.cs" "${CXBXR_DEBUGGER_SRC_DIR}/Properties/Resources.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Resources.resx" "${CXBXR_DEBUGGER_SRC_DIR}/Properties/Resources.resx"
@ -106,22 +103,7 @@ file (GLOB PROPERTIES
"${CXBXR_DEBUGGER_SRC_DIR}/Properties/Settings.settings" "${CXBXR_DEBUGGER_SRC_DIR}/Properties/Settings.settings"
) )
csharp_set_windows_forms_properties( set_source_files_properties("${CXBXR_DEBUGGER_SRC_DIR}/Form1.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.resx"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.Designer.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.resx"
)
csharp_set_designer_cs_properties(
${PROPERTIES}
)
set_source_files_properties(
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerInstance.cs"
"${CXBXR_DEBUGGER_SRC_DIR}/CxbxDebuggerMain.cs"
VS_CSHARP_SubType "Form" VS_CSHARP_SubType "Form"
) )
@ -131,21 +113,18 @@ set_source_files_properties("${CXBXR_DEBUGGER_SRC_DIR}/RicherTextBox.cs"
source_group(TREE ${CXBXR_ROOT_DIR} FILES ${SOURCES}) source_group(TREE ${CXBXR_ROOT_DIR} FILES ${SOURCES})
add_executable(cxbxr-debugger WIN32 ${SOURCES} ${PROPERTIES} #Test WIN32 like cxbx does if doesn't need compile option set add_executable(cxbxr-debugger WIN32 ${SOURCES} #Test WIN32 like cxbx does if doesn't need compile option set
) )
set_target_properties(cxbxr-debugger PROPERTIES set_target_properties(cxbxr-debugger PROPERTIES
VS_DOTNET_REFERENCES VS_DOTNET_REFERENCES
"Microsoft.CSharp;System;System.Core;System.Data;System.Data.DataSetExtensions;System.Deployment;System.Drawing;System.Windows;System.Windows.Forms;System.Xml;System.Xml.Linq;System.Net.Http" "Microsoft.CSharp;System;System.Core;System.Data;System.Data.DataSetExtensions;System.Deployment;System.Drawing;System.Windows;System.Windows.Forms;System.Xml;System.Xml.Linq;System.Net.Http"
VS_GLOBAL_ApplicationIcon "${CXBXR_ROOT_DIR}/src/gui/resource/Cxbx-R.ico" VS_GLOBAL_ApplicationIcon "${CXBXR_ROOT_DIR}/resource/Cxbx-R.ico"
VS_GLOBAL_ROOTNAMESPACE "CxbxDebugger" VS_GLOBAL_ROOTNAMESPACE "CxbxDebugger"
DOTNET_TARGET_FRAMEWORK_VERSION ${DOTNET_TARGET_FRAMEWORK_VERSION}
) )
set_property(TARGET cxbxr-debugger PROPERTY DOTNET_TARGET_FRAMEWORK_VERSION "v4.5")
target_link_libraries(cxbxr-debugger cs_x86) target_link_libraries(cxbxr-debugger cs_x86)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
)

View File

@ -1,201 +0,0 @@
namespace CxbxDebugger
{
partial class CxbxDebuggerMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CxbxDebuggerMain));
this.menuStrip = new System.Windows.Forms.MenuStrip();
this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.miStartDebugging = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.miSuspend = new System.Windows.Forms.ToolStripMenuItem();
this.miResume = new System.Windows.Forms.ToolStripMenuItem();
this.windowsMenu = new System.Windows.Forms.ToolStripMenuItem();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblStatusDeprecate = new System.Windows.Forms.ToolStripStatusLabel();
this.lblStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip
//
this.menuStrip.ImageScalingSize = new System.Drawing.Size(24, 24);
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileMenu,
this.debugToolStripMenuItem,
this.windowsMenu});
this.menuStrip.Location = new System.Drawing.Point(0, 0);
this.menuStrip.MdiWindowListItem = this.windowsMenu;
this.menuStrip.Name = "menuStrip";
this.menuStrip.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1);
this.menuStrip.Size = new System.Drawing.Size(734, 24);
this.menuStrip.TabIndex = 0;
this.menuStrip.Text = "MenuStrip";
//
// fileMenu
//
this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem});
this.fileMenu.ImageTransparentColor = System.Drawing.SystemColors.ActiveBorder;
this.fileMenu.Name = "fileMenu";
this.fileMenu.Size = new System.Drawing.Size(37, 22);
this.fileMenu.Text = "&File";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeyDisplayString = "Alt+F4";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(135, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolsStripMenuItem_Click);
//
// debugToolStripMenuItem
//
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miStartDebugging,
this.toolStripMenuItem1,
this.miSuspend,
this.miResume});
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 22);
this.debugToolStripMenuItem.Text = "Debug";
//
// miStartDebugging
//
this.miStartDebugging.Image = global::CxbxDebugger.Properties.Resources.run;
this.miStartDebugging.ImageTransparentColor = System.Drawing.Color.Magenta;
this.miStartDebugging.Name = "miStartDebugging";
this.miStartDebugging.ShortcutKeyDisplayString = "F5";
this.miStartDebugging.Size = new System.Drawing.Size(117, 22);
this.miStartDebugging.Text = "&Start";
this.miStartDebugging.Click += new System.EventHandler(this.startDebuggingToolStripMenuItem_Click);
//
// toolStripMenuItem1
//
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(114, 6);
//
// miSuspend
//
this.miSuspend.Image = global::CxbxDebugger.Properties.Resources.pause;
this.miSuspend.ImageTransparentColor = System.Drawing.Color.Magenta;
this.miSuspend.Name = "miSuspend";
this.miSuspend.Size = new System.Drawing.Size(117, 22);
this.miSuspend.Text = "&Break";
this.miSuspend.Click += new System.EventHandler(this.suspendToolStripMenuItem_Click);
//
// miResume
//
this.miResume.Image = global::CxbxDebugger.Properties.Resources.run;
this.miResume.ImageTransparentColor = System.Drawing.Color.Magenta;
this.miResume.Name = "miResume";
this.miResume.Size = new System.Drawing.Size(117, 22);
this.miResume.Text = "&Resume";
this.miResume.Click += new System.EventHandler(this.resumeToolStripMenuItem_Click);
//
// windowsMenu
//
this.windowsMenu.Name = "windowsMenu";
this.windowsMenu.Size = new System.Drawing.Size(68, 22);
this.windowsMenu.Text = "&Windows";
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblStatusDeprecate,
this.lblStatus});
this.statusStrip1.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.VerticalStackWithOverflow;
this.statusStrip1.Location = new System.Drawing.Point(0, 339);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 9, 0);
this.statusStrip1.Size = new System.Drawing.Size(734, 61);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// lblStatusDeprecate
//
this.lblStatusDeprecate.BackColor = System.Drawing.Color.Yellow;
this.lblStatusDeprecate.Name = "lblStatusDeprecate";
this.lblStatusDeprecate.Size = new System.Drawing.Size(723, 15);
this.lblStatusDeprecate.Spring = true;
this.lblStatusDeprecate.Text = "WARNING: cxbxr-debugger will eventually be removed from upstream branch.";
this.lblStatusDeprecate.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblStatus
//
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(723, 15);
this.lblStatus.Text = "Ready";
//
// CxbxDebuggerMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(734, 361);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsMdiContainer = true;
this.MainMenuStrip = this.menuStrip;
this.Name = "CxbxDebuggerMain";
this.Text = "cxbx-debugger";
this.menuStrip.ResumeLayout(false);
this.menuStrip.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip;
private System.Windows.Forms.ToolStripMenuItem fileMenu;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem windowsMenu;
private System.Windows.Forms.ToolTip toolTip;
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem miStartDebugging;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem miSuspend;
private System.Windows.Forms.ToolStripMenuItem miResume;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel lblStatusDeprecate;
private System.Windows.Forms.ToolStripStatusLabel lblStatus;
}
}

View File

@ -1,156 +0,0 @@
// Written by x1nixmzeng for the Cxbx-Reloaded project
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CxbxDebugger
{
public partial class CxbxDebuggerMain : Form, IDebugContainerWindow
{
public CxbxDebuggerMain(string[] args)
{
InitializeComponent();
var StartupArgs = new string[args.Length - 1];
Array.Copy(args, 1, StartupArgs, 0, args.Length - 1);
// Setup session without initially running the game
AddDebugSession(StartupArgs, false);
#if FALSE
AddDebugSession(new string[] { }, false);
#endif
}
private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
{
Close();
}
private void startDebuggingToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ActiveMdiChild is IDebugWindow)
{
(ActiveMdiChild as IDebugWindow).StartSession();
}
}
private void suspendToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ActiveMdiChild is IDebugWindow)
{
(ActiveMdiChild as IDebugWindow).SuspendSession();
}
}
private void resumeToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ActiveMdiChild is IDebugWindow)
{
(ActiveMdiChild as IDebugWindow).ResumeSession();
}
}
public void AddDebugSession(string[] Arguments, bool StartAutomatically)
{
var SessionWindow = CreateNewSessionWindow(Arguments);
if (StartAutomatically)
{
SessionWindow.StartSession();
}
}
public void ReportGameTitle(string GameTitle)
{
Text = $"cxbx-debugger ({GameTitle})";
}
private IDebugWindow CreateNewSessionWindow(string[] Arguments)
{
var childForm = new CxbxDebuggerInstance(this, Arguments);
childForm.WindowState = FormWindowState.Maximized;
childForm.TextChanged += (sender, e) => { OnSessionWindowRenamed(sender as Form); };
childForm.Activated += (sender, e) => { OnSessionWindowActivated(sender as IDebugWindow); };
childForm.Show();
return childForm;
}
private void OnSessionWindowActivated(IDebugWindow child)
{
var state = child.GetDebugStateInfo();
RefreshStatusText(state);
}
private void OnSessionWindowRenamed(Form form)
{
// https://stackoverflow.com/questions/1347734/mdi-window-list-not-updating-child-title-bar-texts
ActivateMdiChild(null);
ActivateMdiChild(form);
}
public void ReportStatus(IDebugWindow Window, DebugState State, string Detail)
{
if (Window == ActiveMdiChild)
{
RefreshStatusText(new DebugStateInfo() { State = State, Detail = Detail });
}
}
private void RefreshStatusText(DebugStateInfo stateInfo)
{
var stateString = "";
var canSuspend = false;
var canResume = false;
var canRun = false;
switch (stateInfo.State)
{
case DebugState.Unknown:
stateString = "No valid Xbe was loaded. Invalid session.";
break;
case DebugState.Idle:
stateString = "Ready";
canRun = true;
break;
case DebugState.Suspended:
stateString = "Suspended";
canResume = true;
break;
case DebugState.Running:
stateString = "Running";
canSuspend = true;
break;
case DebugState.Terminated:
stateString = "Terminated";
//canRun = true; // Uncomment to allow restarted sessions
break;
}
if (!string.IsNullOrEmpty(stateInfo.Detail))
{
stateString += $" - {stateInfo.Detail}";
}
miStartDebugging.Enabled = canRun;
miSuspend.Enabled = canSuspend;
miResume.Enabled = canResume;
lblStatus.Text = stateString;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@ using WinDebug = VsChromium.Core.Win32.Debugging;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using WinLowLevel = LowLevelDesign.Win32.Windows.NativeMethods; using WinLowLevel = LowLevelDesign.Win32.Windows.NativeMethods;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
namespace CxbxDebugger namespace CxbxDebugger
{ {
@ -33,18 +32,13 @@ namespace CxbxDebugger
string[] args = new string[] { }; string[] args = new string[] { };
string Target = ""; string Target = "";
public string TargetPath
{
get { return Target; }
}
RunState State = RunState.NotLaunched; RunState State = RunState.NotLaunched;
DebuggerMessages.DebuggerInit InitParams = new DebuggerMessages.DebuggerInit(); DebuggerMessages.DebuggerInit InitParams = new DebuggerMessages.DebuggerInit();
DebuggerInstance DebugInstance; DebuggerInstance DebugInstance;
List<IDebuggerSessionEvents> SessionEvents = new List<IDebuggerSessionEvents>(); List<IDebuggerGeneralEvents> GeneralEvents = new List<IDebuggerGeneralEvents>();
List<IDebuggerProcessEvents> ProcessEvents = new List<IDebuggerProcessEvents>(); List<IDebuggerProcessEvents> ProcessEvents = new List<IDebuggerProcessEvents>();
List<IDebuggerThreadEvents> ThreadEvents = new List<IDebuggerThreadEvents>(); List<IDebuggerThreadEvents> ThreadEvents = new List<IDebuggerThreadEvents>();
List<IDebuggerModuleEvents> ModuleEvents = new List<IDebuggerModuleEvents>(); List<IDebuggerModuleEvents> ModuleEvents = new List<IDebuggerModuleEvents>();
@ -77,29 +71,30 @@ namespace CxbxDebugger
Init(); Init();
} }
public Debugger(string[] launchArgs) public Debugger(string[] x_args)
{ {
Init(); Init();
// Copy XBE path without the quotes if (x_args == null)
var loadArg = Array.FindIndex(launchArgs, x => x == "/load"); return;
if (loadArg != -1)
// Copy all arguments
args = x_args;
// Keep quotes for any strings that may contain spaces
int scratch;
for (int i = 0; i < args.Length; ++i)
{ {
Target = launchArgs[loadArg + 1].Trim(new char[] { '"' }); if (int.TryParse(args[i], out scratch) == false)
{
args[i] = string.Format("\"{0}\"", args[i]);
}
} }
args = new string[launchArgs.Length]; // Copy XBE path without the quotes
if(x_args.Length > 2)
for (int i = 0; i < launchArgs.Length; ++i)
{ {
var arg = launchArgs[i]; Target = x_args[2].Trim(new char[] { '"' });
if (arg.Contains(" "))
{
arg = string.Format($"\"{arg}\"");
}
args[i] = arg;
} }
} }
@ -109,7 +104,7 @@ namespace CxbxDebugger
bpStall.Set(); bpStall.Set();
// Remove all events // Remove all events
SessionEvents.Clear(); GeneralEvents.Clear();
ProcessEvents.Clear(); ProcessEvents.Clear();
ThreadEvents.Clear(); ThreadEvents.Clear();
ModuleEvents.Clear(); ModuleEvents.Clear();
@ -178,19 +173,14 @@ namespace CxbxDebugger
if (CanLaunch() == false) if (CanLaunch() == false)
throw new Exception("Unable to launch in this state"); throw new Exception("Unable to launch in this state");
if (args.Length == 0)
return false;
var DebugCreationFlags = var DebugCreationFlags =
WinProcesses.ProcessCreationFlags.DEBUG_ONLY_THIS_PROCESS | WinProcesses.ProcessCreationFlags.DEBUG_ONLY_THIS_PROCESS |
WinProcesses.ProcessCreationFlags.CREATE_NEW_CONSOLE; WinProcesses.ProcessCreationFlags.CREATE_NEW_CONSOLE;
var launchArgs = new StringBuilder(string.Join(" ", args));
bool bRet = WinProcesses.NativeMethods.CreateProcess bool bRet = WinProcesses.NativeMethods.CreateProcess
( (
null, null,
launchArgs, new StringBuilder(string.Join(" ", args)),
null, null,
null, null,
false, false,
@ -211,10 +201,6 @@ namespace CxbxDebugger
State = RunState.Running; State = RunState.Running;
} }
else
{
throw new Exception($"Failed to launch loader '{launchArgs}'");
}
return bRet; return bRet;
} }
@ -322,7 +308,10 @@ namespace CxbxDebugger
Thread.StartAddress = DebugInfo.lpStartAddress; Thread.StartAddress = DebugInfo.lpStartAddress;
Thread.ThreadBase = DebugInfo.lpThreadLocalBase; Thread.ThreadBase = DebugInfo.lpThreadLocalBase;
Parallel.ForEach(ThreadEvents, Event => Event.OnThreadCreate(Thread)); foreach (IDebuggerThreadEvents Event in ThreadEvents )
{
Event.OnThreadCreate(Thread);
}
} }
private void HandleExitThread(WinDebug.DEBUG_EVENT DebugEvent) private void HandleExitThread(WinDebug.DEBUG_EVENT DebugEvent)
@ -339,7 +328,10 @@ namespace CxbxDebugger
{ {
uint ExitCode = DebugInfo.dwExitCode; uint ExitCode = DebugInfo.dwExitCode;
Parallel.ForEach(ThreadEvents, Event => Event.OnThreadExit(TargetThread, ExitCode)); foreach (IDebuggerThreadEvents Event in ThreadEvents)
{
Event.OnThreadExit(TargetThread, ExitCode);
}
} }
} }
@ -372,9 +364,15 @@ namespace CxbxDebugger
DebugInstance = new DebuggerInstance(Process); DebugInstance = new DebuggerInstance(Process);
RegisterEventInterfaces(DebugInstance); RegisterEventInterfaces(DebugInstance);
Parallel.ForEach(ProcessEvents, Event => Event.OnProcessCreate(Process)); foreach (IDebuggerProcessEvents Event in ProcessEvents)
{
Event.OnProcessCreate(Process);
}
Parallel.ForEach(ThreadEvents, Event => Event.OnThreadCreate(MainThread)); foreach (IDebuggerThreadEvents Event in ThreadEvents)
{
Event.OnThreadCreate(MainThread);
}
var XboxModule = new DebuggerModule(); var XboxModule = new DebuggerModule();
@ -382,7 +380,10 @@ namespace CxbxDebugger
XboxModule.ImageBase = DebugInfo.lpBaseOfImage; XboxModule.ImageBase = DebugInfo.lpBaseOfImage;
XboxModule.Core = true; XboxModule.Core = true;
Parallel.ForEach(ModuleEvents, Event => Event.OnModuleLoaded(XboxModule)); foreach (IDebuggerModuleEvents Event in ModuleEvents)
{
Event.OnModuleLoaded(XboxModule);
}
} }
private void HandleExitProcess(WinDebug.DEBUG_EVENT DebugEvent) private void HandleExitProcess(WinDebug.DEBUG_EVENT DebugEvent)
@ -399,7 +400,10 @@ namespace CxbxDebugger
if (TargetProcess != null) if (TargetProcess != null)
{ {
Parallel.ForEach(ProcessEvents, Event => Event.OnProcessExit(TargetProcess, ExitCode)); foreach (IDebuggerProcessEvents Event in ProcessEvents)
{
Event.OnProcessExit(TargetProcess, ExitCode);
}
} }
} }
@ -417,7 +421,10 @@ namespace CxbxDebugger
Module.Path = ResolveProcessPath(DebugInfo.hFile); Module.Path = ResolveProcessPath(DebugInfo.hFile);
Module.ImageBase = DebugInfo.lpBaseOfDll; Module.ImageBase = DebugInfo.lpBaseOfDll;
Parallel.ForEach(ModuleEvents, Event => Event.OnModuleLoaded(Module)); foreach (IDebuggerModuleEvents Event in ModuleEvents)
{
Event.OnModuleLoaded(Module);
}
} }
private void HandleUnloadDll(WinDebug.DEBUG_EVENT DebugEvent) private void HandleUnloadDll(WinDebug.DEBUG_EVENT DebugEvent)
@ -433,7 +440,10 @@ namespace CxbxDebugger
if (TargetModule != null) if (TargetModule != null)
{ {
Parallel.ForEach(ModuleEvents, Event => Event.OnModuleUnloaded(TargetModule)); foreach (IDebuggerModuleEvents Event in ModuleEvents)
{
Event.OnModuleUnloaded(TargetModule);
}
} }
} }
@ -443,7 +453,10 @@ namespace CxbxDebugger
string debugString = ReadProcessString(DebugInfo.lpDebugStringData, DebugInfo.nDebugStringLength, DebugInfo.fUnicode == 1); string debugString = ReadProcessString(DebugInfo.lpDebugStringData, DebugInfo.nDebugStringLength, DebugInfo.fUnicode == 1);
Parallel.ForEach(OutputEvents, Event => Event.OnDebugOutput(debugString)); foreach(IDebuggerOutputEvents Event in OutputEvents)
{
Event.OnDebugOutput(debugString);
}
} }
private void HandleException(WinDebug.DEBUG_EVENT DebugEvent) private void HandleException(WinDebug.DEBUG_EVENT DebugEvent)
@ -464,28 +477,12 @@ namespace CxbxDebugger
} }
break; break;
case ExceptionCode.PrivilegedInstruction:
{
// Seeing this frequently called in Win10
ContinueStatus = WinDebug.CONTINUE_STATUS.DBG_EXCEPTION_NOT_HANDLED;
}
break;
case ExceptionCode.StatusHandleNotClosable:
{
// Seeing this frequently called in Win10
ContinueStatus = WinDebug.CONTINUE_STATUS.DBG_EXCEPTION_NOT_HANDLED;
}
break;
case (ExceptionCode)DebuggerMessages.ReportType.OVERRIDE_EXCEPTION: case (ExceptionCode)DebuggerMessages.ReportType.OVERRIDE_EXCEPTION:
{ {
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Query = DebuggerMessages.GetExceptionHandledQuery(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Query = DebuggerMessages.GetExceptionHandledQuery(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
bool Handled = false; bool Handled = false;
foreach (IDebuggerExceptionEvents Event in ExceptionEvents) foreach (IDebuggerExceptionEvents Event in ExceptionEvents)
@ -504,7 +501,7 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetHLECacheReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetHLECacheReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
SetupHLECacheProvider(Report.FileName); SetupHLECacheProvider(Report.FileName);
} }
} }
@ -515,7 +512,7 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetKernelPatchReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetKernelPatchReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
KernelSymbolProvider.AddKernelSymbolFromMessage(Report); KernelSymbolProvider.AddKernelSymbolFromMessage(Report);
} }
@ -527,9 +524,12 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetFileOpenedReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetFileOpenedReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
Parallel.ForEach(FileEvents, Event => Event.OnFileOpened(Report)); foreach (IDebuggerFileEvents Event in FileEvents)
{
Event.OnFileOpened(Report);
}
} }
} }
break; break;
@ -539,9 +539,12 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetFileReadReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetFileReadReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
Parallel.ForEach(FileEvents, Event => Event.OnFileRead(Report)); foreach (IDebuggerFileEvents Event in FileEvents)
{
Event.OnFileRead(Report);
}
} }
} }
break; break;
@ -551,9 +554,12 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetFileWriteReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetFileWriteReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
Parallel.ForEach(FileEvents, Event => Event.OnFileWrite(Report)); foreach (IDebuggerFileEvents Event in FileEvents)
{
Event.OnFileWrite(Report);
}
} }
} }
break; break;
@ -563,10 +569,13 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetFileClosedReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetFileClosedReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
if (Report != null) if (Report != null)
{ {
Parallel.ForEach(FileEvents, Event => Event.OnFileClosed(Report)); foreach (IDebuggerFileEvents Event in FileEvents)
{
Event.OnFileClosed(Report);
}
} }
} }
} }
@ -577,23 +586,14 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetDebuggerInitReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetDebuggerInitReport(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
InitParams = Report; InitParams = Report;
Parallel.ForEach(SessionEvents, Event => Event.OnDebugTitleLoaded(InitParams.Title)); foreach (IDebuggerGeneralEvents Event in GeneralEvents)
} {
} Event.OnDebugTitleLoaded(InitParams.Title);
break; }
case (ExceptionCode)DebuggerMessages.ReportType.DEBUGGER_NEW_TARGET:
{
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null)
{
var Report = DebuggerMessages.GetDebuggerNewTargetReport(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation));
Parallel.ForEach(SessionEvents, Event => Event.OnDebugTargetChanged(Report.CommandLine));
} }
} }
break; break;
@ -603,7 +603,7 @@ namespace CxbxDebugger
var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId); var Thread = DebugInstance.MainProcess.FindThread((uint)DebugEvent.dwThreadId);
if (Thread != null) if (Thread != null)
{ {
var Report = DebuggerMessages.GetMSVCThreadName(Thread, new DebuggerMessages.DataProcessor(DebugInfo.ExceptionRecord.ExceptionInformation)); var Report = DebuggerMessages.GetMSVCThreadName(Thread, DebugInfo.ExceptionRecord.ExceptionInformation);
if(Report != null) if(Report != null)
{ {
// Resolve the ThreadId of an invalid ID to the current thread name // Resolve the ThreadId of an invalid ID to the current thread name
@ -618,7 +618,10 @@ namespace CxbxDebugger
// Update the resolved thread name // Update the resolved thread name
ResolvedThread.DebugName = Report.Name; ResolvedThread.DebugName = Report.Name;
Parallel.ForEach(ThreadEvents, Event => Event.OnThreadNamed(Thread)); foreach (IDebuggerThreadEvents Event in ThreadEvents)
{
Event.OnThreadNamed(Thread);
}
} }
} }
} }
@ -636,7 +639,10 @@ namespace CxbxDebugger
bpStall.Reset(); bpStall.Reset();
Parallel.ForEach(ExceptionEvents, Event => Event.OnBreakpoint(Thread, BpAddr, BpCode, FirstChance)); foreach (IDebuggerExceptionEvents Event in ExceptionEvents)
{
Event.OnBreakpoint(Thread, BpAddr, BpCode, FirstChance);
}
bpStall.WaitOne(); bpStall.WaitOne();
} }
@ -663,7 +669,10 @@ namespace CxbxDebugger
WinDebug.DEBUG_EVENT DbgEvt = new WinDebug.DEBUG_EVENT(); WinDebug.DEBUG_EVENT DbgEvt = new WinDebug.DEBUG_EVENT();
ContinueStatus = WinDebug.CONTINUE_STATUS.DBG_CONTINUE; ContinueStatus = WinDebug.CONTINUE_STATUS.DBG_CONTINUE;
Parallel.ForEach(SessionEvents, Event => Event.OnDebugStart()); foreach (IDebuggerGeneralEvents Event in GeneralEvents)
{
Event.OnDebugStart();
}
// Loop until told to stop // Loop until told to stop
while (bContinue == true) while (bContinue == true)
@ -720,7 +729,10 @@ namespace CxbxDebugger
State = RunState.Ended; State = RunState.Ended;
Parallel.ForEach(SessionEvents, Event => Event.OnDebugEnd()); foreach (IDebuggerGeneralEvents Event in GeneralEvents)
{
Event.OnDebugEnd();
}
} }
public DebuggerSymbol ResolveSymbol(uint Address) public DebuggerSymbol ResolveSymbol(uint Address)
@ -740,8 +752,8 @@ namespace CxbxDebugger
public void RegisterEventInterfaces(object EventClass) public void RegisterEventInterfaces(object EventClass)
{ {
IDebuggerSessionEvents SessionListener = EventClass as IDebuggerSessionEvents; IDebuggerGeneralEvents GeneralListener = EventClass as IDebuggerGeneralEvents;
if(SessionListener != null ) SessionEvents.Add(SessionListener); if(GeneralListener != null ) GeneralEvents.Add(GeneralListener);
IDebuggerProcessEvents ProcessListener = EventClass as IDebuggerProcessEvents; IDebuggerProcessEvents ProcessListener = EventClass as IDebuggerProcessEvents;
if (ProcessListener != null) ProcessEvents.Add(ProcessListener); if (ProcessListener != null) ProcessEvents.Add(ProcessListener);

View File

@ -5,12 +5,11 @@ using System;
namespace CxbxDebugger namespace CxbxDebugger
{ {
public interface IDebuggerSessionEvents public interface IDebuggerGeneralEvents
{ {
void OnDebugStart(); void OnDebugStart();
void OnDebugEnd(); void OnDebugEnd();
void OnDebugTitleLoaded(string Title); void OnDebugTitleLoaded(string Title);
void OnDebugTargetChanged(string CommandLine);
} }
public interface IDebuggerProcessEvents public interface IDebuggerProcessEvents

View File

@ -9,20 +9,15 @@ namespace CxbxDebugger
{ {
public enum ReportType : uint public enum ReportType : uint
{ {
HLECACHE_FILE = 0x1000, HLECACHE_FILE = 0x00deed00,
KERNEL_PATCH = 0x00deed01,
FILE_OPENED = 0x00deed02,
FILE_READ = 0x00deed03,
FILE_CLOSED = 0x00deed04,
DEBUGGER_INIT = 0x00deed05,
FILE_WRITE = 0x00deed06,
KERNEL_PATCH = 0x2000, OVERRIDE_EXCEPTION = 0x00ceed01,
FILE_OPENED = 0x3000,
FILE_READ = 0x3001,
FILE_WRITE = 0x3002,
FILE_CLOSED = 0x3003,
DEBUGGER_INIT = 0x4000,
DEBUGGER_NEW_TARGET = 0x4001,
OVERRIDE_EXCEPTION = 0x5000,
// Exception code from https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx // Exception code from https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
MS_VC_EXCEPTION = 0x406D1388, MS_VC_EXCEPTION = 0x406D1388,
@ -34,38 +29,22 @@ namespace CxbxDebugger
WCHAR, WCHAR,
}; };
public class DataProcessor
{
uint[] SourceData;
uint SourceIndex;
public DataProcessor(uint[] Data)
{
SourceData = Data;
SourceIndex = 0;
}
public uint Pop()
{
return SourceData[SourceIndex++];
}
}
public class HLECache public class HLECache
{ {
public string FileName { get; set; } public string FileName { get; set; }
} }
public static HLECache GetHLECacheReport(DebuggerThread Context, DataProcessor Data) public static HLECache GetHLECacheReport(DebuggerThread Context, uint[] Data)
{ {
HLECache Report = new HLECache(); HLECache Report = new HLECache();
var Type = (StringType)Data.Pop(); StringType Type = (StringType)Data[0];
if (Type != StringType.CHAR) if (Type != StringType.CHAR)
throw new Exception("GetHLECacheReport expects a string message"); throw new Exception("GetHLECacheReport expects a string message");
var Length = Data.Pop(); ; uint Length = Data[1];
var MessagePtr = new IntPtr(Data.Pop()); IntPtr MessagePtr = new IntPtr(Data[2]);
Report.FileName = Context.OwningProcess.ReadString(MessagePtr, Length); Report.FileName = Context.OwningProcess.ReadString(MessagePtr, Length);
@ -78,19 +57,20 @@ namespace CxbxDebugger
public IntPtr Address { get; set; } public IntPtr Address { get; set; }
} }
public static KernelPatch GetKernelPatchReport(DebuggerThread Context, DataProcessor Data) public static KernelPatch GetKernelPatchReport(DebuggerThread Context, uint[] Data)
{ {
KernelPatch Report = new KernelPatch(); KernelPatch Report = new KernelPatch();
var Type = (StringType)Data.Pop(); StringType Type = (StringType)Data[0];
if (Type != StringType.CHAR) if (Type != StringType.CHAR)
throw new Exception("GetKernelPatchReport expects a string message"); throw new Exception("GetKernelPatchReport expects a string message");
var Length = Data.Pop(); uint Length = Data[1];
var MessagePtr = new IntPtr(Data.Pop()); IntPtr MessagePtr = new IntPtr(Data[2]);
Report.Name = Context.OwningProcess.ReadString(MessagePtr, Length); Report.Name = Context.OwningProcess.ReadString(MessagePtr, Length);
Report.Address = new IntPtr(Data.Pop()); Report.Address = new IntPtr(Data[3]);
return Report; return Report;
} }
@ -102,21 +82,23 @@ namespace CxbxDebugger
public bool Succeeded { get; set; } public bool Succeeded { get; set; }
} }
public static FileOpened GetFileOpenedReport(DebuggerThread Context, DataProcessor Data) public static FileOpened GetFileOpenedReport(DebuggerThread Context, uint[] Data)
{ {
FileOpened Report = new FileOpened(); FileOpened Report = new FileOpened();
Report.Handle = new IntPtr(Data.Pop()); Report.Handle = new IntPtr(Data[0]);
StringType Type = (StringType)Data[1];
var Type = (StringType)Data.Pop();
if (Type != StringType.WCHAR) if (Type != StringType.WCHAR)
throw new Exception("GetFileOpenedReport expects a widestring message"); throw new Exception("GetFileOpenedReport expects a widestring message");
var Length = Data.Pop(); uint Length = Data[2];
var MessagePtr = new IntPtr(Data.Pop()); IntPtr MessagePtr = new IntPtr(Data[3]);
Report.FileName = Context.OwningProcess.ReadWString(MessagePtr, Length); Report.FileName = Context.OwningProcess.ReadWString(MessagePtr, Length);
Report.Succeeded = Data.Pop() != 0;
Report.Succeeded = Data[4] != 0;
return Report; return Report;
} }
@ -128,13 +110,13 @@ namespace CxbxDebugger
public uint Offset { get; set; } public uint Offset { get; set; }
} }
public static FileRead GetFileReadReport(DebuggerThread Context, DataProcessor Data) public static FileRead GetFileReadReport(DebuggerThread Context, uint[] Data)
{ {
FileRead Report = new FileRead(); FileRead Report = new FileRead();
Report.Handle = new IntPtr(Data.Pop()); Report.Handle = new IntPtr(Data[0]);
Report.Length = Data.Pop(); Report.Length = Data[1];
Report.Offset = Data.Pop(); Report.Offset = Data[2];
return Report; return Report;
} }
@ -146,13 +128,13 @@ namespace CxbxDebugger
public uint Offset { get; set; } public uint Offset { get; set; }
} }
public static FileWrite GetFileWriteReport(DebuggerThread Context, DataProcessor Data) public static FileWrite GetFileWriteReport(DebuggerThread Context, uint[] Data)
{ {
FileWrite Report = new FileWrite(); FileWrite Report = new FileWrite();
Report.Handle = new IntPtr(Data.Pop()); Report.Handle = new IntPtr(Data[0]);
Report.Length = Data.Pop(); Report.Length = Data[1];
Report.Offset = Data.Pop(); Report.Offset = Data[2];
return Report; return Report;
} }
@ -162,20 +144,18 @@ namespace CxbxDebugger
public IntPtr Handle { get; set; } public IntPtr Handle { get; set; }
} }
public static FileClosed GetFileClosedReport(DebuggerThread Context, DataProcessor Data) public static FileClosed GetFileClosedReport(DebuggerThread Context, uint[] Data)
{ {
// TODO: Restructure this library // TODO: Restructure this library
uint InvalidHandle = (uint)VsChromium.Core.Win32.Handles.NativeMethods.INVALID_HANDLE_VALUE; uint InvalidHandle = (uint)VsChromium.Core.Win32.Handles.NativeMethods.INVALID_HANDLE_VALUE;
var Handle = Data.Pop();
// Skip invalid file handles // Skip invalid file handles
if (Handle == InvalidHandle) if (Data[0] == InvalidHandle)
return null; return null;
FileClosed Report = new FileClosed(); FileClosed Report = new FileClosed();
Report.Handle = new IntPtr(Handle); Report.Handle = new IntPtr(Data[0]);
return Report; return Report;
} }
@ -189,78 +169,59 @@ namespace CxbxDebugger
public IntPtr ParameterBase { get; set; } public IntPtr ParameterBase { get; set; }
} }
public static ExceptionHandledQuery GetExceptionHandledQuery(DebuggerThread Context, DataProcessor Data) public static ExceptionHandledQuery GetExceptionHandledQuery(DebuggerThread Context, uint[] Data)
{ {
ExceptionHandledQuery Query = new ExceptionHandledQuery(); ExceptionHandledQuery Query = new ExceptionHandledQuery();
Query.ReponseAddr = new IntPtr(Data.Pop()); Query.ReponseAddr = new IntPtr(Data[0]);
Query.ExceptionAddress = Data.Pop(); Query.ExceptionAddress = Data[1];
Query.ExceptionCode = Data.Pop(); Query.ExceptionCode = Data[2];
Query.ParameterCount = Data.Pop(); Query.ParameterCount = Data[3];
Query.ParameterBase = new IntPtr(Data.Pop()); Query.ParameterBase = new IntPtr(Data[4]);
return Query; return Query;
} }
public class DebuggerInit public class DebuggerInit
{ {
public uint TitleID { get; set; }
public string Title { get; set; } public string Title { get; set; }
} }
public static DebuggerInit GetDebuggerInitReport(DebuggerThread Context, DataProcessor Data) public static DebuggerInit GetDebuggerInitReport(DebuggerThread Context, uint[] Data)
{ {
DebuggerInit Report = new DebuggerInit(); DebuggerInit Report = new DebuggerInit();
StringType Type = (StringType)Data.Pop(); Report.TitleID = Data[0];
StringType Type = (StringType)Data[1];
if (Type != StringType.CHAR) if (Type != StringType.CHAR)
throw new Exception("GetDebuggerInitReport expects a string message"); throw new Exception("GetDebuggerInitReport expects a string message");
uint Length = Data.Pop(); uint Length = Data[2];
IntPtr MessagePtr = new IntPtr(Data.Pop()); IntPtr MessagePtr = new IntPtr(Data[3]);
Report.Title = Context.OwningProcess.ReadString(MessagePtr, Length); Report.Title = Context.OwningProcess.ReadString(MessagePtr, Length);
return Report; return Report;
} }
public class DebuggerNewTarget
{
public string CommandLine { get; set; }
}
public static DebuggerNewTarget GetDebuggerNewTargetReport(DebuggerThread Context, DataProcessor Data)
{
var Report = new DebuggerNewTarget();
StringType Type = (StringType)Data.Pop();
if (Type != StringType.CHAR)
throw new Exception("GetDebuggerInitReport expects a string message");
uint Length = Data.Pop();
IntPtr MessagePtr = new IntPtr(Data.Pop());
Report.CommandLine = Context.OwningProcess.ReadString(MessagePtr, Length);
return Report;
}
public class MSVCThreadName public class MSVCThreadName
{ {
public string Name { get; set; } public string Name { get; set; }
public uint ThreadId { get; set; } public uint ThreadId { get; set; }
} }
public static MSVCThreadName GetMSVCThreadName(DebuggerThread Context, DataProcessor Data) public static MSVCThreadName GetMSVCThreadName(DebuggerThread Context, uint[] Data)
{ {
var Type = Data.Pop(); uint Type = Data[0];
if (Type != 0x1000) if (Type != 0x1000)
return null; return null;
string ReportName = ""; string ReportName = "";
IntPtr MessagePtr = new IntPtr(Data.Pop()); IntPtr MessagePtr = new IntPtr(Data[1]);
if (MessagePtr != IntPtr.Zero) if (MessagePtr != IntPtr.Zero)
{ {
ReportName = Context.OwningProcess.ReadString(MessagePtr); ReportName = Context.OwningProcess.ReadString(MessagePtr);
@ -269,7 +230,7 @@ namespace CxbxDebugger
MSVCThreadName Report = new MSVCThreadName(); MSVCThreadName Report = new MSVCThreadName();
Report.Name = ReportName; Report.Name = ReportName;
Report.ThreadId = Data.Pop(); Report.ThreadId = Data[2];
return Report; return Report;
} }

View File

@ -114,12 +114,6 @@ namespace CxbxDebugger
if (ebp == 0 || ReturnAddr == ebp) if (ebp == 0 || ReturnAddr == ebp)
break; break;
if ((ReturnAddr & 0x80000000) != 0)
break;
if ((ebp & 0x80000000) != 0)
break;
CallstackCache.AddFrame(new DebuggerStackFrame(new IntPtr(ReturnAddr), new IntPtr(ebp))); CallstackCache.AddFrame(new DebuggerStackFrame(new IntPtr(ReturnAddr), new IntPtr(ebp)));
} }
while (CallstackCache.CanCollect); while (CallstackCache.CanCollect);

View File

@ -1,6 +1,6 @@
namespace CxbxDebugger namespace CxbxDebugger
{ {
partial class CxbxDebuggerInstance partial class Form1
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@ -28,21 +28,22 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CxbxDebuggerInstance)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.lbConsole = new System.Windows.Forms.ListBox(); this.lbConsole = new System.Windows.Forms.ListBox();
this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.btnStart = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.btnSuspend = new System.Windows.Forms.ToolStripButton();
this.btnResume = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.cbThreads = new System.Windows.Forms.ToolStripComboBox(); this.cbThreads = new System.Windows.Forms.ToolStripComboBox();
this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel(); this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
this.cbFrames = new System.Windows.Forms.ToolStripComboBox(); this.cbFrames = new System.Windows.Forms.ToolStripComboBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.statusBar = new System.Windows.Forms.StatusStrip();
this.lblStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.tabContainer = new System.Windows.Forms.TabControl(); this.tabContainer = new System.Windows.Forms.TabControl();
this.tabSummary = new System.Windows.Forms.TabPage();
this.linkLabel3 = new System.Windows.Forms.LinkLabel();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.label9 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.tabDisassembly = new System.Windows.Forms.TabPage(); this.tabDisassembly = new System.Windows.Forms.TabPage();
this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.btnToMemory = new System.Windows.Forms.Button(); this.btnToMemory = new System.Windows.Forms.Button();
@ -51,6 +52,7 @@
this.btnGo = new System.Windows.Forms.Button(); this.btnGo = new System.Windows.Forms.Button();
this.label6 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label();
this.cbDisAddr = new System.Windows.Forms.ComboBox(); this.cbDisAddr = new System.Windows.Forms.ComboBox();
this.txDisassembly = new CxbxDebugger.RicherTextBox();
this.tabBreakpoints = new System.Windows.Forms.TabPage(); this.tabBreakpoints = new System.Windows.Forms.TabPage();
this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.splitContainer3 = new System.Windows.Forms.SplitContainer();
this.groupBox4 = new System.Windows.Forms.GroupBox(); this.groupBox4 = new System.Windows.Forms.GroupBox();
@ -110,11 +112,10 @@
this.lbDebug = new System.Windows.Forms.ListBox(); this.lbDebug = new System.Windows.Forms.ListBox();
this.diagSaveMemory = new System.Windows.Forms.SaveFileDialog(); this.diagSaveMemory = new System.Windows.Forms.SaveFileDialog();
this.diagBrowseCT = new System.Windows.Forms.OpenFileDialog(); this.diagBrowseCT = new System.Windows.Forms.OpenFileDialog();
this.txDisassembly = new CxbxDebugger.RicherTextBox();
this.toolStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout();
this.statusBar.SuspendLayout();
this.tabContainer.SuspendLayout(); this.tabContainer.SuspendLayout();
this.tabSummary.SuspendLayout();
this.tabDisassembly.SuspendLayout(); this.tabDisassembly.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel1.SuspendLayout();
@ -157,33 +158,73 @@
// //
this.lbConsole.Dock = System.Windows.Forms.DockStyle.Fill; this.lbConsole.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbConsole.FormattingEnabled = true; this.lbConsole.FormattingEnabled = true;
this.lbConsole.Location = new System.Drawing.Point(3, 271); this.lbConsole.Location = new System.Drawing.Point(3, 231);
this.lbConsole.Name = "lbConsole"; this.lbConsole.Name = "lbConsole";
this.lbConsole.ScrollAlwaysVisible = true; this.lbConsole.ScrollAlwaysVisible = true;
this.lbConsole.Size = new System.Drawing.Size(728, 62); this.lbConsole.Size = new System.Drawing.Size(728, 51);
this.lbConsole.TabIndex = 2; this.lbConsole.TabIndex = 2;
// //
// toolStrip1 // toolStrip1
// //
this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.btnStart,
this.toolStripSeparator1,
this.btnSuspend,
this.btnResume,
this.toolStripSeparator2,
this.toolStripLabel1, this.toolStripLabel1,
this.cbThreads, this.cbThreads,
this.toolStripLabel2, this.toolStripLabel2,
this.cbFrames}); this.cbFrames});
this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0);
this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; this.toolStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
this.toolStrip1.Size = new System.Drawing.Size(734, 25); this.toolStrip1.Size = new System.Drawing.Size(734, 25);
this.toolStrip1.TabIndex = 7; this.toolStrip1.TabIndex = 7;
this.toolStrip1.Text = "toolStrip1"; this.toolStrip1.Text = "toolStrip1";
// //
// btnStart
//
this.btnStart.Image = global::CxbxDebugger.Properties.Resources.run;
this.btnStart.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(51, 22);
this.btnStart.Text = "Start";
this.btnStart.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// btnSuspend
//
this.btnSuspend.Image = global::CxbxDebugger.Properties.Resources.pause;
this.btnSuspend.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnSuspend.Name = "btnSuspend";
this.btnSuspend.Size = new System.Drawing.Size(72, 22);
this.btnSuspend.Text = "Suspend";
this.btnSuspend.Click += new System.EventHandler(this.toolStripButton2_Click);
//
// btnResume
//
this.btnResume.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.btnResume.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnResume.Name = "btnResume";
this.btnResume.Size = new System.Drawing.Size(53, 22);
this.btnResume.Text = "Resume";
this.btnResume.Click += new System.EventHandler(this.toolStripButton3_Click);
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// toolStripLabel1 // toolStripLabel1
// //
this.toolStripLabel1.Name = "toolStripLabel1"; this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(46, 22); this.toolStripLabel1.Size = new System.Drawing.Size(47, 22);
this.toolStripLabel1.Text = "Thread:"; this.toolStripLabel1.Text = "Thread:";
// //
// cbThreads // cbThreads
@ -203,28 +244,45 @@
// //
this.cbFrames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbFrames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFrames.Name = "cbFrames"; this.cbFrames.Name = "cbFrames";
this.cbFrames.Size = new System.Drawing.Size(135, 25); this.cbFrames.Size = new System.Drawing.Size(200, 25);
this.cbFrames.SelectedIndexChanged += new System.EventHandler(this.cbFrames_SelectedIndexChanged); this.cbFrames.SelectedIndexChanged += new System.EventHandler(this.cbFrames_SelectedIndexChanged);
// //
// tableLayoutPanel3 // tableLayoutPanel3
// //
this.tableLayoutPanel3.ColumnCount = 1; this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.statusBar, 0, 2);
this.tableLayoutPanel3.Controls.Add(this.tabContainer, 0, 0); this.tableLayoutPanel3.Controls.Add(this.tabContainer, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.lbConsole, 0, 1); this.tableLayoutPanel3.Controls.Add(this.lbConsole, 0, 1);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 25); this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 25);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 2; this.tableLayoutPanel3.RowCount = 3;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 80F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(734, 336); this.tableLayoutPanel3.Size = new System.Drawing.Size(734, 306);
this.tableLayoutPanel3.TabIndex = 9; this.tableLayoutPanel3.TabIndex = 9;
// //
// statusBar
//
this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.statusBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblStatus});
this.statusBar.Location = new System.Drawing.Point(0, 285);
this.statusBar.Name = "statusBar";
this.statusBar.Size = new System.Drawing.Size(734, 21);
this.statusBar.TabIndex = 10;
this.statusBar.Text = "statusStrip1";
//
// lblStatus
//
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(39, 16);
this.lblStatus.Text = "Ready";
//
// tabContainer // tabContainer
// //
this.tabContainer.Controls.Add(this.tabSummary);
this.tabContainer.Controls.Add(this.tabDisassembly); this.tabContainer.Controls.Add(this.tabDisassembly);
this.tabContainer.Controls.Add(this.tabBreakpoints); this.tabContainer.Controls.Add(this.tabBreakpoints);
this.tabContainer.Controls.Add(this.tabWatch); this.tabContainer.Controls.Add(this.tabWatch);
@ -236,82 +294,16 @@
this.tabContainer.Multiline = true; this.tabContainer.Multiline = true;
this.tabContainer.Name = "tabContainer"; this.tabContainer.Name = "tabContainer";
this.tabContainer.SelectedIndex = 0; this.tabContainer.SelectedIndex = 0;
this.tabContainer.Size = new System.Drawing.Size(728, 262); this.tabContainer.Size = new System.Drawing.Size(728, 222);
this.tabContainer.TabIndex = 3; this.tabContainer.TabIndex = 3;
// //
// tabSummary
//
this.tabSummary.Controls.Add(this.linkLabel3);
this.tabSummary.Controls.Add(this.linkLabel2);
this.tabSummary.Controls.Add(this.linkLabel1);
this.tabSummary.Controls.Add(this.label9);
this.tabSummary.Controls.Add(this.label7);
this.tabSummary.Location = new System.Drawing.Point(4, 22);
this.tabSummary.Name = "tabSummary";
this.tabSummary.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3);
this.tabSummary.Size = new System.Drawing.Size(654, 318);
this.tabSummary.TabIndex = 6;
this.tabSummary.Text = "Summary";
this.tabSummary.UseVisualStyleBackColor = true;
//
// linkLabel3
//
this.linkLabel3.AutoSize = true;
this.linkLabel3.Location = new System.Drawing.Point(11, 112);
this.linkLabel3.Name = "linkLabel3";
this.linkLabel3.Size = new System.Drawing.Size(89, 13);
this.linkLabel3.TabIndex = 5;
this.linkLabel3.TabStop = true;
this.linkLabel3.Text = "View disassembly";
this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
//
// linkLabel2
//
this.linkLabel2.AutoSize = true;
this.linkLabel2.Location = new System.Drawing.Point(11, 85);
this.linkLabel2.Name = "linkLabel2";
this.linkLabel2.Size = new System.Drawing.Size(69, 13);
this.linkLabel2.TabIndex = 4;
this.linkLabel2.TabStop = true;
this.linkLabel2.Text = "View memory";
this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(11, 60);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(95, 13);
this.linkLabel1.TabIndex = 3;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "View file resources";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(9, 35);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(268, 13);
this.label9.TabIndex = 1;
this.label9.Text = "To get started, select Debug->Start from the main menu";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(11, 6);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(155, 13);
this.label7.TabIndex = 0;
this.label7.Text = "Welcome to the cxbx-debugger";
//
// tabDisassembly // tabDisassembly
// //
this.tabDisassembly.Controls.Add(this.splitContainer2); this.tabDisassembly.Controls.Add(this.splitContainer2);
this.tabDisassembly.Location = new System.Drawing.Point(4, 22); this.tabDisassembly.Location = new System.Drawing.Point(4, 22);
this.tabDisassembly.Name = "tabDisassembly"; this.tabDisassembly.Name = "tabDisassembly";
this.tabDisassembly.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabDisassembly.Padding = new System.Windows.Forms.Padding(3);
this.tabDisassembly.Size = new System.Drawing.Size(654, 318); this.tabDisassembly.Size = new System.Drawing.Size(720, 196);
this.tabDisassembly.TabIndex = 0; this.tabDisassembly.TabIndex = 0;
this.tabDisassembly.Text = "Disassembly"; this.tabDisassembly.Text = "Disassembly";
this.tabDisassembly.UseVisualStyleBackColor = true; this.tabDisassembly.UseVisualStyleBackColor = true;
@ -337,14 +329,14 @@
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.txDisassembly); this.splitContainer2.Panel2.Controls.Add(this.txDisassembly);
this.splitContainer2.Size = new System.Drawing.Size(648, 312); this.splitContainer2.Size = new System.Drawing.Size(714, 190);
this.splitContainer2.SplitterDistance = 34; this.splitContainer2.SplitterDistance = 34;
this.splitContainer2.TabIndex = 2; this.splitContainer2.TabIndex = 2;
// //
// btnToMemory // btnToMemory
// //
this.btnToMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnToMemory.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnToMemory.Location = new System.Drawing.Point(386, 3); this.btnToMemory.Location = new System.Drawing.Point(452, 3);
this.btnToMemory.Name = "btnToMemory"; this.btnToMemory.Name = "btnToMemory";
this.btnToMemory.Size = new System.Drawing.Size(119, 23); this.btnToMemory.Size = new System.Drawing.Size(119, 23);
this.btnToMemory.TabIndex = 4; this.btnToMemory.TabIndex = 4;
@ -355,7 +347,7 @@
// btnNext // btnNext
// //
this.btnNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnNext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnNext.Location = new System.Drawing.Point(581, 3); this.btnNext.Location = new System.Drawing.Point(647, 3);
this.btnNext.Name = "btnNext"; this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(64, 23); this.btnNext.Size = new System.Drawing.Size(64, 23);
this.btnNext.TabIndex = 3; this.btnNext.TabIndex = 3;
@ -366,7 +358,7 @@
// btnPrev // btnPrev
// //
this.btnPrev.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnPrev.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnPrev.Location = new System.Drawing.Point(512, 3); this.btnPrev.Location = new System.Drawing.Point(577, 3);
this.btnPrev.Name = "btnPrev"; this.btnPrev.Name = "btnPrev";
this.btnPrev.Size = new System.Drawing.Size(64, 23); this.btnPrev.Size = new System.Drawing.Size(64, 23);
this.btnPrev.TabIndex = 2; this.btnPrev.TabIndex = 2;
@ -377,7 +369,7 @@
// btnGo // btnGo
// //
this.btnGo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnGo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnGo.Location = new System.Drawing.Point(261, 3); this.btnGo.Location = new System.Drawing.Point(327, 3);
this.btnGo.Name = "btnGo"; this.btnGo.Name = "btnGo";
this.btnGo.Size = new System.Drawing.Size(119, 23); this.btnGo.Size = new System.Drawing.Size(119, 23);
this.btnGo.TabIndex = 1; this.btnGo.TabIndex = 1;
@ -401,18 +393,33 @@
this.cbDisAddr.FormattingEnabled = true; this.cbDisAddr.FormattingEnabled = true;
this.cbDisAddr.Location = new System.Drawing.Point(132, 5); this.cbDisAddr.Location = new System.Drawing.Point(132, 5);
this.cbDisAddr.Name = "cbDisAddr"; this.cbDisAddr.Name = "cbDisAddr";
this.cbDisAddr.Size = new System.Drawing.Size(124, 21); this.cbDisAddr.Size = new System.Drawing.Size(189, 21);
this.cbDisAddr.TabIndex = 0; this.cbDisAddr.TabIndex = 0;
this.cbDisAddr.SelectedIndexChanged += new System.EventHandler(this.cbDisAddr_SelectedIndexChanged); this.cbDisAddr.SelectedIndexChanged += new System.EventHandler(this.cbDisAddr_SelectedIndexChanged);
this.cbDisAddr.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBox1_KeyDown); this.cbDisAddr.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBox1_KeyDown);
// //
// txDisassembly
//
this.txDisassembly.BackColor = System.Drawing.SystemColors.Window;
this.txDisassembly.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.txDisassembly.Cursor = System.Windows.Forms.Cursors.Default;
this.txDisassembly.Dock = System.Windows.Forms.DockStyle.Fill;
this.txDisassembly.Font = new System.Drawing.Font("Lucida Console", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txDisassembly.Location = new System.Drawing.Point(0, 0);
this.txDisassembly.Name = "txDisassembly";
this.txDisassembly.ReadOnly = true;
this.txDisassembly.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical;
this.txDisassembly.Size = new System.Drawing.Size(714, 152);
this.txDisassembly.TabIndex = 1;
this.txDisassembly.Text = "";
//
// tabBreakpoints // tabBreakpoints
// //
this.tabBreakpoints.Controls.Add(this.splitContainer3); this.tabBreakpoints.Controls.Add(this.splitContainer3);
this.tabBreakpoints.Location = new System.Drawing.Point(4, 22); this.tabBreakpoints.Location = new System.Drawing.Point(4, 22);
this.tabBreakpoints.Name = "tabBreakpoints"; this.tabBreakpoints.Name = "tabBreakpoints";
this.tabBreakpoints.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabBreakpoints.Padding = new System.Windows.Forms.Padding(3);
this.tabBreakpoints.Size = new System.Drawing.Size(654, 318); this.tabBreakpoints.Size = new System.Drawing.Size(720, 196);
this.tabBreakpoints.TabIndex = 1; this.tabBreakpoints.TabIndex = 1;
this.tabBreakpoints.Text = "Breakpoints"; this.tabBreakpoints.Text = "Breakpoints";
this.tabBreakpoints.UseVisualStyleBackColor = true; this.tabBreakpoints.UseVisualStyleBackColor = true;
@ -431,8 +438,8 @@
// splitContainer3.Panel2 // splitContainer3.Panel2
// //
this.splitContainer3.Panel2.Controls.Add(this.clbBreakpoints); this.splitContainer3.Panel2.Controls.Add(this.clbBreakpoints);
this.splitContainer3.Size = new System.Drawing.Size(648, 312); this.splitContainer3.Size = new System.Drawing.Size(714, 190);
this.splitContainer3.SplitterDistance = 214; this.splitContainer3.SplitterDistance = 237;
this.splitContainer3.TabIndex = 5; this.splitContainer3.TabIndex = 5;
// //
// groupBox4 // groupBox4
@ -444,7 +451,7 @@
this.groupBox4.Controls.Add(this.cbBreakpointCxbx); this.groupBox4.Controls.Add(this.cbBreakpointCxbx);
this.groupBox4.Location = new System.Drawing.Point(2, 112); this.groupBox4.Location = new System.Drawing.Point(2, 112);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(210, 196); this.groupBox4.Size = new System.Drawing.Size(233, 75);
this.groupBox4.TabIndex = 5; this.groupBox4.TabIndex = 5;
this.groupBox4.TabStop = false; this.groupBox4.TabStop = false;
this.groupBox4.Text = "Interrupts"; this.groupBox4.Text = "Interrupts";
@ -482,7 +489,7 @@
this.groupBox1.Controls.Add(this.tbFilter); this.groupBox1.Controls.Add(this.tbFilter);
this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(211, 106); this.groupBox1.Size = new System.Drawing.Size(234, 106);
this.groupBox1.TabIndex = 4; this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "File Watch"; this.groupBox1.Text = "File Watch";
@ -495,7 +502,7 @@
this.cbAction.FormattingEnabled = true; this.cbAction.FormattingEnabled = true;
this.cbAction.Location = new System.Drawing.Point(89, 45); this.cbAction.Location = new System.Drawing.Point(89, 45);
this.cbAction.Name = "cbAction"; this.cbAction.Name = "cbAction";
this.cbAction.Size = new System.Drawing.Size(115, 21); this.cbAction.Size = new System.Drawing.Size(139, 21);
this.cbAction.TabIndex = 6; this.cbAction.TabIndex = 6;
// //
// label5 // label5
@ -522,7 +529,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnAddFileBp.Location = new System.Drawing.Point(89, 72); this.btnAddFileBp.Location = new System.Drawing.Point(89, 72);
this.btnAddFileBp.Name = "btnAddFileBp"; this.btnAddFileBp.Name = "btnAddFileBp";
this.btnAddFileBp.Size = new System.Drawing.Size(115, 23); this.btnAddFileBp.Size = new System.Drawing.Size(139, 23);
this.btnAddFileBp.TabIndex = 4; this.btnAddFileBp.TabIndex = 4;
this.btnAddFileBp.Text = "Add"; this.btnAddFileBp.Text = "Add";
this.btnAddFileBp.UseVisualStyleBackColor = true; this.btnAddFileBp.UseVisualStyleBackColor = true;
@ -534,7 +541,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.tbFilter.Location = new System.Drawing.Point(89, 19); this.tbFilter.Location = new System.Drawing.Point(89, 19);
this.tbFilter.Name = "tbFilter"; this.tbFilter.Name = "tbFilter";
this.tbFilter.Size = new System.Drawing.Size(115, 20); this.tbFilter.Size = new System.Drawing.Size(139, 20);
this.tbFilter.TabIndex = 2; this.tbFilter.TabIndex = 2;
// //
// clbBreakpoints // clbBreakpoints
@ -543,7 +550,7 @@
this.clbBreakpoints.FormattingEnabled = true; this.clbBreakpoints.FormattingEnabled = true;
this.clbBreakpoints.Location = new System.Drawing.Point(0, 0); this.clbBreakpoints.Location = new System.Drawing.Point(0, 0);
this.clbBreakpoints.Name = "clbBreakpoints"; this.clbBreakpoints.Name = "clbBreakpoints";
this.clbBreakpoints.Size = new System.Drawing.Size(430, 312); this.clbBreakpoints.Size = new System.Drawing.Size(473, 190);
this.clbBreakpoints.TabIndex = 0; this.clbBreakpoints.TabIndex = 0;
this.clbBreakpoints.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbBreakpoints_ItemCheck); this.clbBreakpoints.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbBreakpoints_ItemCheck);
this.clbBreakpoints.KeyDown += new System.Windows.Forms.KeyEventHandler(this.clbBreakpoints_KeyDown); this.clbBreakpoints.KeyDown += new System.Windows.Forms.KeyEventHandler(this.clbBreakpoints_KeyDown);
@ -553,8 +560,8 @@
this.tabWatch.Controls.Add(this.splitContainer1); this.tabWatch.Controls.Add(this.splitContainer1);
this.tabWatch.Location = new System.Drawing.Point(4, 22); this.tabWatch.Location = new System.Drawing.Point(4, 22);
this.tabWatch.Name = "tabWatch"; this.tabWatch.Name = "tabWatch";
this.tabWatch.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabWatch.Padding = new System.Windows.Forms.Padding(3);
this.tabWatch.Size = new System.Drawing.Size(654, 318); this.tabWatch.Size = new System.Drawing.Size(720, 196);
this.tabWatch.TabIndex = 2; this.tabWatch.TabIndex = 2;
this.tabWatch.Text = "File Watcher"; this.tabWatch.Text = "File Watcher";
this.tabWatch.UseVisualStyleBackColor = true; this.tabWatch.UseVisualStyleBackColor = true;
@ -572,8 +579,8 @@
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.lbOpenedFiles); this.splitContainer1.Panel2.Controls.Add(this.lbOpenedFiles);
this.splitContainer1.Size = new System.Drawing.Size(648, 312); this.splitContainer1.Size = new System.Drawing.Size(714, 190);
this.splitContainer1.SplitterDistance = 453; this.splitContainer1.SplitterDistance = 501;
this.splitContainer1.TabIndex = 3; this.splitContainer1.TabIndex = 3;
// //
// lvFileDetails // lvFileDetails
@ -588,7 +595,7 @@
this.lvFileDetails.Location = new System.Drawing.Point(0, 0); this.lvFileDetails.Location = new System.Drawing.Point(0, 0);
this.lvFileDetails.MultiSelect = false; this.lvFileDetails.MultiSelect = false;
this.lvFileDetails.Name = "lvFileDetails"; this.lvFileDetails.Name = "lvFileDetails";
this.lvFileDetails.Size = new System.Drawing.Size(453, 312); this.lvFileDetails.Size = new System.Drawing.Size(501, 190);
this.lvFileDetails.TabIndex = 2; this.lvFileDetails.TabIndex = 2;
this.lvFileDetails.UseCompatibleStateImageBehavior = false; this.lvFileDetails.UseCompatibleStateImageBehavior = false;
this.lvFileDetails.View = System.Windows.Forms.View.Details; this.lvFileDetails.View = System.Windows.Forms.View.Details;
@ -614,7 +621,7 @@
this.lbOpenedFiles.FormattingEnabled = true; this.lbOpenedFiles.FormattingEnabled = true;
this.lbOpenedFiles.Location = new System.Drawing.Point(0, 0); this.lbOpenedFiles.Location = new System.Drawing.Point(0, 0);
this.lbOpenedFiles.Name = "lbOpenedFiles"; this.lbOpenedFiles.Name = "lbOpenedFiles";
this.lbOpenedFiles.Size = new System.Drawing.Size(191, 312); this.lbOpenedFiles.Size = new System.Drawing.Size(209, 190);
this.lbOpenedFiles.TabIndex = 0; this.lbOpenedFiles.TabIndex = 0;
// //
// tabMemory // tabMemory
@ -622,8 +629,8 @@
this.tabMemory.Controls.Add(this.splitContainer4); this.tabMemory.Controls.Add(this.splitContainer4);
this.tabMemory.Location = new System.Drawing.Point(4, 22); this.tabMemory.Location = new System.Drawing.Point(4, 22);
this.tabMemory.Name = "tabMemory"; this.tabMemory.Name = "tabMemory";
this.tabMemory.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabMemory.Padding = new System.Windows.Forms.Padding(3);
this.tabMemory.Size = new System.Drawing.Size(720, 236); this.tabMemory.Size = new System.Drawing.Size(720, 196);
this.tabMemory.TabIndex = 4; this.tabMemory.TabIndex = 4;
this.tabMemory.Text = "Memory Viewer"; this.tabMemory.Text = "Memory Viewer";
this.tabMemory.UseVisualStyleBackColor = true; this.tabMemory.UseVisualStyleBackColor = true;
@ -641,8 +648,8 @@
// splitContainer4.Panel2 // splitContainer4.Panel2
// //
this.splitContainer4.Panel2.Controls.Add(this.groupBox2); this.splitContainer4.Panel2.Controls.Add(this.groupBox2);
this.splitContainer4.Size = new System.Drawing.Size(714, 230); this.splitContainer4.Size = new System.Drawing.Size(714, 190);
this.splitContainer4.SplitterDistance = 375; this.splitContainer4.SplitterDistance = 376;
this.splitContainer4.TabIndex = 7; this.splitContainer4.TabIndex = 7;
// //
// txMemoryDump // txMemoryDump
@ -656,7 +663,7 @@
this.txMemoryDump.Name = "txMemoryDump"; this.txMemoryDump.Name = "txMemoryDump";
this.txMemoryDump.ReadOnly = true; this.txMemoryDump.ReadOnly = true;
this.txMemoryDump.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.txMemoryDump.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txMemoryDump.Size = new System.Drawing.Size(375, 230); this.txMemoryDump.Size = new System.Drawing.Size(376, 190);
this.txMemoryDump.TabIndex = 0; this.txMemoryDump.TabIndex = 0;
// //
// groupBox2 // groupBox2
@ -674,7 +681,7 @@
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill; this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(0, 0); this.groupBox2.Location = new System.Drawing.Point(0, 0);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(335, 230); this.groupBox2.Size = new System.Drawing.Size(334, 190);
this.groupBox2.TabIndex = 8; this.groupBox2.TabIndex = 8;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "View or Dump Memory"; this.groupBox2.Text = "View or Dump Memory";
@ -683,9 +690,9 @@
// //
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.textBox2.Location = new System.Drawing.Point(183, 129); this.textBox2.Location = new System.Drawing.Point(213, 129);
this.textBox2.Name = "textBox2"; this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(146, 20); this.textBox2.Size = new System.Drawing.Size(115, 20);
this.textBox2.TabIndex = 10; this.textBox2.TabIndex = 10;
// //
// label8 // label8
@ -699,11 +706,13 @@
// //
// cbDataFormat // cbDataFormat
// //
this.cbDataFormat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbDataFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cbDataFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbDataFormat.FormattingEnabled = true; this.cbDataFormat.FormattingEnabled = true;
this.cbDataFormat.Location = new System.Drawing.Point(88, 130); this.cbDataFormat.Location = new System.Drawing.Point(88, 130);
this.cbDataFormat.Name = "cbDataFormat"; this.cbDataFormat.Name = "cbDataFormat";
this.cbDataFormat.Size = new System.Drawing.Size(89, 21); this.cbDataFormat.Size = new System.Drawing.Size(119, 21);
this.cbDataFormat.TabIndex = 8; this.cbDataFormat.TabIndex = 8;
this.cbDataFormat.SelectionChangeCommitted += new System.EventHandler(this.cbDataFormat_SelectionChangeCommitted); this.cbDataFormat.SelectionChangeCommitted += new System.EventHandler(this.cbDataFormat_SelectionChangeCommitted);
// //
@ -713,7 +722,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnAddWatch.Location = new System.Drawing.Point(88, 157); this.btnAddWatch.Location = new System.Drawing.Point(88, 157);
this.btnAddWatch.Name = "btnAddWatch"; this.btnAddWatch.Name = "btnAddWatch";
this.btnAddWatch.Size = new System.Drawing.Size(241, 23); this.btnAddWatch.Size = new System.Drawing.Size(240, 23);
this.btnAddWatch.TabIndex = 7; this.btnAddWatch.TabIndex = 7;
this.btnAddWatch.Text = "Add to Editor..."; this.btnAddWatch.Text = "Add to Editor...";
this.btnAddWatch.UseVisualStyleBackColor = true; this.btnAddWatch.UseVisualStyleBackColor = true;
@ -734,7 +743,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnDumpMemory.Location = new System.Drawing.Point(88, 100); this.btnDumpMemory.Location = new System.Drawing.Point(88, 100);
this.btnDumpMemory.Name = "btnDumpMemory"; this.btnDumpMemory.Name = "btnDumpMemory";
this.btnDumpMemory.Size = new System.Drawing.Size(241, 23); this.btnDumpMemory.Size = new System.Drawing.Size(240, 23);
this.btnDumpMemory.TabIndex = 6; this.btnDumpMemory.TabIndex = 6;
this.btnDumpMemory.Text = "Dump Memory to File..."; this.btnDumpMemory.Text = "Dump Memory to File...";
this.btnDumpMemory.UseVisualStyleBackColor = true; this.btnDumpMemory.UseVisualStyleBackColor = true;
@ -746,7 +755,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txAddress.Location = new System.Drawing.Point(88, 18); this.txAddress.Location = new System.Drawing.Point(88, 18);
this.txAddress.Name = "txAddress"; this.txAddress.Name = "txAddress";
this.txAddress.Size = new System.Drawing.Size(241, 20); this.txAddress.Size = new System.Drawing.Size(240, 20);
this.txAddress.TabIndex = 1; this.txAddress.TabIndex = 1;
// //
// label2 // label2
@ -764,7 +773,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.btnReadMemory.Location = new System.Drawing.Point(88, 71); this.btnReadMemory.Location = new System.Drawing.Point(88, 71);
this.btnReadMemory.Name = "btnReadMemory"; this.btnReadMemory.Name = "btnReadMemory";
this.btnReadMemory.Size = new System.Drawing.Size(241, 23); this.btnReadMemory.Size = new System.Drawing.Size(240, 23);
this.btnReadMemory.TabIndex = 2; this.btnReadMemory.TabIndex = 2;
this.btnReadMemory.Text = "Read Memory"; this.btnReadMemory.Text = "Read Memory";
this.btnReadMemory.UseVisualStyleBackColor = true; this.btnReadMemory.UseVisualStyleBackColor = true;
@ -776,7 +785,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txSize.Location = new System.Drawing.Point(88, 45); this.txSize.Location = new System.Drawing.Point(88, 45);
this.txSize.Name = "txSize"; this.txSize.Name = "txSize";
this.txSize.Size = new System.Drawing.Size(241, 20); this.txSize.Size = new System.Drawing.Size(240, 20);
this.txSize.TabIndex = 3; this.txSize.TabIndex = 3;
this.txSize.Text = "32"; this.txSize.Text = "32";
// //
@ -785,8 +794,8 @@
this.tabTweaks.Controls.Add(this.tabCEContainer); this.tabTweaks.Controls.Add(this.tabCEContainer);
this.tabTweaks.Location = new System.Drawing.Point(4, 22); this.tabTweaks.Location = new System.Drawing.Point(4, 22);
this.tabTweaks.Name = "tabTweaks"; this.tabTweaks.Name = "tabTweaks";
this.tabTweaks.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabTweaks.Padding = new System.Windows.Forms.Padding(3);
this.tabTweaks.Size = new System.Drawing.Size(654, 318); this.tabTweaks.Size = new System.Drawing.Size(720, 196);
this.tabTweaks.TabIndex = 5; this.tabTweaks.TabIndex = 5;
this.tabTweaks.Text = "Memory Editor"; this.tabTweaks.Text = "Memory Editor";
this.tabTweaks.UseVisualStyleBackColor = true; this.tabTweaks.UseVisualStyleBackColor = true;
@ -799,7 +808,7 @@
this.tabCEContainer.Location = new System.Drawing.Point(3, 3); this.tabCEContainer.Location = new System.Drawing.Point(3, 3);
this.tabCEContainer.Name = "tabCEContainer"; this.tabCEContainer.Name = "tabCEContainer";
this.tabCEContainer.SelectedIndex = 0; this.tabCEContainer.SelectedIndex = 0;
this.tabCEContainer.Size = new System.Drawing.Size(648, 312); this.tabCEContainer.Size = new System.Drawing.Size(714, 190);
this.tabCEContainer.TabIndex = 5; this.tabCEContainer.TabIndex = 5;
// //
// tabSubData // tabSubData
@ -807,8 +816,8 @@
this.tabSubData.Controls.Add(this.splitContainer6); this.tabSubData.Controls.Add(this.splitContainer6);
this.tabSubData.Location = new System.Drawing.Point(4, 22); this.tabSubData.Location = new System.Drawing.Point(4, 22);
this.tabSubData.Name = "tabSubData"; this.tabSubData.Name = "tabSubData";
this.tabSubData.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabSubData.Padding = new System.Windows.Forms.Padding(3);
this.tabSubData.Size = new System.Drawing.Size(640, 286); this.tabSubData.Size = new System.Drawing.Size(706, 164);
this.tabSubData.TabIndex = 0; this.tabSubData.TabIndex = 0;
this.tabSubData.Text = "Edit Data"; this.tabSubData.Text = "Edit Data";
this.tabSubData.UseVisualStyleBackColor = true; this.tabSubData.UseVisualStyleBackColor = true;
@ -830,8 +839,8 @@
// splitContainer6.Panel2 // splitContainer6.Panel2
// //
this.splitContainer6.Panel2.Controls.Add(this.lvCEMemory); this.splitContainer6.Panel2.Controls.Add(this.lvCEMemory);
this.splitContainer6.Size = new System.Drawing.Size(634, 280); this.splitContainer6.Size = new System.Drawing.Size(700, 158);
this.splitContainer6.SplitterDistance = 57; this.splitContainer6.SplitterDistance = 34;
this.splitContainer6.TabIndex = 2; this.splitContainer6.TabIndex = 2;
// //
// btnRefresh // btnRefresh
@ -857,7 +866,7 @@
// btnApply // btnApply
// //
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnApply.Location = new System.Drawing.Point(508, 3); this.btnApply.Location = new System.Drawing.Point(574, 3);
this.btnApply.Name = "btnApply"; this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(123, 23); this.btnApply.Size = new System.Drawing.Size(123, 23);
this.btnApply.TabIndex = 4; this.btnApply.TabIndex = 4;
@ -871,7 +880,7 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.txNewValue.Location = new System.Drawing.Point(261, 5); this.txNewValue.Location = new System.Drawing.Point(261, 5);
this.txNewValue.Name = "txNewValue"; this.txNewValue.Name = "txNewValue";
this.txNewValue.Size = new System.Drawing.Size(240, 20); this.txNewValue.Size = new System.Drawing.Size(307, 20);
this.txNewValue.TabIndex = 2; this.txNewValue.TabIndex = 2;
// //
// lvCEMemory // lvCEMemory
@ -887,7 +896,7 @@
this.lvCEMemory.Location = new System.Drawing.Point(0, 0); this.lvCEMemory.Location = new System.Drawing.Point(0, 0);
this.lvCEMemory.MultiSelect = false; this.lvCEMemory.MultiSelect = false;
this.lvCEMemory.Name = "lvCEMemory"; this.lvCEMemory.Name = "lvCEMemory";
this.lvCEMemory.Size = new System.Drawing.Size(634, 219); this.lvCEMemory.Size = new System.Drawing.Size(700, 120);
this.lvCEMemory.TabIndex = 1; this.lvCEMemory.TabIndex = 1;
this.lvCEMemory.UseCompatibleStateImageBehavior = false; this.lvCEMemory.UseCompatibleStateImageBehavior = false;
this.lvCEMemory.View = System.Windows.Forms.View.Details; this.lvCEMemory.View = System.Windows.Forms.View.Details;
@ -917,8 +926,8 @@
this.tabSubAssembly.Controls.Add(this.lvCEAssembly); this.tabSubAssembly.Controls.Add(this.lvCEAssembly);
this.tabSubAssembly.Location = new System.Drawing.Point(4, 22); this.tabSubAssembly.Location = new System.Drawing.Point(4, 22);
this.tabSubAssembly.Name = "tabSubAssembly"; this.tabSubAssembly.Name = "tabSubAssembly";
this.tabSubAssembly.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabSubAssembly.Padding = new System.Windows.Forms.Padding(3);
this.tabSubAssembly.Size = new System.Drawing.Size(640, 286); this.tabSubAssembly.Size = new System.Drawing.Size(706, 164);
this.tabSubAssembly.TabIndex = 1; this.tabSubAssembly.TabIndex = 1;
this.tabSubAssembly.Text = "Edit Assembly"; this.tabSubAssembly.Text = "Edit Assembly";
this.tabSubAssembly.UseVisualStyleBackColor = true; this.tabSubAssembly.UseVisualStyleBackColor = true;
@ -936,7 +945,7 @@
this.lvCEAssembly.Location = new System.Drawing.Point(3, 3); this.lvCEAssembly.Location = new System.Drawing.Point(3, 3);
this.lvCEAssembly.MultiSelect = false; this.lvCEAssembly.MultiSelect = false;
this.lvCEAssembly.Name = "lvCEAssembly"; this.lvCEAssembly.Name = "lvCEAssembly";
this.lvCEAssembly.Size = new System.Drawing.Size(635, 280); this.lvCEAssembly.Size = new System.Drawing.Size(700, 158);
this.lvCEAssembly.TabIndex = 4; this.lvCEAssembly.TabIndex = 4;
this.lvCEAssembly.UseCompatibleStateImageBehavior = false; this.lvCEAssembly.UseCompatibleStateImageBehavior = false;
this.lvCEAssembly.View = System.Windows.Forms.View.Details; this.lvCEAssembly.View = System.Windows.Forms.View.Details;
@ -966,8 +975,8 @@
this.tabOutput.Controls.Add(this.splitContainer5); this.tabOutput.Controls.Add(this.splitContainer5);
this.tabOutput.Location = new System.Drawing.Point(4, 22); this.tabOutput.Location = new System.Drawing.Point(4, 22);
this.tabOutput.Name = "tabOutput"; this.tabOutput.Name = "tabOutput";
this.tabOutput.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); this.tabOutput.Padding = new System.Windows.Forms.Padding(3);
this.tabOutput.Size = new System.Drawing.Size(654, 318); this.tabOutput.Size = new System.Drawing.Size(720, 196);
this.tabOutput.TabIndex = 3; this.tabOutput.TabIndex = 3;
this.tabOutput.Text = "Debug Output"; this.tabOutput.Text = "Debug Output";
this.tabOutput.UseVisualStyleBackColor = true; this.tabOutput.UseVisualStyleBackColor = true;
@ -989,7 +998,7 @@
// splitContainer5.Panel2 // splitContainer5.Panel2
// //
this.splitContainer5.Panel2.Controls.Add(this.lbDebug); this.splitContainer5.Panel2.Controls.Add(this.lbDebug);
this.splitContainer5.Size = new System.Drawing.Size(648, 312); this.splitContainer5.Size = new System.Drawing.Size(714, 190);
this.splitContainer5.SplitterDistance = 26; this.splitContainer5.SplitterDistance = 26;
this.splitContainer5.TabIndex = 6; this.splitContainer5.TabIndex = 6;
// //
@ -1000,7 +1009,7 @@
this.txFilter.Enabled = false; this.txFilter.Enabled = false;
this.txFilter.Location = new System.Drawing.Point(41, 3); this.txFilter.Location = new System.Drawing.Point(41, 3);
this.txFilter.Name = "txFilter"; this.txFilter.Name = "txFilter";
this.txFilter.Size = new System.Drawing.Size(604, 20); this.txFilter.Size = new System.Drawing.Size(670, 20);
this.txFilter.TabIndex = 4; this.txFilter.TabIndex = 4;
// //
// label3 // label3
@ -1020,7 +1029,7 @@
this.lbDebug.Location = new System.Drawing.Point(0, 0); this.lbDebug.Location = new System.Drawing.Point(0, 0);
this.lbDebug.Name = "lbDebug"; this.lbDebug.Name = "lbDebug";
this.lbDebug.ScrollAlwaysVisible = true; this.lbDebug.ScrollAlwaysVisible = true;
this.lbDebug.Size = new System.Drawing.Size(648, 282); this.lbDebug.Size = new System.Drawing.Size(714, 160);
this.lbDebug.TabIndex = 3; this.lbDebug.TabIndex = 3;
// //
// diagSaveMemory // diagSaveMemory
@ -1033,40 +1042,24 @@
this.diagBrowseCT.Filter = "Cheat Engine Tables (*.CT)|*.ct"; this.diagBrowseCT.Filter = "Cheat Engine Tables (*.CT)|*.ct";
this.diagBrowseCT.Title = "Load cheat table"; this.diagBrowseCT.Title = "Load cheat table";
// //
// txDisassembly // Form1
// //
this.txDisassembly.BackColor = System.Drawing.SystemColors.Window; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.txDisassembly.BorderStyle = System.Windows.Forms.BorderStyle.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.txDisassembly.Cursor = System.Windows.Forms.Cursors.Default; this.ClientSize = new System.Drawing.Size(734, 331);
this.txDisassembly.Dock = System.Windows.Forms.DockStyle.Fill;
this.txDisassembly.Font = new System.Drawing.Font("Lucida Console", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txDisassembly.Location = new System.Drawing.Point(0, 0);
this.txDisassembly.Name = "txDisassembly";
this.txDisassembly.ReadOnly = true;
this.txDisassembly.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedVertical;
this.txDisassembly.Size = new System.Drawing.Size(648, 274);
this.txDisassembly.TabIndex = 1;
this.txDisassembly.Text = "";
//
// CxbxDebuggerInstance
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(734, 361);
this.ControlBox = false;
this.Controls.Add(this.tableLayoutPanel3); this.Controls.Add(this.tableLayoutPanel3);
this.Controls.Add(this.toolStrip1); this.Controls.Add(this.toolStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MinimizeBox = false; this.Name = "Form1";
this.Name = "CxbxDebuggerInstance"; this.Text = "Cxbx-Reloaded Debugger";
this.Text = "unnamed instance";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed);
this.toolStrip1.ResumeLayout(false); this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout(); this.toolStrip1.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.statusBar.ResumeLayout(false);
this.statusBar.PerformLayout();
this.tabContainer.ResumeLayout(false); this.tabContainer.ResumeLayout(false);
this.tabSummary.ResumeLayout(false);
this.tabSummary.PerformLayout();
this.tabDisassembly.ResumeLayout(false); this.tabDisassembly.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout(); this.splitContainer2.Panel1.PerformLayout();
@ -1118,6 +1111,11 @@
#endregion #endregion
private System.Windows.Forms.ListBox lbConsole; private System.Windows.Forms.ListBox lbConsole;
private System.Windows.Forms.ToolStrip toolStrip1; private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton btnStart;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton btnSuspend;
private System.Windows.Forms.ToolStripButton btnResume;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripComboBox cbThreads; private System.Windows.Forms.ToolStripComboBox cbThreads;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.TabControl tabContainer; private System.Windows.Forms.TabControl tabContainer;
@ -1137,6 +1135,8 @@
private System.Windows.Forms.TextBox txAddress; private System.Windows.Forms.TextBox txAddress;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox tbFilter; private System.Windows.Forms.TextBox tbFilter;
private System.Windows.Forms.StatusStrip statusBar;
private System.Windows.Forms.ToolStripStatusLabel lblStatus;
private RicherTextBox txDisassembly; private RicherTextBox txDisassembly;
private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
@ -1192,11 +1192,6 @@
private System.Windows.Forms.Button btnLoadCT; private System.Windows.Forms.Button btnLoadCT;
private System.Windows.Forms.Button btnRefresh; private System.Windows.Forms.Button btnRefresh;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TabPage tabSummary;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.LinkLabel linkLabel3;
private System.Windows.Forms.LinkLabel linkLabel2;
private System.Windows.Forms.LinkLabel linkLabel1;
} }
} }

View File

@ -8,15 +8,15 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using cs_x86; using cs_x86;
using System.Runtime.InteropServices;
namespace CxbxDebugger namespace CxbxDebugger
{ {
public partial class CxbxDebuggerInstance : Form, IDebugWindow public partial class Form1 : Form
{ {
Thread DebuggerWorkerThread; Thread DebuggerWorkerThread;
Debugger DebuggerInst; Debugger DebuggerInst;
string[] StartupArgs; string[] CachedArgs;
string CachedTitle = "";
bool SuspendedOnBp = false; bool SuspendedOnBp = false;
DebuggerFormEvents DebugEvents; DebuggerFormEvents DebugEvents;
@ -29,45 +29,33 @@ namespace CxbxDebugger
DebugOutputManager debugStrMan; DebugOutputManager debugStrMan;
PatchManager patchMan; PatchManager patchMan;
IDebugContainerWindow DebugContainer
{
get
{
return MdiParent as IDebugContainerWindow;
}
}
DebugStateInfo StateInfo = new DebugStateInfo();
private void SetDebugState(DebugState State, string Detail = "")
{
DebugContainer.ReportStatus(this, State, Detail);
StateInfo.State = State;
StateInfo.Detail = Detail;
}
List<DebuggerMessages.FileOpened> FileHandles = new List<DebuggerMessages.FileOpened>(); List<DebuggerMessages.FileOpened> FileHandles = new List<DebuggerMessages.FileOpened>();
public CxbxDebuggerInstance(Form Owner, string[] args) public Form1()
{ {
InitializeComponent(); InitializeComponent();
MdiParent = Owner; // TODO: Cleanup arg handling
string[] args = Environment.GetCommandLineArgs();
#if !DEBUG
// Arguments are expected before the Form is created // Arguments are expected before the Form is created
if (args.Length < 2) if (args.Length < 2)
{ {
throw new Exception("Incorrect usage"); throw new Exception("Incorrect usage");
} }
#endif
StartupArgs = args; var items = new List<string>(args.Length - 1);
for (int i = 1; i < args.Length; ++i)
{
items.Add(args[i]);
}
CachedArgs = items.ToArray();
DebugEvents = new DebuggerFormEvents(this); DebugEvents = new DebuggerFormEvents(this);
SetDebugState(DebugState.Unknown); SetDebugProcessActive(false);
txDisassembly.InlineLinkClicked += OnDisassemblyNavigation; txDisassembly.InlineLinkClicked += OnDisassemblyNavigation;
@ -89,8 +77,6 @@ namespace CxbxDebugger
fileWatchMan = new FileWatchManager(clbBreakpoints); fileWatchMan = new FileWatchManager(clbBreakpoints);
debugStrMan = new DebugOutputManager(lbDebug); debugStrMan = new DebugOutputManager(lbDebug);
patchMan = new PatchManager(); patchMan = new PatchManager();
CreateDebuggerOnce();
} }
private void OnDisassemblyNavigation(object sender, InlineLinkClickedEventArgs e) private void OnDisassemblyNavigation(object sender, InlineLinkClickedEventArgs e)
@ -100,85 +86,38 @@ namespace CxbxDebugger
ShowDisassemblyAt(e.Link); ShowDisassemblyAt(e.Link);
} }
private void CreateDebuggerOnce() private void StartDebugging()
{ {
if (DebuggerInst == null) bool Create = false;
if (DebuggerWorkerThread == null)
{
// First launch
Create = true;
}
else if (DebuggerWorkerThread.ThreadState == ThreadState.Stopped)
{
// Further launches
Create = true;
}
if (Create)
{ {
// Create debugger instance // Create debugger instance
DebuggerInst = new Debugger(StartupArgs); DebuggerInst = new Debugger(CachedArgs);
DebuggerInst.RegisterEventInterfaces(DebugEvents); DebuggerInst.RegisterEventInterfaces(DebugEvents);
DebuggerInst.RegisterEventInterfaces(patchMan); DebuggerInst.RegisterEventInterfaces(patchMan);
var TargetXbeName = ValidateXbeTargetName(DebuggerInst.TargetPath);
var TargetXbeValid = true;
if (string.IsNullOrEmpty(TargetXbeName))
{
TargetXbeName = "<unknown>";
TargetXbeValid = false;
}
if (InvokeRequired)
{
// Set form title based on this new process
Invoke(new MethodInvoker(delegate ()
{
Text = TargetXbeName;
}));
}
else
{
Text = TargetXbeName;
}
if (TargetXbeValid)
{
SetDebugState(DebugState.Idle, $"{TargetXbeName} is waiting to start");
}
}
}
private string ValidateXbeTargetName(string XbePath)
{
var XbeName = Path.GetFileName(XbePath);
if (File.Exists(XbePath))
{
return XbeName;
}
// Cxbx CLI will pass through the path as a list of parameters, "dir;name"
if (XbeName.StartsWith(";"))
{
var CleanedXbePath = XbePath.Remove(XbePath.Length - XbeName.Length, 1);
if (File.Exists(CleanedXbePath))
{
return XbeName.Substring(1);
}
}
return null;
}
private void StartDebugging()
{
if (GetSessionState() == SessionState.Inactive)
{
// Setup new debugger thread // Setup new debugger thread
DebuggerWorkerThread = new Thread(x => DebuggerWorkerThread = new Thread(x =>
{ {
CreateDebuggerOnce();
if (DebuggerInst.Launch()) if (DebuggerInst.Launch())
{ {
DebuggerInst.RunThreaded(); DebuggerInst.RunThreaded();
} }
}); });
var ProcessName = Path.GetFileName(DebuggerInst.TargetPath); DebuggerWorkerThread.Name = "CxbxDebugger";
DebuggerWorkerThread.Name = $"DebuggerFor_{ProcessName}";
DebuggerWorkerThread.Start(); DebuggerWorkerThread.Start();
} }
} }
@ -207,7 +146,7 @@ namespace CxbxDebugger
if (IsMainThread) if (IsMainThread)
PrefixStr = "> "; PrefixStr = "> ";
var DisplayStr = $"{PrefixStr}[{(uint)Thread.Handle}]"; string DisplayStr = string.Format("{0}[{1}] ", PrefixStr, (uint)Thread.Handle);
// Resolve thread name // Resolve thread name
@ -267,7 +206,7 @@ namespace CxbxDebugger
private void DebugLog(string Message) private void DebugLog(string Message)
{ {
var MessageStamped = $"[{DateTime.Now.ToLongTimeString()}] {Message}"; string MessageStamped = string.Format("[{0}] {1}", DateTime.Now.ToLongTimeString(), Message);
if (InvokeRequired) if (InvokeRequired)
{ {
@ -296,11 +235,11 @@ namespace CxbxDebugger
{ {
case FileEventType.Read: case FileEventType.Read:
case FileEventType.Write: case FileEventType.Write:
string text = $"{Event.Length} bytes"; string text = string.Format("{0} bytes", Event.Length.ToString());
if (Event.Offset != uint.MaxValue) if (Event.Offset != uint.MaxValue)
{ {
text += $" from offset {Event.Offset}"; text += string.Format(" from offset {0}", Event.Offset);
} }
lvi.SubItems.Add(text); lvi.SubItems.Add(text);
@ -341,7 +280,7 @@ namespace CxbxDebugger
{ {
Invoke(new MethodInvoker(delegate () Invoke(new MethodInvoker(delegate ()
{ {
Suspend(DebugState.Breakpoint, "Hit file event"); Suspend("file open");
})); }));
} }
} }
@ -351,10 +290,12 @@ namespace CxbxDebugger
{ {
Invoke(new MethodInvoker(delegate () Invoke(new MethodInvoker(delegate ()
{ {
DebugContainer.ReportGameTitle(Title); CachedTitle = Title;
Text = string.Format("{0} - Cxbx-Reloaded Debugger", CachedTitle);
// This is done too late - modules are already loaded // This is done too late - modules are already loaded
//LoadCheatTable($"{Title}.ct"); //LoadCheatTable(string.Format("{0}.ct", CachedTitle));
})); }));
} }
@ -388,7 +329,7 @@ namespace CxbxDebugger
else else
{ {
string module_name = Path.GetFileName(Module.Path); string module_name = Path.GetFileName(Module.Path);
Suspend(DebugState.Breakpoint, string.Format("Breakpoint hit in {0} at 0x{1:x}", module_name, Address)); Suspend(string.Format("Breakpoint hit in {0} at 0x{1:x}", module_name, Address));
// Forces a refresh at the breakpoint address (not the callstack trace) // Forces a refresh at the breakpoint address (not the callstack trace)
DumpDisassembly(Address); DumpDisassembly(Address);
@ -403,21 +344,35 @@ namespace CxbxDebugger
{ {
Invoke(new MethodInvoker(delegate () Invoke(new MethodInvoker(delegate ()
{ {
SetDebugState(Active ? DebugState.Running : DebugState.Terminated); // Disable when active
btnStart.Enabled = !Active;
// Enable when active
btnSuspend.Enabled = Active;
btnResume.Enabled = Active;
lblStatus.Text = (Active ? "Running" : "Inactive");
})); }));
} }
else else
{ {
SetDebugState(Active ? DebugState.Running : DebugState.Terminated); // Disable when active
btnStart.Enabled = !Active;
// Enable when active
btnSuspend.Enabled = Active;
btnResume.Enabled = Active;
lblStatus.Text = (Active ? "Running" : "Inactive");
} }
} }
private void btnClearLog_Click(object sender, EventArgs e) private void btnClearLog_Click(object sender, EventArgs e)
{ {
//lbConsole.Items.Clear(); lbConsole.Items.Clear();
} }
class DebuggerFormEvents : IDebuggerSessionEvents, class DebuggerFormEvents : IDebuggerGeneralEvents,
IDebuggerProcessEvents, IDebuggerProcessEvents,
IDebuggerModuleEvents, IDebuggerModuleEvents,
IDebuggerThreadEvents, IDebuggerThreadEvents,
@ -425,12 +380,9 @@ namespace CxbxDebugger
IDebuggerExceptionEvents, IDebuggerExceptionEvents,
IDebuggerFileEvents IDebuggerFileEvents
{ {
CxbxDebuggerInstance frm; Form1 frm;
public DebuggerFormEvents(Form1 main)
public DebuggerFormEvents(CxbxDebuggerInstance main)
{ {
frm = main; frm = main;
} }
@ -445,8 +397,8 @@ namespace CxbxDebugger
{ {
int remainingThreads = Process.Threads.Count; int remainingThreads = Process.Threads.Count;
frm.DebugLog($"Process exited {Process.ProcessID} ({NtStatus.PrettyPrint(ExitCode)})"); frm.DebugLog(string.Format("Process exited {0} ({1})", Process.ProcessID, NtStatus.PrettyPrint(ExitCode)));
frm.DebugLog($"{remainingThreads} child thread(s) remain open"); frm.DebugLog(string.Format("{0} child thread(s) remain open", remainingThreads));
frm.DebugModules.Clear(); frm.DebugModules.Clear();
@ -474,70 +426,36 @@ namespace CxbxDebugger
public void OnDebugTitleLoaded(string Title) public void OnDebugTitleLoaded(string Title)
{ {
frm.DebugLog($"Loaded title \"{Title}\""); frm.DebugLog(string.Format("Loaded title \"{0}\"", Title));
frm.DebugTitle(Title); frm.DebugTitle(Title);
} }
// https://stackoverflow.com/a/749653
public static string[] CommandLineToArgs(string commandLine)
{
int argc;
var argv = VsChromium.Core.Win32.Processes.NativeMethods.CommandLineToArgvW(commandLine, out argc);
if (argv == IntPtr.Zero)
throw new System.ComponentModel.Win32Exception();
try
{
var args = new string[argc];
for (var i = 0; i < args.Length; i++)
{
var p = Marshal.ReadIntPtr(argv, i * IntPtr.Size);
args[i] = Marshal.PtrToStringUni(p);
}
return args;
}
finally
{
Marshal.FreeHGlobal(argv);
}
}
public void OnDebugTargetChanged(string CommandLine)
{
frm.DebugLog($"New debug session started - {CommandLine}");
frm.Invoke(new MethodInvoker(delegate ()
{
frm.DebugContainer.AddDebugSession(CommandLineToArgs(CommandLine), true);
}));
}
public void OnThreadCreate(DebuggerThread Thread) public void OnThreadCreate(DebuggerThread Thread)
{ {
frm.DebugLog($"Thread created {Thread.ThreadID}"); frm.DebugLog(string.Format("Thread created {0}", Thread.ThreadID));
frm.DebugThreads.Add(Thread); frm.DebugThreads.Add(Thread);
} }
public void OnThreadExit(DebuggerThread Thread, uint ExitCode) public void OnThreadExit(DebuggerThread Thread, uint ExitCode)
{ {
frm.DebugLog($"Thread exited {Thread.ThreadID} ({NtStatus.PrettyPrint(ExitCode)})"); frm.DebugLog(string.Format("Thread exited {0} ({1})", Thread.ThreadID, NtStatus.PrettyPrint(ExitCode)));
frm.DebugThreads.Remove(Thread); frm.DebugThreads.Remove(Thread);
} }
public void OnThreadNamed(DebuggerThread Thread) public void OnThreadNamed(DebuggerThread Thread)
{ {
frm.DebugLog($"Thread {Thread.ThreadID} named {Thread.DebugName}"); frm.DebugLog(string.Format("Thread {0} named {1}", Thread.ThreadID, Thread.DebugName));
} }
public void OnModuleLoaded(DebuggerModule Module) public void OnModuleLoaded(DebuggerModule Module)
{ {
frm.DebugLog($"Loaded module \"{Module.Path}\""); frm.DebugLog(string.Format("Loaded module \"{0}\"", Module.Path));
frm.DebugModules.Add(Module); frm.DebugModules.Add(Module);
} }
public void OnModuleUnloaded(DebuggerModule Module) public void OnModuleUnloaded(DebuggerModule Module)
{ {
frm.DebugLog($"Unloaded module \"{Module.Path}\""); frm.DebugLog(string.Format("Unloaded module \"{0}\"", Module.Path));
frm.DebugModules.Remove(Module); frm.DebugModules.Remove(Module);
} }
@ -557,7 +475,7 @@ namespace CxbxDebugger
} }
// TODO Include GetLastError string // TODO Include GetLastError string
var ExceptionMessage = string.Format("Access violation thrown at 0x{0:X8} ({1})", Address, ProcessName); string ExceptionMessage = string.Format("Access violation thrown at 0x{0:X8} ({1})", Address, ProcessName);
ExceptionMessage += string.Format("\n\nException code {0:X8}", Code); ExceptionMessage += string.Format("\n\nException code {0:X8}", Code);
@ -587,13 +505,13 @@ namespace CxbxDebugger
if (Info.Succeeded) if (Info.Succeeded)
{ {
frm.FileHandles.Add(Info); frm.FileHandles.Add(Info);
frm.DebugLog($"Opened file: \"{Info.FileName}\""); frm.DebugLog(string.Format("Opened file: \"{0}\"", Info.FileName));
frm.DebugFileEvent(FileEvents.Opened(Info.FileName)); frm.DebugFileEvent(FileEvents.Opened(Info.FileName));
} }
else else
{ {
frm.DebugLog($"Opened file FAILED: \"{Info.FileName}\""); frm.DebugLog(string.Format("Opened file FAILED: \"{0}\"", Info.FileName));
frm.DebugFileEvent(FileEvents.OpenedFailed(Info.FileName)); frm.DebugFileEvent(FileEvents.OpenedFailed(Info.FileName));
} }
@ -604,7 +522,7 @@ namespace CxbxDebugger
var Found = frm.FileHandles.Find(FileInfo => FileInfo.Handle == Info.Handle); var Found = frm.FileHandles.Find(FileInfo => FileInfo.Handle == Info.Handle);
if (Found != null) if (Found != null)
{ {
frm.DebugLog($"Reading {Info.Length} byte(s) from: {Found.FileName}"); frm.DebugLog(string.Format("Reading {0} byte(s) from: {1}", Info.Length, Found.FileName));
frm.DebugFileEvent(FileEvents.Read(Found.FileName, Info.Length, Info.Offset)); frm.DebugFileEvent(FileEvents.Read(Found.FileName, Info.Length, Info.Offset));
} }
} }
@ -614,7 +532,7 @@ namespace CxbxDebugger
var Found = frm.FileHandles.Find(FileInfo => FileInfo.Handle == Info.Handle); var Found = frm.FileHandles.Find(FileInfo => FileInfo.Handle == Info.Handle);
if (Found != null) if (Found != null)
{ {
frm.DebugLog($"Writing {Info.Length} byte(s) to: {Found.FileName}"); frm.DebugLog(string.Format("Writing {0} byte(s) to: {1}", Info.Length, Found.FileName));
frm.DebugFileEvent(FileEvents.Write(Found.FileName, Info.Length, Info.Offset)); frm.DebugFileEvent(FileEvents.Write(Found.FileName, Info.Length, Info.Offset));
} }
} }
@ -628,12 +546,17 @@ namespace CxbxDebugger
frm.DebugFileEvent(FileEvents.Closed(Found.FileName)); frm.DebugFileEvent(FileEvents.Closed(Found.FileName));
frm.DebugLog($"Closed file: \"{Found.FileName}\""); frm.DebugLog(string.Format("Closed file: \"{0}\"", Found.FileName));
} }
} }
} }
private void Suspend(DebugState State, string Detail) private void toolStripButton1_Click(object sender, EventArgs e)
{
StartDebugging();
}
private void Suspend(string Reason)
{ {
if (DebuggerInst != null) if (DebuggerInst != null)
{ {
@ -649,7 +572,7 @@ namespace CxbxDebugger
PopulateThreadList(cbThreads, null); PopulateThreadList(cbThreads, null);
} }
SetDebugState(State, Detail); lblStatus.Text = string.Format("Suspended ({0})", Reason);
cbThreads.Enabled = true; cbThreads.Enabled = true;
cbFrames.Enabled = true; cbFrames.Enabled = true;
@ -670,12 +593,22 @@ namespace CxbxDebugger
} }
} }
SetDebugState(DebugState.Running); lblStatus.Text = "Running";
cbThreads.Enabled = false; cbThreads.Enabled = false;
cbFrames.Enabled = false; cbFrames.Enabled = false;
} }
private void toolStripButton2_Click(object sender, EventArgs e)
{
Suspend("manually triggered");
}
private void toolStripButton3_Click(object sender, EventArgs e)
{
Resume();
}
struct CallstackInfo struct CallstackInfo
{ {
public uint InstructionPointer; public uint InstructionPointer;
@ -808,8 +741,8 @@ namespace CxbxDebugger
{ {
if (EP != 0) if (EP != 0)
{ {
var LinkName = string.Format("{0} +{1:x}", Name, Address - EP); string LinkName = string.Format("{0} +{1:x}", Name, Address - EP);
var Link = string.Format("0x{0:x8}", Address); string Link = string.Format("0x{0:x8}", Address);
tb.InsertLink(LinkName, Link); tb.InsertLink(LinkName, Link);
} }
@ -900,6 +833,9 @@ namespace CxbxDebugger
private void btnDumpMemory_Click(object sender, EventArgs e) private void btnDumpMemory_Click(object sender, EventArgs e)
{ {
if (DebuggerInst == null)
return;
if (diagSaveMemory.ShowDialog() == DialogResult.OK) if (diagSaveMemory.ShowDialog() == DialogResult.OK)
{ {
byte[] data = ReadMemory(); byte[] data = ReadMemory();
@ -1038,6 +974,17 @@ namespace CxbxDebugger
fileWatchMan.SetEnabled(e.Index, e.NewValue == CheckState.Checked); fileWatchMan.SetEnabled(e.Index, e.NewValue == CheckState.Checked);
} }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.F5)
{
StartDebugging();
return true;
}
return false;
}
private void HandleDisasmGo() private void HandleDisasmGo()
{ {
uint addr = 0; uint addr = 0;
@ -1098,7 +1045,7 @@ namespace CxbxDebugger
{ {
var li = lvCEMemory.Items.Add(string.Format("{0} 0x{1:x}", DataPatch.Module, DataPatch.Offset)); var li = lvCEMemory.Items.Add(string.Format("{0} 0x{1:x}", DataPatch.Module, DataPatch.Offset));
li.SubItems.Add(DataPatch.Name); li.SubItems.Add(DataPatch.Name);
li.SubItems.Add($"{DataPatch.Patched.Length} byte(s)"); li.SubItems.Add(string.Format("{0} byte(s)", DataPatch.Patched.Length));
if (MainProcess != null) if (MainProcess != null)
{ {
li.SubItems.Add(patchMan.Read(MainProcess, DataPatch)); li.SubItems.Add(patchMan.Read(MainProcess, DataPatch));
@ -1157,7 +1104,7 @@ namespace CxbxDebugger
if (File.Exists(filename)) if (File.Exists(filename))
{ {
DebugLog($"Attempting to load \"{filename}\""); DebugLog(string.Format("Attempting to load \"{0}\"", filename));
CheatEngine.CheatTable ct_data = CheatEngine.CheatTableReader.FromFile(filename); CheatEngine.CheatTable ct_data = CheatEngine.CheatTableReader.FromFile(filename);
if (ct_data != null) if (ct_data != null)
@ -1194,8 +1141,8 @@ namespace CxbxDebugger
patchMan.Assembly.Add(DataPatch); patchMan.Assembly.Add(DataPatch);
} }
DebugLog($"Loaded {ct_data.CodeEntires.Count} auto-assembler entries"); DebugLog(string.Format("Loaded {0} auto-assembler entries", ct_data.CodeEntires.Count));
DebugLog($"Loaded {ct_data.CheatEntries.Count} cheat entries"); DebugLog(string.Format("Loaded {0} cheat entries", ct_data.CheatEntries.Count));
RefreshPatches(); RefreshPatches();
} }
@ -1204,7 +1151,7 @@ namespace CxbxDebugger
private void button5_Click(object sender, EventArgs e) private void button5_Click(object sender, EventArgs e)
{ {
var PatchType = (PatchType)cbDataFormat.SelectedIndex; PatchType PatchType = (PatchType)cbDataFormat.SelectedIndex;
int PatchSize = PatchManager.PatchTypeLength(PatchType); int PatchSize = PatchManager.PatchTypeLength(PatchType);
if (PatchSize == 0) if (PatchSize == 0)
@ -1222,7 +1169,7 @@ namespace CxbxDebugger
Patch DataPatch = new Patch(); Patch DataPatch = new Patch();
DataPatch.DisplayAs = PatchType; DataPatch.DisplayAs = PatchType;
DataPatch.Name = $"Patched {PatchType}"; DataPatch.Name = string.Format("Patched {0}", PatchType);
DataPatch.Module = ""; DataPatch.Module = "";
DataPatch.Offset = addr; DataPatch.Offset = addr;
@ -1287,60 +1234,5 @@ namespace CxbxDebugger
} }
} }
} }
public SessionState GetSessionState()
{
if (DebuggerWorkerThread == null)
{
return SessionState.Inactive;
}
else if (DebuggerWorkerThread.ThreadState == ThreadState.Stopped)
{
return SessionState.Ended;
}
return SessionState.Running;
}
public void StartSession()
{
if (GetSessionState() == SessionState.Inactive)
{
StartDebugging();
}
}
public void SuspendSession()
{
if (GetSessionState() == SessionState.Running)
{
Suspend(DebugState.Suspended, "By user");
}
}
public void ResumeSession()
{
Resume();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
tabContainer.SelectedTab = tabWatch;
}
private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
tabContainer.SelectedTab = tabMemory;
}
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
tabContainer.SelectedTab = tabDisassembly;
}
public DebugStateInfo GetDebugStateInfo()
{
return StateInfo;
}
} }
} }

View File

@ -118,13 +118,16 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>534, 17</value> <value>17, 17</value>
</metadata>
<metadata name="statusBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>122, 17</value>
</metadata> </metadata>
<metadata name="diagSaveMemory.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="diagSaveMemory.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value> <value>238, 17</value>
</metadata> </metadata>
<metadata name="diagBrowseCT.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="diagBrowseCT.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>357, 17</value> <value>384, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@ -1,51 +0,0 @@
// Written by x1nixmzeng for the Cxbx-Reloaded project
//
namespace CxbxDebugger
{
public enum SessionState
{
Inactive,
Running,
Ended,
}
public enum DebugState
{
Unknown,
Idle,
Suspended,
Breakpoint,
Running,
Terminated,
}
public struct DebugStateInfo
{
public DebugState State;
public string Detail;
}
public interface IDebugWindow
{
void StartSession();
void SuspendSession();
void ResumeSession();
SessionState GetSessionState();
DebugStateInfo GetDebugStateInfo();
}
public interface IDebugContainerWindow
{
void AddDebugSession(string[] Arguments, bool StartAutomatically);
void ReportGameTitle(string GameTitle);
void ReportStatus(IDebugWindow Window, DebugState Status, string Detail);
}
}

View File

@ -18,7 +18,6 @@ namespace CxbxDebugger
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
string[] args = Environment.GetCommandLineArgs(); string[] args = Environment.GetCommandLineArgs();
#if !DEBUG
if( args.Length == 1 ) if( args.Length == 1 )
{ {
// TODO: Valid usage message // TODO: Valid usage message
@ -26,9 +25,8 @@ namespace CxbxDebugger
Application.Exit(); Application.Exit();
} }
else else
#endif
{ {
Application.Run(new CxbxDebuggerMain(args)); Application.Run(new Form1());
} }
} }
} }

View File

@ -345,10 +345,6 @@ namespace CxbxDebugger
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
StatusHandleNotClosable = 0xC0000235,
/// <summary>
///
/// </summary>
GuardPageViolation = 0x80000001, GuardPageViolation = 0x80000001,
/// <summary> /// <summary>
/// ///

View File

@ -2,25 +2,10 @@
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include "Version.h" #include "Version.h"
#include "CxbxVersion.h" #include "CxbxVersion.h"
#include <string>
/*! version string dependent on trace flag */ /*! version string dependent on trace flag */
#ifndef _DEBUG_TRACE #ifndef _DEBUG_TRACE
const char* CxbxVersionStr = _GIT_VERSION " (" __DATE__ ")"; const char* CxbxVersionStr = _GIT_VERSION " (" __DATE__ ")";
const char *CxbxrHashBuild = _GIT_VERSION;
#else #else
const char* CxbxVersionStr = _GIT_VERSION "-Trace (" __DATE__ ")"; const char* CxbxVersionStr = _GIT_VERSION "-Trace (" __DATE__ ")";
const char *CxbxrHashBuild = _GIT_VERSION "-Trace";
#endif #endif
static constexpr const char *GitVersionStr = _GIT_VERSION;
static constexpr size_t GitVersionLength = std::char_traits<char>::length(GitVersionStr);
static_assert(GitVersionLength < GitVersionMaxLength);
const char *const GetGitVersionStr() {
return GitVersionStr;
}
const size_t GetGitVersionLength() {
return GitVersionLength;
}

View File

@ -1,10 +1,5 @@
#pragma once #pragma once
extern const char* CxbxVersionStr; #include "version.h"
extern const char *CxbxrHashBuild;
// Note: GitVersionMaxLength should be large enough to accomodate the longest git version string we can practically expect to have. This is necessary extern const char* CxbxVersionStr;
// to avoid possible mismatches in the string length which can happen if the user mixes different cxbxr versions
inline constexpr size_t GitVersionMaxLength = 80;
const char *const GetGitVersionStr();
const size_t GetGitVersionLength();

View File

@ -1,102 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of Cxbx-Reloaded.
// *
// * Cxbx-Reloaded is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2017-2019 Patrick van Logchem <pvanlogchem@gmail.com>
// *
// * All rights reserved
// *
// ******************************************************************
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <Windows.h> // For PAGE_READWRITE, PAGE_EXECUTE_READWRITE, and PAGE_NOACCESS
#include "util/std_extend.hpp"
#include "AddressRanges.h"
// NOTE: Cannot be use in the header file.
// For InitialMemoryProtection field only. Memory page protection usage, for use by VirtualAlloc
// Shortend symbol aliasses for memory page protection
#define PROT_UNH 0 // UNHANDLED
#define PROT_RW PAGE_READWRITE
#define PROT_XRW PAGE_EXECUTE_READWRITE
#define PROT_NAC PAGE_NOACCESS
const _XboxAddressRanges XboxAddressRanges[] = {
#ifdef DEBUG
#define RANGE_ENTRY(START, END, SIZE, PROT, FLAGS, COMMENT) { START, END, SIZE, PROT, FLAGS, COMMENT }
#else
#define RANGE_ENTRY(START, END, SIZE, PROT, FLAGS, COMMENT) { START, SIZE, PROT, FLAGS }
#endif
// See https://xboxdevwiki.net/Memory
// and https://xboxdevwiki.net/Boot_Process#Paging
// Entry : Start , End , Size , Protect , RangeFlags , Comment
RANGE_ENTRY(USER_ADDRESS1_BASE, USER_ADDRESS1_END, USER_ADDRESS1_SIZE, PROT_XRW, SYSTEM_ALL | MAY_FAIL, "MemLowVirtual (General Xbox type) lower 64 MiB Optional (already reserved via virtual_memory_placeholder)"),
RANGE_ENTRY(USER_ADDRESS2_BASE, USER_ADDRESS2_END, USER_ADDRESS2_SIZE, PROT_XRW, SYSTEM_128MB | MAY_FAIL, "MemLowVirtual (Chihiro / DevKit) ^ + upper 64 MiB"),
RANGE_ENTRY(PHYSICAL_MAP1_BASE, PHYSICAL_MAP1_END, PHYSICAL_MAP1_SIZE, PROT_UNH, SYSTEM_ALL , "MemPhysical (General Xbox type) lower 64 MiB"),
RANGE_ENTRY(PHYSICAL_MAP2_BASE, PHYSICAL_MAP2_END, PHYSICAL_MAP2_SIZE, PROT_UNH, SYSTEM_128MB , "MemPhysical (Chihiro / DevKit) ^ + upper 64 MiB"),
RANGE_ENTRY(DEVKIT_MEMORY_BASE, DEVKIT_MEMORY_END, DEVKIT_MEMORY_SIZE, PROT_NAC, SYSTEM_DEVKIT , "DevKitMemory"), // TODO : Check reserved range (might behave like MemTiled)
RANGE_ENTRY(PAGE_TABLES_BASE , PAGE_TABLES_END , PAGE_TABLES_SIZE , PROT_RW , SYSTEM_ALL , "MemPageTable"), // See PAGE_TABLES_SIZE, which contains one 4 byte entry per PAGE_SIZE
RANGE_ENTRY(SYSTEM_MEMORY_BASE, SYSTEM_MEMORY_END, SYSTEM_MEMORY_SIZE, PROT_RW , SYSTEM_ALL | MAY_FAIL, "SystemMemory Optional"), // TODO : Check reserved range (might behave like MemTiled)
RANGE_ENTRY(TILED_MEMORY_BASE , TILED_MEMORY_END , TILED_MEMORY_SIZE , PROT_UNH, SYSTEM_ALL , "MemTiled Optional (even though it can't be reserved, MapViewOfFileEx to this range still works!?)"),
RANGE_ENTRY(NV2A_DEVICE1_BASE , NV2A_DEVICE1_END , NV2A_DEVICE1_SIZE , PROT_NAC, SYSTEM_ALL , "DeviceNV2A_a (GPU)"),
RANGE_ENTRY(NV2A_PRAMIN_BASE , NV2A_PRAMIN_END , NV2A_PRAMIN_SIZE1 , PROT_RW , SYSTEM_ALL , "MemNV2APRAMIN"),
RANGE_ENTRY(NV2A_DEVICE2_BASE , NV2A_DEVICE2_END , NV2A_DEVICE2_SIZE , PROT_NAC, SYSTEM_ALL , "DeviceNV2A_b (GPU)"),
RANGE_ENTRY(APU_DEVICE_BASE , APU_DEVICE_END , APU_DEVICE_SIZE , PROT_NAC, SYSTEM_ALL , "DeviceAPU"),
RANGE_ENTRY(AC97_DEVICE_BASE , AC97_DEVICE_END , AC97_DEVICE_SIZE , PROT_NAC, SYSTEM_ALL , "DeviceAC97 (ACI)"),
RANGE_ENTRY(USB_DEVICE_BASE , USB_DEVICE_END , USB_DEVICE_SIZE , PROT_NAC, SYSTEM_ALL , "DeviceUSB"),
RANGE_ENTRY(NVNET_DEVICE_BASE , NVNET_DEVICE_END , NVNET_DEVICE_SIZE , PROT_NAC, SYSTEM_ALL , "DeviceNVNet"),
RANGE_ENTRY(FLASH_DEVICE1_BASE, FLASH_DEVICE1_END, FLASH_DEVICEN_SIZE, PROT_NAC, SYSTEM_ALL , "DeviceFlash_a (Flash mirror 1)"),
RANGE_ENTRY(FLASH_DEVICE2_BASE, FLASH_DEVICE2_END, FLASH_DEVICEN_SIZE, PROT_NAC, SYSTEM_ALL , "DeviceFlash_b (Flash mirror 2)"),
RANGE_ENTRY(FLASH_DEVICE3_BASE, FLASH_DEVICE3_END, FLASH_DEVICEN_SIZE, PROT_NAC, SYSTEM_ALL | MAY_FAIL, "DeviceFlash_c (Flash mirror 3)"), // this region fails reservation when running under Ubuntu with wine, so it must be allowed to fail
RANGE_ENTRY(FLASH_DEVICE4_BASE, FLASH_DEVICE4_END, FLASH_DEVICEN_SIZE, PROT_NAC, SYSTEM_ALL | MAY_FAIL, "DeviceFlash_d (Flash mirror 4) Optional (will probably fail reservation, which is acceptable - the 3 other mirrors work just fine"),
#undef RANGE_ENTRY
};
const size_t XboxAddressRanges_size = ARRAY_SIZE(XboxAddressRanges);
bool AddressRangeMatchesFlags(const size_t index, const unsigned int flags)
{
return XboxAddressRanges[index].RangeFlags & flags;
}
bool IsOptionalAddressRange(const size_t index)
{
return AddressRangeMatchesFlags(index, MAY_FAIL);
}
unsigned int AddressRangeGetSystemFlags(const size_t index)
{
return XboxAddressRanges[index].RangeFlags & SYSTEM_ALL;
}
bool VerifyWow64()
{
typedef BOOL(WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
BOOL bIsWow64 = FALSE;
HMODULE hKernel32 = GetModuleHandle(TEXT("kernel32"));
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(hKernel32, "IsWow64Process");
if (fnIsWow64Process != nullptr) {
HANDLE hCurrentProcess = GetCurrentProcess();
fnIsWow64Process(hCurrentProcess, &bIsWow64);
}
return (bIsWow64 != FALSE);
}

View File

@ -1,211 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of Cxbx-Reloaded.
// *
// * Cxbx-Reloaded is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2017-2019 Patrick van Logchem <pvanlogchem@gmail.com>
// * (c) 2019 ergo720
// *
// * All rights reserved
// *
// ******************************************************************
#pragma once
#include <cstdint> // For uint32_t
#define KiB(x) ((x) * 1024 ) // = 0x00000400
#define MiB(x) ((x) * KiB(1024)) // = 0x00100000
// TODO: Convert the rest of defines to constexpr or const in AddressRanges.h file in master/develop branch.
#define USER_ADDRESS1_BASE 0x00010000
#define USER_ADDRESS1_SIZE (MiB(64) - KiB(64)) // = 0x03FF0000
#define USER_ADDRESS1_END (USER_ADDRESS1_BASE + USER_ADDRESS1_SIZE - 1) // 0x03FFFFFF
#define USER_ADDRESS2_BASE 0x04000000
#define USER_ADDRESS2_SIZE (MiB(64)) // = 0x04000000
#define USER_ADDRESS2_END (USER_ADDRESS2_BASE + USER_ADDRESS2_SIZE - 1) // 0x07FFFFFF
// Base addresses of various components
// Segaboot entry point xor address
inline const uint32_t SEGABOOT_EP_XOR = 0x40000000;
// Kernel Segment Zero
#define KSEG0_BASE 0x80000000
#define PHYSICAL_MAP_BASE 0x80000000
#define PHYSICAL_MAP_SIZE (MiB(256)) // = 0x10000000
#define PHYSICAL_MAP_END (PHYSICAL_MAP_BASE + PHYSICAL_MAP_SIZE - 1) // 0x8FFFFFFF
inline constexpr uint32_t PHYSICAL_MAP1_BASE = 0x80000000;
inline constexpr uint32_t PHYSICAL_MAP1_SIZE = (MiB(64)); // = 0x04000000
inline constexpr uint32_t PHYSICAL_MAP1_END = (PHYSICAL_MAP1_BASE + PHYSICAL_MAP1_SIZE - 1); // 0x83FFFFFF
inline constexpr uint32_t PHYSICAL_MAP2_BASE = 0x84000000;
inline constexpr uint32_t PHYSICAL_MAP2_SIZE = (MiB(64)); // = 0x04000000
inline constexpr uint32_t PHYSICAL_MAP2_END = (PHYSICAL_MAP2_BASE + PHYSICAL_MAP2_SIZE - 1); // 0x8FFFFFFF
#define CONTIGUOUS_MEMORY_BASE KSEG0_BASE // = 0x80000000
#define XBOX_CONTIGUOUS_MEMORY_SIZE (MiB(64))
#define CHIHIRO_CONTIGUOUS_MEMORY_SIZE (MiB(128))
inline constexpr uint32_t DEVKIT_MEMORY_BASE = 0xB0000000;
inline constexpr uint32_t DEVKIT_MEMORY_SIZE = (MiB(256)); // = 0x10000000
inline constexpr uint32_t DEVKIT_MEMORY_END = (DEVKIT_MEMORY_BASE + DEVKIT_MEMORY_SIZE - 1); // 0xBFFFFFFF
inline constexpr uint32_t PAGE_TABLES_BASE = 0xC0000000;
inline constexpr uint32_t PAGE_TABLES_SIZE = (MiB(4)); // = 0x00400000
inline constexpr uint32_t PAGE_TABLES_END = (PAGE_TABLES_BASE + PAGE_TABLES_SIZE - 1); // 0xC03FFFFF
inline constexpr uint32_t SYSTEM_MEMORY_BASE = 0xD0000000;
inline constexpr uint32_t SYSTEM_MEMORY_SIZE = (MiB(512)); // = 0x20000000
inline constexpr uint32_t SYSTEM_MEMORY_END = (SYSTEM_MEMORY_BASE + SYSTEM_MEMORY_SIZE - 1); // 0xEFFFFFFF
inline constexpr uint32_t TILED_MEMORY_BASE = 0xF0000000;
inline constexpr uint32_t TILED_MEMORY_SIZE = (MiB(64)); // = 0x04000000
inline constexpr uint32_t TILED_MEMORY_END = (TILED_MEMORY_BASE + TILED_MEMORY_SIZE - 1); // 0xF3FFFFFF
#define XBOX_WRITE_COMBINED_BASE 0xF0000000 // WC (The WC memory is another name of the tiled memory)
#define XBOX_WRITE_COMBINED_SIZE (MiB(128)) // = 0x08000000
#define XBOX_WRITE_COMBINED_END (XBOX_WRITE_COMBINED_BASE + XBOX_WRITE_COMBINED_SIZE - 1) // 0xF7FFFFFF
#define XBOX_UNCACHED_BASE 0xF8000000 // UC
#define XBOX_UNCACHED_SIZE (MiB(128 - 4)) // = 0x07C00000
#define XBOX_UNCACHED_END (XBOX_UNCACHED_BASE + XBOX_UNCACHED_SIZE - 1) // - 0xFFBFFFFF
inline constexpr uint32_t NV2A_DEVICE1_BASE = 0xFD000000;
inline constexpr uint32_t NV2A_DEVICE1_SIZE = (MiB(7)); // = 0x00700000
inline constexpr uint32_t NV2A_DEVICE1_END = (NV2A_DEVICE1_BASE + NV2A_DEVICE1_SIZE - 1); // 0xFD6FFFFF
inline constexpr uint32_t NV2A_PRAMIN_BASE = 0xFD700000;
inline constexpr uint32_t NV2A_PRAMIN_SIZE1 = (MiB(1)); // = 0x00100000 // TODO: Might be best to merge PCIDevice.h's address ranges into this header file.
inline constexpr uint32_t NV2A_PRAMIN_END = (NV2A_PRAMIN_BASE + NV2A_PRAMIN_SIZE1 - 1); // 0xFD7FFFFF
inline constexpr uint32_t NV2A_DEVICE2_BASE = 0xFD800000;
inline constexpr uint32_t NV2A_DEVICE2_SIZE = (MiB(8)); // = 0x00800000
inline constexpr uint32_t NV2A_DEVICE2_END = (NV2A_DEVICE2_BASE + NV2A_DEVICE2_SIZE - 1); // 0xFDFFFFFF
inline constexpr uint32_t APU_DEVICE_BASE = 0xFE800000;
inline constexpr uint32_t APU_DEVICE_SIZE = (KiB(512)); // = 0x00080000
inline constexpr uint32_t APU_DEVICE_END = (APU_DEVICE_BASE + APU_DEVICE_SIZE - 1); // 0xFE87FFFF
inline constexpr uint32_t AC97_DEVICE_BASE = 0xFEC00000;
inline constexpr uint32_t AC97_DEVICE_SIZE = (KiB(4)); // = 0x0001000
inline constexpr uint32_t AC97_DEVICE_END = (AC97_DEVICE_BASE + AC97_DEVICE_SIZE - 1); // 0xFEC00FFF
inline constexpr uint32_t USB_DEVICE_BASE = 0xFED00000;
inline constexpr uint32_t USB_DEVICE_SIZE = (KiB(4)); // = 0x0001000
inline constexpr uint32_t USB_DEVICE_END = (USB_DEVICE_BASE + USB_DEVICE_SIZE - 1); // 0xFED00FFF
inline constexpr uint32_t NVNET_DEVICE_BASE = 0xFEF00000;
inline constexpr uint32_t NVNET_DEVICE_SIZE = (KiB(1)); // = 0x00000400
inline constexpr uint32_t NVNET_DEVICE_END = (NVNET_DEVICE_BASE + NVNET_DEVICE_SIZE - 1); // 0xFEF003FF
inline constexpr uint32_t FLASH_DEVICEN_SIZE = (MiB(4)); // = 0x00400000
inline constexpr uint32_t FLASH_DEVICE1_BASE = 0xFF000000;
inline constexpr uint32_t FLASH_DEVICE1_END = (FLASH_DEVICE1_BASE + FLASH_DEVICEN_SIZE - 1); // 0xFF3FFFFF
inline constexpr uint32_t FLASH_DEVICE2_BASE = 0xFF400000;
inline constexpr uint32_t FLASH_DEVICE2_END = (FLASH_DEVICE2_BASE + FLASH_DEVICEN_SIZE - 1); // 0xFF7FFFFF
inline constexpr uint32_t FLASH_DEVICE3_BASE = 0xFF800000;
inline constexpr uint32_t FLASH_DEVICE3_END = (FLASH_DEVICE3_BASE + FLASH_DEVICEN_SIZE - 1); // 0xFFBFFFFF
inline constexpr uint32_t FLASH_DEVICE4_BASE = 0xFFC00000;
inline constexpr uint32_t FLASH_DEVICE4_END = (FLASH_DEVICE4_BASE - 1 + FLASH_DEVICEN_SIZE); // 0xFFFFFFFF // -1 must be before size to remove compiler warning.
// Miscellaneous base addresses
#define XBE_IMAGE_BASE 0x00010000
#define PAGE_DIRECTORY_BASE 0xC0300000
#define NV2A_INIT_VECTOR 0xFF000008
// Define virtual base and alternate virtual base of kernel
#define XBOX_KERNEL_BASE (PHYSICAL_MAP_BASE + XBE_IMAGE_BASE)
#define KERNEL_PHYSICAL_ADDRESS XBE_IMAGE_BASE // = 0x10000
#define KERNEL_SIZE sizeof(DUMMY_KERNEL)
#define KERNEL_STACK_SIZE 12288 // 0x03000, needed by PsCreateSystemThreadEx, however the current implementation doesn't use it
// Miscellaneous memory variables
// Xbox pages are (1 << 12) = 0x00001000 = 4096 bytes in size. Large pages are 4 MiB instead
// NOTE: PAGE_SIZE is also defined in xfile.h (oxdk) and linux_wrapper.h (oxdk)
#define PAGE_SHIFT 12 // 2^12 = 4 KiB
#define PAGE_SIZE (1 << PAGE_SHIFT) // = 0x00001000 = KiB(4)
#define PAGE_MASK (PAGE_SIZE - 1)
#define LARGE_PAGE_SHIFT 22 // 2^22 = 4 MiB
#define LARGE_PAGE_SIZE (1 << LARGE_PAGE_SHIFT) // = 0x00400000 = 4 MiB
#define LARGE_PAGE_MASK (LARGE_PAGE_SIZE - 1)
#define BYTES_IN_PHYSICAL_MAP (MiB(256)) // this refers to the system RAM physical window 0x80000000 - 0x8FFFFFFF
#define MAXIMUM_ZERO_BITS 21 // for XbAllocateVirtualMemory
#define MAX_VIRTUAL_ADDRESS 0xFFFFFFFF
#define LOWEST_USER_ADDRESS XBE_IMAGE_BASE // = 0x00010000
#define HIGHEST_USER_ADDRESS 0x7FFEFFFF
#define HIGHEST_VMA_ADDRESS (HIGHEST_USER_ADDRESS - X64KB) // for NtAllocateVirtualMemory
#define USER_MEMORY_SIZE (HIGHEST_USER_ADDRESS - LOWEST_USER_ADDRESS + 1) // 0x7FFE0000 = 2 GiB - 128 KiB
// Memory size per system
#define XBOX_MEMORY_SIZE (MiB(64))
#define CHIHIRO_MEMORY_SIZE (MiB(128))
// Common page calculations
#define ROUND_UP_4K(size) (((size) + PAGE_MASK) & (~PAGE_MASK))
#define ROUND_UP(size, alignment) (((size) + (alignment - 1)) & (~(alignment - 1)))
#define ROUND_DOWN_4K(size) ((size) & (~PAGE_MASK))
#define ROUND_DOWN(size, alignment) ((size) & (~(alignment - 1)))
#define CHECK_ALIGNMENT(size, alignment) (((size) % (alignment)) == 0)
#define PAGE_ALIGN(address) ROUND_DOWN_4K(address)
// Windows' address space allocation granularity;
// See https://blogs.msdn.microsoft.com/oldnewthing/20031008-00/?p=42223
const int BLOCK_SIZE = KiB(64);
extern const struct _XboxAddressRanges {
uint32_t Start;
#ifdef DEBUG
uint32_t End; // TODO : Add validation that this End corresponds to specified Size
#endif
uint32_t Size;
unsigned long InitialMemoryProtection; // Memory page protection, for use by VirtualAlloc
// Shortend symbol aliasses for memory page protection
#define PROT_UNH 0 // UNHANDLED
#define PROT_RW PAGE_READWRITE
#define PROT_XRW PAGE_EXECUTE_READWRITE
#define PROT_NAC PAGE_NOACCESS
unsigned int RangeFlags;
// Range flags (used for system selection and optional marker)
#define MAY_FAIL (1 << 0) // Optional (may fail address range reservation)
#define SYSTEM_XBOX (1 << 1)
#define SYSTEM_DEVKIT (1 << 2)
#define SYSTEM_CHIHIRO (1 << 3)
// Short-hand for sets of system configurations
#define SYSTEM_ALL (SYSTEM_XBOX | SYSTEM_DEVKIT | SYSTEM_CHIHIRO)
#define SYSTEM_128MB ( SYSTEM_DEVKIT | SYSTEM_CHIHIRO)
#ifdef DEBUG
const char *Comment;
#endif
} XboxAddressRanges[];
extern const size_t XboxAddressRanges_size;
extern bool AddressRangeMatchesFlags(const size_t index, const unsigned int flags);
extern bool IsOptionalAddressRange(const size_t index);
extern unsigned int AddressRangeGetSystemFlags(const size_t index);
extern bool VerifyWow64();

View File

@ -37,19 +37,19 @@ namespace CxbxDebugger
// Note: Keep the top 3-bits empty as they are used internally // Note: Keep the top 3-bits empty as they are used internally
enum ReportType : DWORD enum ReportType : DWORD
{ {
HLECACHE_FILE = 0x1000, // Debugger report codes:
KERNEL_PATCH = 0x2000, HLECACHE_FILE = 0x00deed00,
KERNEL_PATCH = 0x00deed01,
FILE_OPENED = 0x00deed02,
FILE_READ = 0x00deed03,
FILE_CLOSED = 0x00deed04,
DEBUGGER_INIT = 0x00deed05,
FILE_WRITE = 0x00deed06,
FILE_OPENED = 0x3000, // Debugger query codes:
FILE_READ = 0x3001,
FILE_WRITE = 0x3002,
FILE_CLOSED = 0x3003,
DEBUGGER_INIT = 0x4000, OVERRIDE_EXCEPTION = 0x00ceed01,
DEBUGGER_NEW_TARGET = 0x4001,
OVERRIDE_EXCEPTION = 0x5000,
}; };
bool IsAttached() bool IsAttached()
@ -128,10 +128,8 @@ namespace CxbxDebugger
case Internal::KERNEL_PATCH: case Internal::KERNEL_PATCH:
case Internal::FILE_OPENED: case Internal::FILE_OPENED:
case Internal::FILE_READ: case Internal::FILE_READ:
case Internal::FILE_WRITE:
case Internal::FILE_CLOSED: case Internal::FILE_CLOSED:
case Internal::DEBUGGER_INIT: case Internal::DEBUGGER_INIT:
case Internal::DEBUGGER_NEW_TARGET:
return true; return true;
case Internal::OVERRIDE_EXCEPTION: case Internal::OVERRIDE_EXCEPTION:
@ -150,20 +148,12 @@ namespace CxbxDebugger
{ {
Internal::ReportHelper Report(Internal::DEBUGGER_INIT); Internal::ReportHelper Report(Internal::DEBUGGER_INIT);
Report.Add(0); // unused
Report.AddString(XbeTitle); Report.AddString(XbeTitle);
Report.Send(); Report.Send();
} }
void ReportNewTarget(const char* CommandLine)
{
Internal::ReportHelper Report(Internal::DEBUGGER_NEW_TARGET);
Report.AddString(CommandLine);
Report.Send();
}
void ReportHLECacheFile(const char* Filename) void ReportHLECacheFile(const char* Filename)
{ {
Internal::ReportHelper Report(Internal::HLECACHE_FILE); Internal::ReportHelper Report(Internal::HLECACHE_FILE);

View File

@ -36,7 +36,6 @@ namespace CxbxDebugger
// Report helpers: // Report helpers:
void ReportDebuggerInit(const char* XbeTitle); void ReportDebuggerInit(const char* XbeTitle);
void ReportNewTarget(const char* CommandLine);
void ReportHLECacheFile(const char* Filename); void ReportHLECacheFile(const char* Filename);
void ReportKernelPatch(const char* ImportName, DWORD Address); void ReportKernelPatch(const char* ImportName, DWORD Address);

View File

@ -27,8 +27,12 @@
#define LOG_PREFIX CXBXR_MODULE::EEPR #define LOG_PREFIX CXBXR_MODULE::EEPR
#define LOG_PREFIX_INIT CXBXR_MODULE::INIT #define LOG_PREFIX_INIT CXBXR_MODULE::INIT
#include <core\kernel\exports\xboxkrnl.h> // For XC_VALUE_INDEX and XBOX_EEPROM // prevent name collisions
#include "cxbxr.hpp" // For CxbxrAbort namespace xboxkrnl
{
#include <xboxkrnl/xboxkrnl.h> // For XC_VALUE_INDEX and XBOX_EEPROM
};
#include <stdio.h> // For printf #include <stdio.h> // For printf
#include <shlobj.h> // For HANDLE, CreateFile, CreateFileMapping, MapViewOfFile #include <shlobj.h> // For HANDLE, CreateFile, CreateFileMapping, MapViewOfFile
#include <random> #include <random>
@ -36,13 +40,14 @@
#include "EmuEEPROM.h" // For EEPROMInfo, EEPROMInfos #include "EmuEEPROM.h" // For EEPROMInfo, EEPROMInfos
#include "core\kernel\support\Emu.h" // For EmuWarning #include "core\kernel\support\Emu.h" // For EmuWarning
#include "..\..\src\devices\LED.h" // For SetLEDSequence #include "..\..\src\devices\LED.h" // For SetLEDSequence
#include "..\core\kernel\init\CxbxKrnl.h"
xbox::XBOX_EEPROM *EEPROM = nullptr; // Set using CxbxRestoreEEPROM() xboxkrnl::XBOX_EEPROM *EEPROM = nullptr; // Set using CxbxRestoreEEPROM()
// Default value (NA), overwritten with the actual content in the eeprom by CxbxRestoreEEPROM // Default value (NA), overwritten with the actual content in the eeprom by CxbxRestoreEEPROM
xbox::ulong_xt XboxFactoryGameRegion = XC_GAME_REGION_NA; xboxkrnl::ULONG XboxFactoryGameRegion = XC_GAME_REGION_NA;
const EEPROMInfo* EmuFindEEPROMInfo(xbox::XC_VALUE_INDEX index) const EEPROMInfo* EmuFindEEPROMInfo(xboxkrnl::XC_VALUE_INDEX index)
{ {
for (int i = 0; EEPROMInfos[i].index != XC_END_MARKER; i++) for (int i = 0; EEPROMInfos[i].index != XC_END_MARKER; i++)
if (EEPROMInfos[i].index == index) if (EEPROMInfos[i].index == index)
@ -74,7 +79,7 @@ static void EepromCRC(unsigned char *crc, unsigned char *data, long dataLen) {
free(CRC_Data); free(CRC_Data);
} }
void gen_section_CRCs(xbox::XBOX_EEPROM* eeprom) { void gen_section_CRCs(xboxkrnl::XBOX_EEPROM* eeprom) {
const long Factory_size = sizeof(eeprom->FactorySettings) - sizeof(eeprom->FactorySettings.Checksum); const long Factory_size = sizeof(eeprom->FactorySettings) - sizeof(eeprom->FactorySettings.Checksum);
const long User_size = sizeof(eeprom->UserSettings) - sizeof(eeprom->UserSettings.Checksum); const long User_size = sizeof(eeprom->UserSettings) - sizeof(eeprom->UserSettings.Checksum);
EepromCRC( EepromCRC(
@ -89,10 +94,9 @@ void gen_section_CRCs(xbox::XBOX_EEPROM* eeprom) {
); );
} }
#ifdef CXBXR_EMU xboxkrnl::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin)
xbox::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin)
{ {
xbox::XBOX_EEPROM *pEEPROM; xboxkrnl::XBOX_EEPROM *pEEPROM;
// First, try to open an existing EEPROM.bin file : // First, try to open an existing EEPROM.bin file :
HANDLE hFileEEPROM = CreateFile(szFilePath_EEPROM_bin, HANDLE hFileEEPROM = CreateFile(szFilePath_EEPROM_bin,
@ -122,7 +126,7 @@ xbox::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin)
} }
// Make sure EEPROM.bin is at least 256 bytes in size // Make sure EEPROM.bin is at least 256 bytes in size
SetFilePointer(hFileEEPROM, EEPROM_SIZE, nullptr, FILE_BEGIN); SetFilePointer(hFileEEPROM, 256, nullptr, FILE_BEGIN);
SetEndOfFile(hFileEEPROM); SetEndOfFile(hFileEEPROM);
HANDLE hFileMappingEEPROM = CreateFileMapping( HANDLE hFileMappingEEPROM = CreateFileMapping(
@ -141,12 +145,14 @@ xbox::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin)
LARGE_INTEGER len_li; LARGE_INTEGER len_li;
GetFileSizeEx(hFileEEPROM, &len_li); GetFileSizeEx(hFileEEPROM, &len_li);
unsigned int FileSize = len_li.u.LowPart; unsigned int FileSize = len_li.u.LowPart;
if (FileSize != 256) { if (FileSize != 256)
CxbxrAbort("%s : EEPROM.bin file is not 256 bytes large!\n", __func__); {
CxbxKrnlCleanup("%s : EEPROM.bin file is not 256 bytes large!\n", __func__);
return nullptr;
} }
// Map EEPROM.bin contents into memory : // Map EEPROM.bin contents into memory :
pEEPROM = (xbox::XBOX_EEPROM *)MapViewOfFile( pEEPROM = (xboxkrnl::XBOX_EEPROM *)MapViewOfFile(
hFileMappingEEPROM, hFileMappingEEPROM,
FILE_MAP_READ | FILE_MAP_WRITE, FILE_MAP_READ | FILE_MAP_WRITE,
/* dwFileOffsetHigh */0, /* dwFileOffsetHigh */0,
@ -178,11 +184,11 @@ xbox::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin)
} }
// Read the HDD (and eventually also the online) keys stored in the eeprom file. Users can input them in the eeprom menu // Read the HDD (and eventually also the online) keys stored in the eeprom file. Users can input them in the eeprom menu
memcpy(xbox::XboxHDKey, pEEPROM->EncryptedSettings.HDKey, xbox::XBOX_KEY_LENGTH); memcpy(xboxkrnl::XboxHDKey, pEEPROM->EncryptedSettings.HDKey, xboxkrnl::XBOX_KEY_LENGTH);
// Verify the checksum of the eeprom header // Verify the checksum of the eeprom header
UCHAR Checksum[20] = { 0 }; UCHAR Checksum[20] = { 0 };
xbox::XcHMAC(xbox::XboxEEPROMKey, 16, pEEPROM->EncryptedSettings.Confounder, 8, pEEPROM->EncryptedSettings.HDKey, 20, Checksum); xboxkrnl::XcHMAC(xboxkrnl::XboxEEPROMKey, 16, pEEPROM->EncryptedSettings.Confounder, 8, pEEPROM->EncryptedSettings.HDKey, 20, Checksum);
if (memcmp(Checksum, pEEPROM->EncryptedSettings.Checksum, 20)) if (memcmp(Checksum, pEEPROM->EncryptedSettings.Checksum, 20))
{ {
// The checksums do not match. Log this error and flash the LED (red, off, red, off) // The checksums do not match. Log this error and flash the LED (red, off, red, off)
@ -192,51 +198,21 @@ xbox::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin)
return pEEPROM; return pEEPROM;
} }
#endif
void EmuEEPROMReset(xbox::XBOX_EEPROM* eeprom) void EmuEEPROMReset(xboxkrnl::XBOX_EEPROM* eeprom)
{ {
memset(eeprom, 0, sizeof(xbox::XBOX_EEPROM)); memset(eeprom, 0, sizeof(xboxkrnl::XBOX_EEPROM));
// Setup random number generator // Set Factory Settings
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> randomDis(0, 255);
// Factory Settings
eeprom->FactorySettings.AVRegion = AV_STANDARD_NTSC_M | AV_FLAGS_60Hz; eeprom->FactorySettings.AVRegion = AV_STANDARD_NTSC_M | AV_FLAGS_60Hz;
memcpy(eeprom->FactorySettings.SerialNumber, "Cxbx-R ", 12);
// TODO: Ethernet Address
// TODO: Online Key
// Generate a random serial number // Encrypted Section
std::uniform_int_distribution<> serialDis(0, 9);
std::string serial = "";
for (int i = 0; i < 12; i++) {
serial += std::to_string(serialDis(gen));
}
memset(eeprom->FactorySettings.SerialNumber, 0, 12);
strncpy((char*)eeprom->FactorySettings.SerialNumber, serial.c_str(), 12);
// Generate a random mac address, starting with the Microsoft prefix
eeprom->FactorySettings.EthernetAddr[0] = 0x00;
eeprom->FactorySettings.EthernetAddr[1] = 0x50;
eeprom->FactorySettings.EthernetAddr[2] = 0xF2;
for (int i = 3; i < 6; i++) {
eeprom->FactorySettings.EthernetAddr[i] = randomDis(gen);
}
// Generate a random Online Key
for (int i = 0; i < 16; i++) {
eeprom->FactorySettings.OnlineKey[i] = randomDis(gen);
}
// Encrypted Settings
eeprom->EncryptedSettings.GameRegion = XC_GAME_REGION_NA; eeprom->EncryptedSettings.GameRegion = XC_GAME_REGION_NA;
// TODO: HDD Key
// Generate a random HDD Key xboxkrnl::XcHMAC(xboxkrnl::XboxEEPROMKey, 16, eeprom->EncryptedSettings.Confounder, 8, eeprom->EncryptedSettings.HDKey, 20, eeprom->EncryptedSettings.Checksum);
for (int i = 0; i < 16; i++) {
eeprom->EncryptedSettings.HDKey[i] = randomDis(gen);
}
xbox::XcHMAC(xbox::XboxEEPROMKey, 16, eeprom->EncryptedSettings.Confounder, 8, eeprom->EncryptedSettings.HDKey, 20, eeprom->EncryptedSettings.Checksum);
// User Settings // User Settings
eeprom->UserSettings.Language = XC_LANGUAGE_ENGLISH; // = English eeprom->UserSettings.Language = XC_LANGUAGE_ENGLISH; // = English
@ -246,5 +222,34 @@ void EmuEEPROMReset(xbox::XBOX_EEPROM* eeprom)
eeprom->UserSettings.ParentalControlMovies = XC_PC_MAX; // = XC_PRTL_CRTL_MAX eeprom->UserSettings.ParentalControlMovies = XC_PC_MAX; // = XC_PRTL_CRTL_MAX
eeprom->UserSettings.MiscFlags = 0; // No automatic power down eeprom->UserSettings.MiscFlags = 0; // No automatic power down
// Online Settings
// Setup the Serial and Mac Generators
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> serialDis (0, 9);
std::uniform_int_distribution<> macOnlineDis(0, 255);
// Generate a random serial number
std::string serial = "";
for (int i = 0; i < 12; i++) {
serial += std::to_string(serialDis(gen));
}
memset(eeprom->FactorySettings.SerialNumber, 0, 12);
strncpy((char*)eeprom->FactorySettings.SerialNumber, serial.c_str(), 12);
// Generate a random mac address
eeprom->FactorySettings.EthernetAddr[0] = 0x00;
eeprom->FactorySettings.EthernetAddr[1] = 0x50;
eeprom->FactorySettings.EthernetAddr[2] = 0xF2;
for (int i = 3; i < 6; i++) {
eeprom->FactorySettings.EthernetAddr[i] = macOnlineDis(gen);
}
// Generate a random Online Key
for (int i = 0; i < 16; i++) {
eeprom->FactorySettings.OnlineKey[i] = macOnlineDis(gen);
}
// TODO: TimeZone Settings // TODO: TimeZone Settings
} }

View File

@ -27,55 +27,66 @@
#ifndef EMU_EEPROM_H #ifndef EMU_EEPROM_H
#define EMU_EEPROM_H #define EMU_EEPROM_H
#include <core\kernel\exports\xboxkrnl.h> // For XC_VALUE_INDEX and XBOX_EEPROM #if defined(__cplusplus)
extern "C"
{
#endif
#define EEPROM_SIZE sizeof(xbox::XBOX_EEPROM) // prevent name collisions
namespace xboxkrnl
{
#undef _WIN32 // Compile-in REG_DWORD and friends, since we lack a <windows> include here
#include <xboxkrnl/xboxkrnl.h> // For XC_VALUE_INDEX and XBOX_EEPROM
#define _WIN32
};
#define EEPROM_SIZE sizeof(xboxkrnl::XBOX_EEPROM)
typedef struct EEPROMInfo { typedef struct EEPROMInfo {
xbox::XC_VALUE_INDEX index; xboxkrnl::XC_VALUE_INDEX index;
int value_offset; int value_offset;
int value_type; int value_type;
int value_length; int value_length;
} EEPROMInfo; } EEPROMInfo;
#define XC_END_MARKER (xbox::XC_VALUE_INDEX)-1 #define XC_END_MARKER (xboxkrnl::XC_VALUE_INDEX)-1
#define EEPROM_INFO_ENTRY(XC, Member, REG_Type) \ #define EEPROM_INFO_ENTRY(XC, Member, REG_Type) \
{ xbox::XC, offsetof(xbox::XBOX_EEPROM, Member), REG_Type, sizeof(((xbox::XBOX_EEPROM *)0)->Member) } { xboxkrnl::##XC, offsetof(xboxkrnl::XBOX_EEPROM, Member), REG_Type, sizeof(((xboxkrnl::XBOX_EEPROM *)0)->Member) }
static const EEPROMInfo EEPROMInfos[] = { static const EEPROMInfo EEPROMInfos[] = {
EEPROM_INFO_ENTRY(XC_TIMEZONE_BIAS, UserSettings.TimeZoneBias, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_TIMEZONE_BIAS, UserSettings.TimeZoneBias, REG_DWORD),
EEPROM_INFO_ENTRY(XC_TZ_STD_NAME, UserSettings.TimeZoneStdName, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_TZ_STD_NAME, UserSettings.TimeZoneStdName, REG_BINARY),
EEPROM_INFO_ENTRY(XC_TZ_STD_DATE, UserSettings.TimeZoneStdDate, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_TZ_STD_DATE, UserSettings.TimeZoneStdDate, REG_DWORD),
EEPROM_INFO_ENTRY(XC_TZ_STD_BIAS, UserSettings.TimeZoneStdBias, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_TZ_STD_BIAS, UserSettings.TimeZoneStdBias, REG_DWORD),
EEPROM_INFO_ENTRY(XC_TZ_DLT_NAME, UserSettings.TimeZoneDltName, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_TZ_DLT_NAME, UserSettings.TimeZoneDltName, REG_BINARY),
EEPROM_INFO_ENTRY(XC_TZ_DLT_DATE, UserSettings.TimeZoneDltDate, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_TZ_DLT_DATE, UserSettings.TimeZoneDltDate, REG_DWORD),
EEPROM_INFO_ENTRY(XC_TZ_DLT_BIAS, UserSettings.TimeZoneDltBias, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_TZ_DLT_BIAS, UserSettings.TimeZoneDltBias, REG_DWORD),
EEPROM_INFO_ENTRY(XC_LANGUAGE, UserSettings.Language, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_LANGUAGE, UserSettings.Language, REG_DWORD),
EEPROM_INFO_ENTRY(XC_VIDEO, UserSettings.VideoFlags, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_VIDEO, UserSettings.VideoFlags, REG_DWORD),
EEPROM_INFO_ENTRY(XC_AUDIO, UserSettings.AudioFlags, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_AUDIO, UserSettings.AudioFlags, REG_DWORD),
EEPROM_INFO_ENTRY(XC_P_CONTROL_GAMES, UserSettings.ParentalControlGames, xbox::reg_dword), // Zapper queries this. TODO : Should this be xbox::reg_none? EEPROM_INFO_ENTRY(XC_P_CONTROL_GAMES, UserSettings.ParentalControlGames, REG_DWORD), // Zapper queries this. TODO : Should this be REG_NONE?
EEPROM_INFO_ENTRY(XC_P_CONTROL_PASSWORD, UserSettings.ParentalControlPassword, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_P_CONTROL_PASSWORD, UserSettings.ParentalControlPassword, REG_DWORD),
EEPROM_INFO_ENTRY(XC_P_CONTROL_MOVIES, UserSettings.ParentalControlMovies, xbox::reg_dword), // Xbox Dashboard queries this. EEPROM_INFO_ENTRY(XC_P_CONTROL_MOVIES, UserSettings.ParentalControlMovies, REG_DWORD), // Xbox Dashboard queries this.
EEPROM_INFO_ENTRY(XC_ONLINE_IP_ADDRESS, UserSettings.OnlineIpAddress, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_ONLINE_IP_ADDRESS, UserSettings.OnlineIpAddress, REG_DWORD),
EEPROM_INFO_ENTRY(XC_ONLINE_DNS_ADDRESS, UserSettings.OnlineDnsAddress, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_ONLINE_DNS_ADDRESS, UserSettings.OnlineDnsAddress, REG_DWORD),
EEPROM_INFO_ENTRY(XC_ONLINE_DEFAULT_GATEWAY_ADDRESS, UserSettings.OnlineDefaultGatewayAddress, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_ONLINE_DEFAULT_GATEWAY_ADDRESS, UserSettings.OnlineDefaultGatewayAddress, REG_DWORD),
EEPROM_INFO_ENTRY(XC_ONLINE_SUBNET_ADDRESS, UserSettings.OnlineSubnetMask, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_ONLINE_SUBNET_ADDRESS, UserSettings.OnlineSubnetMask, REG_DWORD),
EEPROM_INFO_ENTRY(XC_MISC, UserSettings.MiscFlags, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_MISC, UserSettings.MiscFlags, REG_DWORD),
EEPROM_INFO_ENTRY(XC_DVD_REGION, UserSettings.DvdRegion, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_DVD_REGION, UserSettings.DvdRegion, REG_DWORD),
EEPROM_INFO_ENTRY(XC_MAX_OS, UserSettings, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_MAX_OS, UserSettings, REG_BINARY),
// XC_MAX_OS is called to return a complete XBOX_USER_SETTINGS structure // XC_MAX_OS is called to return a complete XBOX_USER_SETTINGS structure
// //
// One example is from XapipQueryTimeZoneInformation(, xbox::reg_dword, sizeof(DWORD), where it is used to // One example is from XapipQueryTimeZoneInformation(, REG_DWORD, sizeof(DWORD), where it is used to
// detect the local timezone information. // detect the local timezone information.
EEPROM_INFO_ENTRY(XC_FACTORY_SERIAL_NUMBER, FactorySettings.SerialNumber, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_FACTORY_SERIAL_NUMBER, FactorySettings.SerialNumber, REG_BINARY),
EEPROM_INFO_ENTRY(XC_FACTORY_ETHERNET_ADDR, FactorySettings.EthernetAddr, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_FACTORY_ETHERNET_ADDR, FactorySettings.EthernetAddr, REG_BINARY),
EEPROM_INFO_ENTRY(XC_FACTORY_ONLINE_KEY, FactorySettings.OnlineKey, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_FACTORY_ONLINE_KEY, FactorySettings.OnlineKey, REG_BINARY),
EEPROM_INFO_ENTRY(XC_FACTORY_AV_REGION, FactorySettings.AVRegion, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_FACTORY_AV_REGION, FactorySettings.AVRegion, REG_DWORD),
// Note : XC_FACTORY_GAME_REGION is linked to a separate ULONG XboxFactoryGameRegion (of type xbox::reg_dword) // Note : XC_FACTORY_GAME_REGION is linked to a separate ULONG XboxFactoryGameRegion (of type REG_DWORD)
EEPROM_INFO_ENTRY(XC_FACTORY_GAME_REGION, EncryptedSettings.GameRegion, xbox::reg_dword), EEPROM_INFO_ENTRY(XC_FACTORY_GAME_REGION, EncryptedSettings.GameRegion, REG_DWORD),
EEPROM_INFO_ENTRY(XC_ENCRYPTED_SECTION, EncryptedSettings, xbox::reg_binary), EEPROM_INFO_ENTRY(XC_ENCRYPTED_SECTION, EncryptedSettings, REG_BINARY),
{ xbox::XC_MAX_ALL, 0, xbox::reg_binary, sizeof(xbox::XBOX_EEPROM) }, { xboxkrnl::XC_MAX_ALL, 0, REG_BINARY, sizeof(xboxkrnl::XBOX_EEPROM) },
{ XC_END_MARKER } { XC_END_MARKER }
}; };
@ -139,16 +150,20 @@ static const EEPROMInfo EEPROMInfos[] = {
#define DVD_REGION_RESERVED 7 #define DVD_REGION_RESERVED 7
#define DVD_REGION_INTERNATIONAL 8 #define DVD_REGION_INTERNATIONAL 8
extern xbox::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin); extern xboxkrnl::XBOX_EEPROM *CxbxRestoreEEPROM(char *szFilePath_EEPROM_bin);
extern const EEPROMInfo* EmuFindEEPROMInfo(xbox::XC_VALUE_INDEX index); extern const EEPROMInfo* EmuFindEEPROMInfo(xboxkrnl::XC_VALUE_INDEX index);
extern xbox::XBOX_EEPROM *EEPROM; extern xboxkrnl::XBOX_EEPROM *EEPROM;
extern xbox::ulong_xt XboxFactoryGameRegion; extern xboxkrnl::ULONG XboxFactoryGameRegion;
extern void EmuEEPROMReset(xbox::XBOX_EEPROM* eeprom); extern void EmuEEPROMReset(xboxkrnl::XBOX_EEPROM* eeprom);
void gen_section_CRCs(xbox::XBOX_EEPROM*); void gen_section_CRCs(xboxkrnl::XBOX_EEPROM*);
#if defined(__cplusplus)
}
#endif
#endif // EMU_EEPROM_H #endif // EMU_EEPROM_H

View File

@ -27,14 +27,14 @@
#include "common\Error.h" #include "common\Error.h"
const std::string Error::GetError() const std::string& Error::GetError()
{ {
return std::string(m_szError); return m_strError;
} }
bool Error::HasError() const bool Error::HasError() const
{ {
return HasFatalError() || (m_szError[0] != '\0'); return HasFatalError() || !m_strError.empty();
} }
bool Error::HasFatalError() const bool Error::HasFatalError() const
@ -46,7 +46,7 @@ bool Error::ClearError()
{ {
if (m_bFatal) { return false; } if (m_bFatal) { return false; }
m_szError[0] = '\0'; m_strError.clear();
m_bFatal = false; m_bFatal = false;
return true; return true;
@ -54,17 +54,11 @@ bool Error::ClearError()
void Error::SetError(const std::string& strError) void Error::SetError(const std::string& strError)
{ {
// assert(strError.length()) < sizeof(m_szError)); m_strError = strError;
memset(m_szError, '\0', sizeof(m_szError));
memcpy(m_szError, strError.c_str(), strError.length());
} }
void Error::SetFatalError(const std::string& strError) void Error::SetFatalError(const std::string& strError)
{ {
// assert(strError.length()) < sizeof(m_szError)); m_strError = strError;
memset(m_szError, '\0', sizeof(m_szError));
memcpy(m_szError, strError.c_str(), strError.length());
m_bFatal = true; m_bFatal = true;
} }

View File

@ -33,7 +33,7 @@
class Error class Error
{ {
public: public:
const std::string GetError(); const std::string& GetError();
bool HasError() const; bool HasError() const;
bool HasFatalError() const; bool HasFatalError() const;
@ -42,15 +42,15 @@ public:
protected: protected:
// protected constructor so this class must be inherited from // protected constructor so this class must be inherited from
Error() : m_szError("\0"), m_bFatal(false) { } Error() : m_bFatal(false) { }
// protected so only derived class may set an error // protected so only derived class may set an error
void SetError(const std::string& strStrError); void SetError(const std::string& strStrError);
void SetFatalError(const std::string& strError); void SetFatalError(const std::string& strError);
private: private:
char m_szError[60]; // Cannot be std::string, which sizeof() differs between builds std::string m_strError;
uint32_t m_bFatal; // Cannot be bool, to avoid bit packing altering memory layout bool m_bFatal;
}; };
#endif #endif

View File

@ -1,187 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of the Cxbx-Reloaded project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * All rights reserved
// *
// ******************************************************************
#define LOG_PREFIX CXBXR_MODULE::FILE
#define LOG_PREFIX_INIT CXBXR_MODULE::INIT
#include <filesystem>
#include "common/cxbxr.hpp"
#include "Settings.hpp"
#include "EmuShared.h"
#include "xxhash.h" // for XXH3_64bits
#include "core/kernel/common/xbox.h"
#include "Logging.h"
char szFilePath_CxbxReloaded_Exe[MAX_PATH] = { 0 };
char szFilePath_EEPROM_bin[MAX_PATH] = { 0 };
std::string g_DataFilePath;
std::string g_DiskBasePath;
std::string g_MuBasePath;
//TODO: Possible move CxbxResolveHostToFullPath inline function someplace else if become useful elsewhere.
// Let filesystem library clean it up for us, including resolve host's symbolic link path.
// Since internal kernel do translate to full path than preserved host symoblic link path.
void CxbxResolveHostToFullPath(std::filesystem::path& file_path, std::string_view finish_error_sentence) {
std::error_code error;
std::filesystem::path sanityPath = std::filesystem::canonical(file_path, error);
if (error) {
// The MS implementation of std::filesystem::canonical internally calls GetFinalPathNameByHandleW, which fails with ERROR_FILE_NOT_FOUND when called
// on a file inside a mounted xiso under Windows with the xbox-iso-vfs tool because of this known dokany bug https://github.com/dokan-dev/dokany/issues/343
EmuLogInit(LOG_LEVEL::WARNING, "Could not resolve to %s: %s, dokany in use? The error was: %s",
finish_error_sentence.data(), file_path.string().c_str(), error.message().c_str());
sanityPath = std::filesystem::absolute(std::filesystem::weakly_canonical(file_path, error), error);
if (error) {
CxbxrAbortEx(LOG_PREFIX_INIT, "Could not resolve to %s: %s. The error was: %s", finish_error_sentence.data(), file_path.string().c_str(), error.message().c_str());
}
}
file_path = sanityPath;
}
// TODO: Eventually, we should remove this function to start using std::filesystem::path method for all host paths.
void CxbxResolveHostToFullPath(std::string& file_path, std::string_view finish_error_sentence) {
std::filesystem::path sanityPath(file_path);
CxbxResolveHostToFullPath(sanityPath, finish_error_sentence);
file_path = sanityPath.string();
}
// NOTE: Do NOT modify g_<custom>BasePath variables after this call!
void CxbxrInitFilePaths()
{
if (g_Settings) {
g_DataFilePath = g_Settings->GetDataLocation();
}
else {
char dataLoc[MAX_PATH];
g_EmuShared->GetDataLocation(dataLoc);
g_DataFilePath = dataLoc;
}
// Make sure our data folder exists :
bool result = std::filesystem::exists(g_DataFilePath);
if (!result && !std::filesystem::create_directory(g_DataFilePath)) {
CxbxrAbort("%s : Couldn't create Cxbx-Reloaded's data folder!", __func__);
}
// Make sure the EmuDisk folder exists
g_DiskBasePath = g_DataFilePath + "\\EmuDisk";
result = std::filesystem::exists(g_DiskBasePath);
if (!result && !std::filesystem::create_directory(g_DiskBasePath)) {
CxbxrAbort("%s : Couldn't create Cxbx-Reloaded EmuDisk folder!", __func__);
}
CxbxResolveHostToFullPath(g_DiskBasePath, "Cxbx-Reloaded's EmuDisk directory");
g_DiskBasePath = std::filesystem::path(g_DiskBasePath).append("").string();
// Make sure the EmuDMu folder exists
g_MuBasePath = g_DataFilePath + "\\EmuMu";
result = std::filesystem::exists(g_MuBasePath);
if (!result && !std::filesystem::create_directory(g_MuBasePath)) {
CxbxrAbort("%s : Couldn't create Cxbx-Reloaded EmuMu folder!", __func__);
}
CxbxResolveHostToFullPath(g_MuBasePath, "Cxbx-Reloaded's EmuMu directory");
g_MuBasePath = std::filesystem::path(g_MuBasePath).append("").string();
snprintf(szFilePath_EEPROM_bin, MAX_PATH, "%s\\EEPROM.bin", g_DataFilePath.c_str());
GetModuleFileName(GetModuleHandle(nullptr), szFilePath_CxbxReloaded_Exe, MAX_PATH);
}
// Loads a keys.bin file as generated by dump-xbox
// See https://github.com/JayFoxRox/xqemu-tools/blob/master/dump-xbox.c
void LoadXboxKeys()
{
std::string keys_path = g_DataFilePath + "\\keys.bin";
// Attempt to open Keys.bin
FILE* fp = fopen(keys_path.c_str(), "rb");
if (fp != nullptr) {
// Determine size of Keys.bin
xbox::XBOX_KEY_DATA keys[2];
fseek(fp, 0, SEEK_END);
long size = ftell(fp);
rewind(fp);
// If the size of Keys.bin is correct (two keys), read it
if (size == xbox::XBOX_KEY_LENGTH * 2) {
fread(keys, xbox::XBOX_KEY_LENGTH, 2, fp);
memcpy(xbox::XboxEEPROMKey, &keys[0], xbox::XBOX_KEY_LENGTH);
memcpy(xbox::XboxCertificateKey, &keys[1], xbox::XBOX_KEY_LENGTH);
}
else {
EmuLog(LOG_LEVEL::WARNING, "Keys.bin has an incorrect filesize. Should be %d bytes", xbox::XBOX_KEY_LENGTH * 2);
}
fclose(fp);
return;
}
// If we didn't already exit the function, keys.bin could not be loaded
EmuLog(LOG_LEVEL::WARNING, "Failed to load Keys.bin. Cxbx-Reloaded will be unable to read Save Data from a real Xbox");
}
static HANDLE hMapDataHash = nullptr;
bool CxbxrLockFilePath()
{
std::stringstream filePathHash("Local\\");
uint64_t hashValue = XXH3_64bits(g_DataFilePath.c_str(), g_DataFilePath.length() + 1);
if (!hashValue) {
CxbxrAbort("%s : Couldn't generate Cxbx-Reloaded's data folder hash!", __func__);
}
filePathHash << std::hex << hashValue;
hMapDataHash = CreateFileMapping(
INVALID_HANDLE_VALUE, // Paging file
nullptr, // default security attributes
PAGE_READONLY, // readonly access
0, // size: high 32 bits
/*Dummy size*/4, // size: low 32 bits
filePathHash.str().c_str() // name of map object
);
if (hMapDataHash == nullptr) {
return false;
}
if (GetLastError() == ERROR_ALREADY_EXISTS) {
PopupError(nullptr, "Data path directory is currently in use.\nUse a different data path directory or stop emulation from another process.");
CloseHandle(hMapDataHash);
return false;
}
return true;
}
void CxbxrUnlockFilePath()
{
// Close opened file path lockdown shared memory.
if (hMapDataHash) {
CloseHandle(hMapDataHash);
hMapDataHash = nullptr;
}
}

View File

@ -1,53 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of the Cxbx-Reloaded project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * All rights reserved
// *
// ******************************************************************
#pragma once
extern char szFilePath_CxbxReloaded_Exe[MAX_PATH];
extern char szFilePath_EEPROM_bin[MAX_PATH];
extern std::string g_DataFilePath;
extern std::string g_DiskBasePath;
extern std::string g_MuBasePath;
#include <filesystem>
//TODO: Possible move CxbxResolveHostToFullPath inline function someplace else if become useful elsewhere.
// Let filesystem library clean it up for us, including resolve host's symbolic link path.
// Since internal kernel do translate to full path than preserved host symoblic link path.
void CxbxResolveHostToFullPath(std::filesystem::path& file_path, std::string_view finish_error_sentence);
// TODO: Eventually, we should remove this function to start using std::filesystem::path method for all host paths.
void CxbxResolveHostToFullPath(std::string& file_path, std::string_view finish_error_sentence);
// NOTE: Do NOT modify g_<custom>BasePath variables after this call!
void CxbxrInitFilePaths();
// Loads a keys.bin file as generated by dump-xbox
// See https://github.com/JayFoxRox/xqemu-tools/blob/master/dump-xbox.c
void LoadXboxKeys();
bool CxbxrLockFilePath();
void CxbxrUnlockFilePath();

View File

@ -38,7 +38,6 @@ typedef enum class _IPC_UPDATE_GUI {
, XBOX_LED_COLOUR , XBOX_LED_COLOUR
, LOG_ENABLED , LOG_ENABLED
, KRNL_IS_READY , KRNL_IS_READY
, OVERLAY
} IPC_UPDATE_GUI; } IPC_UPDATE_GUI;
void ipc_send_gui_update(IPC_UPDATE_GUI command, const unsigned int value); void ipc_send_gui_update(IPC_UPDATE_GUI command, const unsigned int value);
@ -49,11 +48,10 @@ void ipc_send_gui_update(IPC_UPDATE_GUI command, const unsigned int value);
// ****************************************************************** // ******************************************************************
typedef enum class _IPC_UPDATE_KERNEL { typedef enum class _IPC_UPDATE_KERNEL {
CONFIG_LOGGING_SYNC = 0, CONFIG_LOGGING_SYNC = 0
CONFIG_INPUT_SYNC, , CONFIG_INPUT_SYNC
CONFIG_CHANGE_TIME
} IPC_UPDATE_KERNEL; } IPC_UPDATE_KERNEL;
void ipc_send_kernel_update(IPC_UPDATE_KERNEL command, const int value, const unsigned int hwnd); void ipc_send_kernel_update(IPC_UPDATE_KERNEL command, const unsigned int value, const unsigned int hwnd);
#endif #endif

View File

@ -80,9 +80,6 @@ const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)] = {
"DSSTREAM", "DSSTREAM",
"DS3DCALC", "DS3DCALC",
"XMO ", "XMO ",
"RINP ",
"JVS ",
"LIBUSB ",
"KRNL ", "KRNL ",
"LOG ", "LOG ",
"XBOX ", "XBOX ",
@ -105,8 +102,6 @@ const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)] = {
"XE ", "XE ",
}; };
std::atomic_int g_CurrentLogLevel = to_underlying(LOG_LEVEL::INFO); std::atomic_int g_CurrentLogLevel = to_underlying(LOG_LEVEL::INFO);
std::atomic_bool g_CurrentLogPopupTestCase = true;
static bool g_disablePopupMessages = false;
const char log_debug[] = "DEBUG: "; const char log_debug[] = "DEBUG: ";
const char log_info[] = "INFO : "; const char log_info[] = "INFO : ";
@ -116,7 +111,7 @@ const char log_fatal[] = "FATAL: ";
const char log_unkwn[] = "???? : "; const char log_unkwn[] = "???? : ";
// Do not use EmuLogOutput function outside of this file. // Do not use EmuLogOutput function outside of this file.
void EmuLogOutput(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, const va_list argp) void EmuLogOutput(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, va_list argp)
{ {
LOG_THREAD_INIT; LOG_THREAD_INIT;
@ -151,16 +146,9 @@ void EmuLogOutput(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarn
fflush(stdout); fflush(stdout);
} }
inline void EmuLogOutputEx(const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const char *szWarningMessage, ...)
{
va_list argp;
va_start(argp, szWarningMessage);
EmuLogOutput(cxbxr_module, level, szWarningMessage, argp);
va_end(argp);
}
// print out a custom message to the console or kernel debug log file // print out a custom message to the console or kernel debug log file
void EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, ...) void NTAPI EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, ...)
{ {
if (szWarningMessage == NULL) { if (szWarningMessage == NULL) {
return; return;
@ -181,7 +169,7 @@ void EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningM
} }
} }
void EmuLogInit(LOG_LEVEL level, const char *szWarningMessage, ...) void NTAPI EmuLogInit(LOG_LEVEL level, const char *szWarningMessage, ...)
{ {
if (szWarningMessage == NULL) { if (szWarningMessage == NULL) {
return; return;
@ -198,21 +186,19 @@ void EmuLogInit(LOG_LEVEL level, const char *szWarningMessage, ...)
// Set up the logging variables for the GUI process // Set up the logging variables for the GUI process
inline void log_get_settings() inline void log_get_settings()
{ {
log_set_config(g_Settings->m_core.LogLevel, g_Settings->m_core.LoggedModules, g_Settings->m_core.bLogPopupTestCase); log_set_config(g_Settings->m_core.LogLevel, g_Settings->m_core.LoggedModules);
} }
inline void log_sync_config() inline void log_sync_config()
{ {
int LogLevel; int LogLevel;
unsigned int LoggedModules[NUM_INTEGERS_LOG]; unsigned int LoggedModules[NUM_INTEGERS_LOG];
bool LogPopupTestCase;
g_EmuShared->GetLogLv(&LogLevel); g_EmuShared->GetLogLv(&LogLevel);
g_EmuShared->GetLogModules(LoggedModules); g_EmuShared->GetLogModules(LoggedModules);
g_EmuShared->GetLogPopupTestCase(&LogPopupTestCase); log_set_config(LogLevel, LoggedModules);
log_set_config(LogLevel, LoggedModules, LogPopupTestCase);
} }
void log_set_config(int LogLevel, unsigned int* LoggedModules, bool LogPopupTestCase) void log_set_config(int LogLevel, unsigned int* LoggedModules)
{ {
g_CurrentLogLevel = LogLevel; g_CurrentLogLevel = LogLevel;
for (unsigned int index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::MAX); index++) { for (unsigned int index = to_underlying(CXBXR_MODULE::CXBXR); index < to_underlying(CXBXR_MODULE::MAX); index++) {
@ -223,7 +209,6 @@ void log_set_config(int LogLevel, unsigned int* LoggedModules, bool LogPopupTest
g_EnabledModules[index] = false; g_EnabledModules[index] = false;
} }
} }
g_CurrentLogPopupTestCase = LogPopupTestCase;
} }
// Generate active log filter output. // Generate active log filter output.
@ -243,106 +228,6 @@ void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module)
std::cout << std::flush; std::cout << std::flush;
} }
// Use kernel managed environment
void log_init_popup_msg()
{
Settings::s_video vSettings;
g_EmuShared->GetVideoSettings(&vSettings);
g_disablePopupMessages = vSettings.bFullScreen;
}
// TODO: Move PopupPlatformHandler into common GUI's window source code or use imgui in the future.
// PopupPlatformHandler is intended to be use as internal wrapper function.
static PopupReturn PopupPlatformHandler(const char* msg, const PopupReturn ret_default, const UINT uType, const HWND hWnd)
{
int ret = MessageBox(hWnd, msg, /*lpCaption=*/TEXT("Cxbx-Reloaded"), uType);
switch (ret) {
default:
case IDCANCEL:
return PopupReturn::Cancel;
case IDOK:
return PopupReturn::Ok;
case IDABORT:
return PopupReturn::Abort;
case IDRETRY:
return PopupReturn::Retry;
case IDIGNORE:
return PopupReturn::Ignore;
case IDYES:
return PopupReturn::Yes;
case IDNO:
return PopupReturn::No;
}
}
PopupReturn PopupCustomEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const PopupIcon icon, const PopupButtons buttons, const PopupReturn ret_default, const char *message, ...)
{
UINT uType = MB_TOPMOST | MB_SETFOREGROUND;
// Make assert whenever the format string is null pointer which isn't allow in here.
assert(message != nullptr);
switch (icon) {
case PopupIcon::Warning: {
uType |= MB_ICONWARNING;
break;
}
case PopupIcon::Error: {
uType |= MB_ICONERROR; // Note : MB_ICONERROR == MB_ICONSTOP == MB_ICONHAND
break;
}
case PopupIcon::Info: {
uType |= MB_ICONINFORMATION;
break;
}
case PopupIcon::Question:
case PopupIcon::Unknown:
default: {
uType |= MB_ICONQUESTION;
break;
}
}
switch (buttons) {
default:
case PopupButtons::Ok:
uType |= MB_OK;
break;
case PopupButtons::OkCancel:
uType |= MB_OKCANCEL;
break;
case PopupButtons::AbortRetryIgnore:
uType |= MB_ABORTRETRYIGNORE;
break;
case PopupButtons::YesNoCancel:
uType |= MB_YESNOCANCEL;
break;
case PopupButtons::YesNo:
uType |= MB_YESNO;
break;
case PopupButtons::RetryCancel:
uType |= MB_RETRYCANCEL;
break;
}
va_list argp;
va_start(argp, message);
// allocate predicted buffer size then write to buffer afterward.
std::string Buffer(1+std::vsnprintf(nullptr, 0, message, argp), '\0');
vsnprintf(Buffer.data(), Buffer.size(), message, argp);
va_end(argp);
EmuLogOutputEx(cxbxr_module, level, "Popup : %s", Buffer.c_str());
// If user is using exclusive fullscreen, we need to refrain all popups.
if (g_disablePopupMessages) {
return ret_default;
}
return PopupPlatformHandler(Buffer.data(), ret_default, uType, (const HWND)hwnd);
}
const bool needs_escape(const wint_t _char) const bool needs_escape(const wint_t _char)
{ {
// Escaping is needed for control characters, // Escaping is needed for control characters,
@ -396,13 +281,8 @@ inline void output_wchar(std::ostream& os, wchar_t c)
default: os << "\\x" << std::setfill('0') << std::setw(4) << std::right << std::hex << std::uppercase << (wint_t)c; default: os << "\\x" << std::setfill('0') << std::setw(4) << std::right << std::hex << std::uppercase << (wint_t)c;
} }
} }
else { else
const wchar_t *wc = reinterpret_cast<const wchar_t *>(&c); os << c;
std::string dst(2, '\0');
std::mbstate_t ps{};
std::wcsrtombs(dst.data(), &wc, 1, &ps);
os << dst;
}
} }
LOG_SANITIZE_HEADER(hex1, uint8_t) LOG_SANITIZE_HEADER(hex1, uint8_t)

View File

@ -88,9 +88,6 @@ typedef enum class _CXBXR_MODULE: unsigned int {
DSSTREAM, DSSTREAM,
DS3DCALC, DS3DCALC,
XMO, XMO,
RINP,
JVS,
LIBUSB,
// kernel // kernel
KRNL, KRNL,
LOG, LOG,
@ -119,11 +116,10 @@ typedef enum class _CXBXR_MODULE: unsigned int {
extern std::atomic_bool g_EnabledModules[to_underlying(CXBXR_MODULE::MAX)]; extern std::atomic_bool g_EnabledModules[to_underlying(CXBXR_MODULE::MAX)];
extern const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)]; extern const char* g_EnumModules2String[to_underlying(CXBXR_MODULE::MAX)];
extern std::atomic_int g_CurrentLogLevel; extern std::atomic_int g_CurrentLogLevel;
extern std::atomic_bool g_CurrentLogPopupTestCase;
// print out a log message to the console or kernel debug log file if level is high enough // print out a log message to the console or kernel debug log file if level is high enough
void EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, ...); void NTAPI EmuLogEx(CXBXR_MODULE cxbxr_module, LOG_LEVEL level, const char *szWarningMessage, ...);
void EmuLogInit(LOG_LEVEL level, const char *szWarningMessage, ...); void NTAPI EmuLogInit(LOG_LEVEL level, const char *szWarningMessage, ...);
#define EmuLog(level, fmt, ...) EmuLogEx(LOG_PREFIX, level, fmt, ##__VA_ARGS__) #define EmuLog(level, fmt, ...) EmuLogEx(LOG_PREFIX, level, fmt, ##__VA_ARGS__)
@ -131,61 +127,10 @@ extern inline void log_get_settings();
extern inline void log_sync_config(); extern inline void log_sync_config();
void log_set_config(int LogLevel, unsigned int* LoggedModules, bool LogPopupTestCase); void log_set_config(int LogLevel, unsigned int* LoggedModules);
void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module); void log_generate_active_filter_output(const CXBXR_MODULE cxbxr_module);
// Use emulation environment to manage popup messages
// If log_init_popup_msg is not called at earliest point of emulation.
// Then users will have a chance of popup message appear during start of emulation in full screen.
void log_init_popup_msg();
typedef enum class _PopupIcon {
Unknown = 0,
Question,
Info,
Warning,
Error
} PopupIcon;
typedef enum class _PopupButtons {
Unknown = 0,
Ok,
OkCancel,
AbortRetryIgnore,
YesNoCancel,
YesNo,
RetryCancel
} PopupButtons;
typedef enum class _PopupReturn {
Unknown = 0,
Ok,
Cancel,
Abort,
Retry,
Ignore,
Yes,
No
} PopupReturn;
PopupReturn PopupCustomEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const PopupIcon icon, const PopupButtons buttons, const PopupReturn ret_default, const char* message, ...);
#define PopupCustom(hwnd, level, icon, buttons, ret_default, fmt, ...) PopupCustomEx(hwnd, LOG_PREFIX, level, icon, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupQuestionEx(hwnd, level, buttons, ret_default, fmt, ...) PopupCustom(hwnd, level, PopupIcon::Question, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupQuestion(hwnd, fmt, ...) PopupQuestionEx(hwnd, LOG_LEVEL::INFO, PopupButtons::YesNoCancel, PopupReturn::Cancel, fmt, ## __VA_ARGS__)
#define PopupInfoEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::INFO, PopupIcon::Info, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupInfo(hwnd, fmt, ...) (void)PopupInfoEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
#define PopupWarningEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::WARNING, PopupIcon::Warning, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupWarning(hwnd, fmt, ...) (void)PopupWarningEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
#define PopupErrorEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::ERROR2, PopupIcon::Error, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupError(hwnd, fmt, ...) (void)PopupErrorEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
#define PopupFatalEx(hwnd, buttons, ret_default, fmt, ...) PopupCustom(hwnd, LOG_LEVEL::FATAL, PopupIcon::Error, buttons, ret_default, fmt, ## __VA_ARGS__)
#define PopupFatal(hwnd, fmt, ...) (void)PopupFatalEx(hwnd, PopupButtons::Ok, PopupReturn::Ok, fmt, ## __VA_ARGS__)
// For LOG_TEST_CASE
extern inline void EmuLogOutputEx(const CXBXR_MODULE cxbxr_module, const LOG_LEVEL level, const char *szWarningMessage, ...);
// //
// __FILENAME__ // __FILENAME__
// //
@ -225,30 +170,9 @@ extern inline void output_wchar(std::ostream& os, wchar_t c);
// By default, sanitization functions simply return the given argument // By default, sanitization functions simply return the given argument
// (type and value) which results in calls to standard output writers. // (type and value) which results in calls to standard output writers.
template<class T> template<class T>
inline auto _log_sanitize(T value, int ignored_length = 0) inline T _log_sanitize(T value, int ignored_length = 0)
{ {
// This is necessary because C++20 has deleted the overloaded operator<< of ostream for wchar_t, char8_t, char16_t and char32_t. return value;
// The proper solution is to use wide strings in all our logging macros/functions, see https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/743
if constexpr (std::is_same_v<xbox::wchar_xt, std::remove_cvref_t<std::remove_pointer_t<T>>>) {
if constexpr (std::is_pointer_v<T>) {
const wchar_t *wstr = reinterpret_cast<const wchar_t *>(value);
std::size_t len = std::wcslen(wstr);
std::string dst(len + 1, '\0');
std::mbstate_t ps{};
std::wcsrtombs(dst.data(), &wstr, len, &ps);
return dst;
}
else {
const wchar_t *wstr = reinterpret_cast<const wchar_t *>(&value);
std::string dst(2, '\0');
std::mbstate_t ps{};
std::wcsrtombs(dst.data(), &wstr, 1, &ps);
return dst;
}
}
else {
return value;
}
} }
#if 0 // TODO FIXME : Disabled for now, as this is incorrectly called for INT types too #if 0 // TODO FIXME : Disabled for now, as this is incorrectly called for INT types too
@ -315,13 +239,13 @@ constexpr const char* remove_prefix(const char* str, const char *prefix) {
return (str_skip_prefix(str, prefix) == str + str_length(prefix)) ? str_skip_prefix(str, prefix) : str; return (str_skip_prefix(str, prefix) == str + str_length(prefix)) ? str_skip_prefix(str, prefix) : str;
} }
static constexpr const char* xbox_prefix = "xbox::"; constexpr char* xtl_prefix = "XTL::";
static constexpr const char* emupatch_prefix = "EmuPatch_"; // See #define EMUPATCH constexpr char* emupatch_prefix = "EmuPatch_"; // See #define EMUPATCH
constexpr const char* remove_emupatch_prefix(const char* str) { constexpr const char* remove_emupatch_prefix(const char* str) {
// return an empty string when str isn't given // return an empty string when str isn't given
// skip xbox:: and/or EmuPatch_ prefix if present // skip XTL:: and/or EmuPatch_ prefix if present
return remove_prefix(remove_prefix(str, xbox_prefix), emupatch_prefix); return remove_prefix(remove_prefix(str, xtl_prefix), emupatch_prefix);
} }
#define LOG_ARG_START "\n " << std::setfill(' ') << std::setw(20) << std::left #define LOG_ARG_START "\n " << std::setfill(' ') << std::setw(20) << std::left
@ -399,44 +323,6 @@ extern thread_local std::string _logThreadPrefix;
} } while (0); \ } } while (0); \
} }
#define LOG_FUNC_BEGIN_ARG_RESULT_NO_INIT \
do { if(g_bPrintfOn) { \
bool _had_arg = false; \
std::stringstream msg; \
msg << _logThreadPrefix << _logFuncPrefix << " returns OUT {";
#define LOG_FUNC_BEGIN_ARG_RESULT \
LOG_CHECK_ENABLED(LOG_LEVEL::DEBUG) { \
LOG_FUNC_BEGIN_ARG_RESULT_NO_INIT
// LOG_FUNC_ARG_RESULT writes output via all available ostream << operator overloads, sanitizing and adding detail where possible
#define LOG_FUNC_ARG_RESULT(arg) \
_had_arg = true; \
msg << LOG_ARG_START << "*"#arg << " : "; \
if (arg != nullptr) { \
msg << _log_sanitize(*arg); \
} else { \
msg << "NOT SET"; \
}
// LOG_FUNC_ARG_RESULT_TYPE writes result output using the overloaded << operator of the given type
#define LOG_FUNC_ARG_RESULT_TYPE(type, arg) \
_had_arg = true; \
msg << LOG_ARG_START << "*"#arg << " : "; \
if (arg != nullptr) { \
msg << (type)*arg; \
} else { \
msg << "NOT SET"; \
}
// LOG_FUNC_END_ARG_RESULT closes off function and optional argument result logging
#define LOG_FUNC_END_ARG_RESULT \
if (_had_arg) msg << "\n"; \
msg << "};\n"; \
std::cout << msg.str(); \
} } while (0); \
}
// LOG_FUNC_RESULT logs the function return result // LOG_FUNC_RESULT logs the function return result
#define LOG_FUNC_RESULT(r) \ #define LOG_FUNC_RESULT(r) \
std::cout << _logThreadPrefix << _logFuncPrefix << " returns " << _log_sanitize(r) << "\n"; std::cout << _logThreadPrefix << _logFuncPrefix << " returns " << _log_sanitize(r) << "\n";

View File

@ -1,324 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of Cxbx-Reloaded.
// *
// * Cxbx-Reloaded is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2017-2019 Patrick van Logchem <pvanlogchem@gmail.com>
// * (c) 2019 ergo720
// *
// * All rights reserved
// *
// ******************************************************************
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <Windows.h> // For DWORD, CALLBACK, VirtualAlloc, LPVOID, SIZE_T, HMODULE
// NOTE: Cannot be use in loader project due to force exclude std libraries.
//#define DEBUG // Uncomment whenever need to verify memory leaks or bad configure.
#ifdef DEBUG
#include <cstdio> // For printf
#endif
#include <cstdint> // For uint32_t
#include "util/std_extend.hpp"
#include "ReserveAddressRanges.h"
#include "AddressRanges.h"
// Reserve an address range up to the extend of what the host allows.
bool ReserveMemoryRange(int index, blocks_reserved_t blocks_reserved)
{
uint32_t Start = XboxAddressRanges[index].Start;
int Size = XboxAddressRanges[index].Size;
bool HadAnyFailure = false;
// Reserve this range in 64 KiB block increments, so that during emulation
// our memory-management code can VirtualFree() each block individually :
const DWORD Protect = XboxAddressRanges[index].InitialMemoryProtection;
bool NeedsReservationTracking = false;
unsigned int arr_index = BLOCK_REGION_DEVKIT_INDEX_BEGIN;
static HANDLE hFileMapping1;
static HANDLE hFileMapping2;
#ifdef DEBUG
std::printf("DEBUG: ReserveMemoryRange call begin\n");
std::printf(" : Comment = %s\n", XboxAddressRanges[index].Comment);
#endif
switch (Start) {
case PHYSICAL_MAP1_BASE:
hFileMapping1 = CreateFileMapping(
INVALID_HANDLE_VALUE,
nullptr,
PAGE_EXECUTE_READWRITE,
0,
Size,
nullptr);
if (hFileMapping1 == nullptr) {
HadAnyFailure = true;
break;
}
[[fallthrough]];
case PHYSICAL_MAP2_BASE:
case TILED_MEMORY_BASE: {
static bool NeedsInitializationMap = true;
if (NeedsInitializationMap) {
hFileMapping2 = CreateFileMapping(
INVALID_HANDLE_VALUE,
nullptr,
PAGE_EXECUTE_READWRITE,
0,
Size,
nullptr);
if (hFileMapping2 == nullptr) {
HadAnyFailure = true;
break;
}
NeedsInitializationMap = false;
}
LPVOID Result = MapViewOfFileEx(
(Start == PHYSICAL_MAP1_BASE || Start == TILED_MEMORY_BASE) ? hFileMapping1 : hFileMapping2,
(Start == PHYSICAL_MAP1_BASE || Start == PHYSICAL_MAP2_BASE) ?
(FILE_MAP_READ | FILE_MAP_WRITE | FILE_MAP_EXECUTE) : (FILE_MAP_READ | FILE_MAP_WRITE),
0,
0,
Size,
(LPVOID)Start);
#ifdef DEBUG
std::printf(" : MapViewOfFile; Start = 0x%08X; Result = %p\n", Start, Result);
#endif
if (Result == nullptr) {
HadAnyFailure = true;
}
}
break;
case SYSTEM_MEMORY_BASE:
// If additional addresses need to be assign in region's block.
// Then check for nonzero value.
arr_index = BLOCK_REGION_SYSTEM_INDEX_BEGIN;
[[fallthrough]];
case DEVKIT_MEMORY_BASE:
// arr_index's default is BLOCK_REGION_DEVKIT_INDEX_BEGIN which is zero.
// Any block region above zero should be place above this case to override zero value.
//arr_index = BLOCK_REGION_DEVKIT_INDEX_BEGIN;
NeedsReservationTracking = true;
[[fallthrough]];
default: {
while (Size > 0) {
SIZE_T BlockSize = (SIZE_T)(Size > BLOCK_SIZE) ? BLOCK_SIZE : Size;
LPVOID Result = VirtualAlloc((LPVOID)Start, BlockSize, MEM_RESERVE, Protect);
if (Result == nullptr) {
HadAnyFailure = true;
}
#ifdef DEBUG
std::printf(" : Start = %08X; Result = %p;\n", Start, Result);
#endif
// Handle the next block
Start += BLOCK_SIZE;
Size -= BLOCK_SIZE;
if (NeedsReservationTracking) {
if (Result != nullptr) {
blocks_reserved[arr_index / 32] |= (1 << (arr_index % 32));
#ifdef DEBUG
std::printf(" : arr_index = 0x%08X; set bit = 0x%08X;\n", arr_index, (1 << (arr_index % 32)));
std::printf(" : blocks_reserved[%08X] = 0x%08X\n", arr_index/32, blocks_reserved[arr_index/32]);
#endif
}
arr_index++;
}
}
}
}
#ifdef DEBUG
std::printf(" : ReserveMemoryRange call end: HadAnyFailure = %d\n\n", HadAnyFailure);
#endif
// Only a complete success when the entire request was reserved in a single range
// (Otherwise, we have either a complete failure, or reserved it partially over multiple ranges)
return !HadAnyFailure;
}
// Free address range from the host.
void FreeMemoryRange(int index, blocks_reserved_t blocks_reserved)
{
uint32_t Start = XboxAddressRanges[index].Start, _Start;
int Size = XboxAddressRanges[index].Size;
bool NeedsReservationTracking = false;
unsigned int arr_index = BLOCK_REGION_DEVKIT_INDEX_BEGIN;
#ifdef DEBUG
std::printf("DEBUG: FreeMemoryRange call begin\n");
std::printf(" : Comment = %s\n", XboxAddressRanges[index].Comment);
#endif
switch (Start) {
case PHYSICAL_MAP1_BASE:
case PHYSICAL_MAP2_BASE:
case TILED_MEMORY_BASE: {
(void)UnmapViewOfFile((LPVOID)Start);
#ifdef DEBUG
std::printf(" : UnmapViewOfFile; Start = 0x%08X\n", Start);
#endif
}
break;
case SYSTEM_MEMORY_BASE:
// If additional addresses need to be assign in region's block.
// Then check for nonzero value.
arr_index = BLOCK_REGION_SYSTEM_INDEX_BEGIN;
[[fallthrough]];
case DEVKIT_MEMORY_BASE: {
// arr_index's default is BLOCK_REGION_DEVKIT_INDEX_BEGIN which is zero.
// Any block region above zero should be place above this case to override zero value.
//arr_index = BLOCK_REGION_DEVKIT_INDEX_BEGIN;
NeedsReservationTracking = true;
}
[[fallthrough]];
default: {
while (Size > 0) {
_Start = Start; // Require to silence C6001's warning complaint
BOOL Result = VirtualFree((LPVOID)_Start, 0, MEM_RELEASE);
#ifdef DEBUG
std::printf(" : Start = %08X; Result = %d;\n", Start, Result);
#endif
// Handle the next block
Start += BLOCK_SIZE;
Size -= BLOCK_SIZE;
if (NeedsReservationTracking) {
if (Result != 0) {
blocks_reserved[arr_index / 32] &= ~(1 << (arr_index % 32));
#ifdef DEBUG
std::printf(" : arr_index = 0x%08X; clear bit = 0x%08X;\n", arr_index, (1 << (arr_index % 32)));
std::printf(" : blocks_reserved[%08X] = 0x%08X\n", arr_index/32, blocks_reserved[arr_index/32]);
#endif
}
arr_index++;
}
}
}
}
#ifdef DEBUG
std::printf(" : FreeMemoryRange call end\n\n");
#endif
}
bool ReserveAddressRanges(const unsigned int system, blocks_reserved_t blocks_reserved) {
// Loop over all Xbox address ranges
for (size_t i = 0; i < XboxAddressRanges_size; i++) {
// Skip address ranges that don't match the given flags
if (!AddressRangeMatchesFlags(i, system))
continue;
// Try to reserve each address range
if (ReserveMemoryRange(i, blocks_reserved))
continue;
// Some ranges are allowed to fail reserving
if (!IsOptionalAddressRange(i)) {
return false;
}
}
return true;
}
void FreeAddressRanges(const unsigned int system, unsigned int release_systems, blocks_reserved_t blocks_reserved) {
// If reserved_systems is empty, then there's nothing to be freed up.
if (release_systems == 0) {
return;
}
// Loop over all Xbox address ranges
for (size_t i = 0; i < XboxAddressRanges_size; i++) {
// Skip address ranges that do match specific flag
if (AddressRangeMatchesFlags(i, system))
continue;
// Skip address ranges that doesn't match the reserved flags
if (!AddressRangeMatchesFlags(i, release_systems))
continue;
FreeMemoryRange(i, blocks_reserved);
}
}
bool AttemptReserveAddressRanges(unsigned int* p_reserved_systems, blocks_reserved_t blocks_reserved) {
size_t iLast = 0;
unsigned int reserved_systems = *p_reserved_systems, clear_systems = 0;
// Loop over all Xbox address ranges
for (size_t i = 0; i < XboxAddressRanges_size; i++) {
// Once back to original spot, let's resume.
if (i == iLast && clear_systems) {
reserved_systems &= ~clear_systems;
if (reserved_systems == 0) {
*p_reserved_systems = 0;
return false;
}
// Resume virtual allocated range.
clear_systems = 0;
continue;
}
if (clear_systems) {
// Skip address ranges that doesn't match the given flags
if (!AddressRangeMatchesFlags(i, clear_systems))
continue;
// Release incompatible system's memory range
FreeMemoryRange(i, blocks_reserved);
}
else {
// Skip address ranges that don't match the given flags
if (!AddressRangeMatchesFlags(i, reserved_systems))
continue;
// Try to reserve each address range
if (ReserveMemoryRange(i, blocks_reserved))
continue;
// Some ranges are allowed to fail reserving
if (!IsOptionalAddressRange(i)) {
// If not, then let's free them and downgrade host's limitation.
clear_systems = AddressRangeGetSystemFlags(i);
iLast = i;
i = -1; // Reset index back to zero after for statement's increment.
continue;
}
}
}
*p_reserved_systems = reserved_systems;
return true;
}
bool isSystemFlagSupport(unsigned int reserved_systems, unsigned int assign_system)
{
if (reserved_systems & assign_system) {
return true;
}
return false;
}

View File

@ -1,47 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of Cxbx-Reloaded.
// *
// * Cxbx-Reloaded is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2017-2019 Patrick van Logchem <pvanlogchem@gmail.com>
// *
// * All rights reserved
// *
// ******************************************************************
#pragma once
#include <cstdint> // For uint32_t
// First block section will be devkit region (256MiB) = 262144KiB / 64 KiB = 4096 bits needed -> 4096 / 32 (sizeof(uint32_t)) = 128 entries blocks_reserved array.
// Next block section will be system region (512MiB) = 524288KiB / 64KiB = 8192 bits needed -> 8192 / 32 (sizeof(uint32_t)) = 256 entries of blocks_reserved array.
// 1 bit per block_size (64KiB).
typedef uint32_t blocks_reserved_t[384]; // 384 = 128 (devkit region) + 256 (system region)
inline constexpr uint32_t BLOCK_REGION_DEVKIT_INDEX_BEGIN = 0;
inline constexpr uint32_t BLOCK_REGION_DEVKIT_INDEX_END = 4096;
inline constexpr uint32_t BLOCK_REGION_SYSTEM_INDEX_BEGIN = 4096;
inline constexpr uint32_t BLOCK_REGION_SYSTEM_INDEX_END = 12288;
extern bool ReserveAddressRanges(const unsigned int system, blocks_reserved_t blocks_reserved);
extern void FreeAddressRanges(const unsigned int system, unsigned int release_systems, blocks_reserved_t blocks_reserved);
extern bool AttemptReserveAddressRanges(unsigned int* p_reserved_systems, blocks_reserved_t blocks_reserved);
extern bool isSystemFlagSupport(unsigned int reserved_systems, unsigned int assign_system);

View File

@ -0,0 +1,53 @@
// ******************************************************************
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2016 Patrick van Logchem <pvanlogchem@gmail.com>
// *
// * All rights reserved
// *
// ******************************************************************
#ifndef RESERVEDMEMORY_H
#define RESERVEDMEMORY_H
#if defined(__cplusplus)
extern "C"
{
#endif
#include "EmuShared.h" // For XBE_MAX_VA, XBE_IMAGE_BASE and CXBX_BASE_OF_CODE
// The following code reserves virtual addresses from 0x00011000 upwards;
#define VM_PLACEHOLDER_SIZE (XBE_MAX_VA - XBE_IMAGE_BASE - CXBX_BASE_OF_CODE)
// First, declare the '.text' section again :
#pragma section(".text") // Note : 'read,write,execute' would cause a warning
// Then place the following variable into the '.text' section :
__declspec(allocate(".text"))
// This variable *MUST* be this large, for it to take up address space
// so that all other code and data in this module are placed outside of the
// maximum virtual memory range.
unsigned char virtual_memory_placeholder[VM_PLACEHOLDER_SIZE]; // = { OPCODE_NOP_90 };
// TODO : Try to get the same result without enlarging our executable by 128 MB!
#if defined(__cplusplus)
}
#endif
#endif // RESERVEDMEMORY_H

View File

@ -27,15 +27,12 @@
// * // *
// ****************************************************************** // ******************************************************************
#define LOG_PREFIX CXBXR_MODULE::CXBXR
#include "Settings.hpp" #include "Settings.hpp"
#include "core\kernel\support\Emu.h" #include "core\kernel\support\Emu.h"
#include "EmuShared.h" #include "EmuShared.h"
#include <filesystem> #include <filesystem>
#include "common\input\layout_xbox_device.h" #include "common\input\InputManager.h"
#include <fstream> #include "common\input\layout_xbox_controller.h"
#include "common/util/cliConfig.hpp"
// TODO: Implement Qt support when real CPU emulation is available. // TODO: Implement Qt support when real CPU emulation is available.
#ifndef QT_VERSION // NOTE: Non-Qt will be using current directory for data #ifndef QT_VERSION // NOTE: Non-Qt will be using current directory for data
@ -48,28 +45,21 @@ static_assert(false, "Please implement support for cross-platform's user profile
#include <QStandardPaths> // for cross-platform's user profile support #include <QStandardPaths> // for cross-platform's user profile support
#endif #endif
std::string g_exec_filepath;
// Individual library version // Individual library version
uint16_t g_LibVersion_D3D8 = 0; uint16_t g_LibVersion_D3D8 = 0;
uint16_t g_LibVersion_DSOUND = 0; uint16_t g_LibVersion_DSOUND = 0;
// NOTE: Update settings_version when conversion to setting's structure is required. // NOTE: Update settings_version when add/edit/delete setting's structure.
// UPDATE: When settings are removed, use "if (use false && settings_version < {next_version}) {" statement
// until existing settings require replacement or conversion. next_version input is a hardcode number.
// Settings version 10 and later should consider as not backward compatible.
// TODO: Add read-only state when using an older build and add a notification for will not be able save to file.
// The sooner we do this, the better before version upgrade.
/////////////////////////// ///////////////////////////
// * History: // * History:
// * 2: (RadWolfie), initial version // * 2: (RadWolfie), initial version
// * 3: (ergo720), added logging settings // * 3: (ergo720), added logging settings
// * 4: (LukeUsher), added network settings // * 4: (LukeUsher), added network settings
// * 5: (ergo720), added new input gui settings and revision to core // * 5: (ergo720), added new input gui settings and revision to core
// * 6: (RadWolfie), added loader executable member to core, only for clean up loader expertimental setting
// * 7: (RadWolfie), fix allowAdminPrivilege not align with other boolean members
// * 8: (ergo720), added general input settings
// * 9: (LukeUsher), replaced HardwareYUV with MaintainAspect
/////////////////////////// ///////////////////////////
const unsigned int settings_version = 9; const unsigned int settings_version = 5;
Settings* g_Settings = nullptr; Settings* g_Settings = nullptr;
@ -88,9 +78,6 @@ static struct {
const char* RecentXbeFiles = "RecentXbeFiles"; const char* RecentXbeFiles = "RecentXbeFiles";
const char* DataStorageToggle = "DataStorageToggle"; const char* DataStorageToggle = "DataStorageToggle";
const char* DataCustomLocation = "DataCustomLocation"; const char* DataCustomLocation = "DataCustomLocation";
const char* IgnoreInvalidXbeSig = "IgnoreInvalidXbeSig";
const char *IgnoreInvalidXbeSec = "IgnoreInvalidXbeSec";
const char* ConsoleTypeToggle = "ConsoleTypeToggle";
} sect_gui_keys; } sect_gui_keys;
static const char* section_core = "core"; static const char* section_core = "core";
@ -102,7 +89,6 @@ static struct {
const char* AllowAdminPrivilege = "AllowAdminPrivilege"; const char* AllowAdminPrivilege = "AllowAdminPrivilege";
const char* LoggedModules = "LoggedModules"; const char* LoggedModules = "LoggedModules";
const char* LogLevel = "LogLevel"; const char* LogLevel = "LogLevel";
const char* LogPopupTestCase = "LogPopupTestCase";
} sect_core_keys; } sect_core_keys;
static const char* section_video = "video"; static const char* section_video = "video";
@ -112,19 +98,10 @@ static struct {
const char* Direct3DDevice = "Direct3DDevice"; const char* Direct3DDevice = "Direct3DDevice";
const char* VSync = "VSync"; const char* VSync = "VSync";
const char* FullScreen = "FullScreen"; const char* FullScreen = "FullScreen";
const char* MaintainAspect = "MaintainAspect"; const char* HardwareYUV = "HardwareYUV";
const char* RenderResolution = "RenderResolution"; const char* RenderResolution = "RenderResolution";
} sect_video_keys; } sect_video_keys;
static const char* section_overlay = "overlay";
static struct {
const char* build_hash = "Build Hash";
const char* FPS = "FPS";
const char* hle_lle_stats = "HLE/LLE Stats";
const char* title_name = "Title Name";
const char* file_name = "File Name";
} sect_overlay_keys;
static const char* section_audio = "audio"; static const char* section_audio = "audio";
static struct { static struct {
const char* adapter = "adapter"; const char* adapter = "adapter";
@ -140,24 +117,15 @@ static struct {
const char* adapter_name = "adapter_name"; const char* adapter_name = "adapter_name";
} sect_network_keys; } sect_network_keys;
static const char *section_input_general = "input-general";
static struct {
const char *mo_axis_range = "MouseAxisRange";
const char *mo_wheel_range = "MouseWheelRange";
const char *ignore_kbmo_unfocus = "IgnoreKbMoUnfocus";
} sect_input_general;
static const char* section_controller_dinput = "controller-dinput"; static const char* section_controller_dinput = "controller-dinput";
static const char* section_controller_port = "controller-port"; static const char* section_controller_port = "controller-port";
static const char* section_input_port = "input-port-"; static const char* section_input = "input-port-";
static struct { static struct {
const char* type = "Type"; const char* type = "Type";
const char* device = "DeviceName"; const char* device = "DeviceName";
const char* config = "ProfileName"; const char* config = "ProfileName";
const char *top_slot = "TopSlot"; } sect_input;
const char *bottom_slot = "BottomSlot";
} sect_input_port;
static const char* section_input_profiles = "input-profile-"; static const char* section_input_profiles = "input-profile-";
static struct { static struct {
@ -176,9 +144,7 @@ static struct {
std::string GenerateExecDirectoryStr() std::string GenerateExecDirectoryStr()
{ {
std::string exec_path; return g_exec_filepath.substr(0, g_exec_filepath.find_last_of("\\/"));
(void)cli_config::GetValue(cli_config::exec, &exec_path);
return exec_path.substr(0, exec_path.find_last_of("\\/"));
} }
// NOTE: This function will be only have Qt support, std::filesystem doesn't have generic support. // NOTE: This function will be only have Qt support, std::filesystem doesn't have generic support.
@ -237,33 +203,74 @@ bool Settings::Init()
// Enter setup installer process // Enter setup installer process
if (!bRet) { if (!bRet) {
std::string setupFile; std::string saveFile;
m_gui.DataStorageToggle = SetupFile(setupFile); #ifdef RETRO_API_VERSION // TODO: Change me to #ifndef QT_VERSION
// Can only have one option without Qt.
saveFile = GenerateExecDirectoryStr();
if (m_gui.DataStorageToggle == CXBX_DATA_INVALID) { #else // Only support for Qt compile build.
int iRet = MessageBox(nullptr, szSettings_save_user_option_message, "Cxbx-Reloaded", MB_YESNOCANCEL | MB_ICONQUESTION);
if (iRet == IDYES) {
saveFile = GenerateExecDirectoryStr();
m_gui.DataStorageToggle = CXBX_DATA_EXECDIR;
}
else if (iRet == IDNO){
saveFile = GenerateUserProfileDirectoryStr();
m_gui.DataStorageToggle = CXBX_DATA_APPDATA;
if (saveFile.size() == 0) {
return false;
}
// Check if data directory exists.
bRet = std::filesystem::exists(saveFile);
if (!bRet) {
// Then try create data directory.
bRet = std::filesystem::create_directory(saveFile);
if (!bRet) {
// Unable to create a data directory
return false;
}
}
}
else {
return false; return false;
} }
#endif
saveFile.append(szSettings_settings_file);
// Call LoadConfig, this will load the config, applying defaults for any missing fields // Call LoadConfig, this will load the config, applying defaults for any missing fields
bRet = LoadConfig(); bRet = LoadConfig();
if (!bRet) { if (!bRet) {
PopupError(nullptr, szSettings_setup_error); MessageBox(nullptr, szSettings_setup_error, "Cxbx-Reloaded", MB_OK);
return false; return false;
} }
bRet = Save(setupFile); bRet = Save(saveFile);
} }
return bRet; return bRet;
} }
bool Settings::LoadUserConfig() bool Settings::LoadUserConfig()
{ {
std::string fileSearch; std::string fileSearch = GenerateExecDirectoryStr();
m_gui.DataStorageToggle = FindSettingsLocation(fileSearch);
if (m_gui.DataStorageToggle == CXBX_DATA_INVALID) { fileSearch.append(szSettings_settings_file);
return false;
// Check and see if file exists from portable, current, directory.
if (std::filesystem::exists(fileSearch) == false) {
fileSearch = GenerateUserProfileDirectoryStr();
if (fileSearch.size() == 0) {
return false;
}
fileSearch.append(szSettings_settings_file);
// Check if the user profile directory settings file exists.
if (std::filesystem::exists(fileSearch) == false) {
return false;
}
} }
return LoadFile(fileSearch); return LoadFile(fileSearch);
@ -340,11 +347,6 @@ bool Settings::LoadConfig()
index++; index++;
} }
m_gui.bIgnoreInvalidXbeSig = m_si.GetBoolValue(section_gui, sect_gui_keys.IgnoreInvalidXbeSig, /*Default=*/false);
m_gui.bIgnoreInvalidXbeSec = m_si.GetBoolValue(section_gui, sect_gui_keys.IgnoreInvalidXbeSec, /*Default=*/false);
m_gui.ConsoleTypeToggle = (EMU_CONSOLE_TYPE)m_si.GetLongValue(section_gui, sect_gui_keys.ConsoleTypeToggle, /*Default=*/EMU_CONSOLE_TYPE_AUTO);
// ==== GUI End ============= // ==== GUI End =============
// ==== Core Begin ========== // ==== Core Begin ==========
@ -386,14 +388,9 @@ bool Settings::LoadConfig()
m_core.LoggedModules[index] = 0; m_core.LoggedModules[index] = 0;
index++; index++;
} }
m_core.bLogPopupTestCase = m_si.GetBoolValue(section_core, sect_core_keys.LogPopupTestCase, /*Default=*/true);
// ==== Core End ============ // ==== Core End ============
// Delete/update legacy configs from previous revisions
RemoveLegacyConfigs(m_core.Revision);
m_core.Revision = settings_version;
// ==== Hack Begin ========== // ==== Hack Begin ==========
m_hacks.DisablePixelShaders = m_si.GetBoolValue(section_hack, sect_hack_keys.DisablePixelShaders, /*Default=*/false); m_hacks.DisablePixelShaders = m_si.GetBoolValue(section_hack, sect_hack_keys.DisablePixelShaders, /*Default=*/false);
@ -418,7 +415,7 @@ bool Settings::LoadConfig()
m_video.direct3DDevice = m_si.GetLongValue(section_video, sect_video_keys.Direct3DDevice, /*Default=*/0); m_video.direct3DDevice = m_si.GetLongValue(section_video, sect_video_keys.Direct3DDevice, /*Default=*/0);
m_video.bVSync = m_si.GetBoolValue(section_video, sect_video_keys.VSync, /*Default=*/false); m_video.bVSync = m_si.GetBoolValue(section_video, sect_video_keys.VSync, /*Default=*/false);
m_video.bFullScreen = m_si.GetBoolValue(section_video, sect_video_keys.FullScreen, /*Default=*/false); m_video.bFullScreen = m_si.GetBoolValue(section_video, sect_video_keys.FullScreen, /*Default=*/false);
m_video.bMaintainAspect = m_si.GetBoolValue(section_video, sect_video_keys.MaintainAspect, /*Default=*/true); m_video.bHardwareYUV = m_si.GetBoolValue(section_video, sect_video_keys.HardwareYUV, /*Default=*/false);
m_video.renderScaleFactor = m_si.GetLongValue(section_video, sect_video_keys.RenderResolution, /*Default=*/1); m_video.renderScaleFactor = m_si.GetLongValue(section_video, sect_video_keys.RenderResolution, /*Default=*/1);
// ==== Video End =========== // ==== Video End ===========
@ -463,74 +460,39 @@ bool Settings::LoadConfig()
// ==== Network End ========= // ==== Network End =========
// ==== Input General Begin ==== // ==== Input Begin ====
m_input_general.MoAxisRange = m_si.GetLongValue(section_input_general, sect_input_general.mo_axis_range, MO_AXIS_DEFAULT_RANGE);
m_input_general.MoWheelRange = m_si.GetLongValue(section_input_general, sect_input_general.mo_wheel_range, MO_WHEEL_DEFAULT_RANGE);
m_input_general.IgnoreKbMoUnfocus = m_si.GetBoolValue(section_input_general, sect_input_general.ignore_kbmo_unfocus, true);
// ==== Input General End ==============
// ==== Input Port Begin ====
for (int port_num = 0; port_num < 4; port_num++) { for (int port_num = 0; port_num < 4; port_num++) {
for (int slot = 0; slot < XBOX_CTRL_NUM_SLOTS; ++slot) { std::string current_section = std::string(section_input) + std::to_string(port_num);
m_input_port[port_num].Type = to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID); int ret = m_si.GetLongValue(current_section.c_str(), sect_input.type, -2);
m_input_port[port_num].SlotType[slot] = to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID); if (ret == -2) {
m_input[port_num].Type = to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID);
std::string current_section = std::string(section_input_port) + std::to_string(port_num); continue;
int ret = m_si.GetLongValue(current_section.c_str(), sect_input_port.type, -2);
if (ret == -2) {
continue;
}
m_input_port[port_num].Type = ret;
m_input_port[port_num].DeviceName = m_si.GetValue(current_section.c_str(), sect_input_port.device);
m_input_port[port_num].ProfileName = TrimQuoteFromString(m_si.GetValue(current_section.c_str(), sect_input_port.config));
ret = m_si.GetLongValue(current_section.c_str(), slot == 0 ? sect_input_port.top_slot : sect_input_port.bottom_slot, -2);
if (ret == -2) {
continue;
}
m_input_port[port_num].SlotType[slot] = ret;
} }
m_input[port_num].Type = ret;
m_input[port_num].DeviceName = m_si.GetValue(current_section.c_str(), sect_input.device);
m_input[port_num].ProfileName = TrimQuoteFromString(m_si.GetValue(current_section.c_str(), sect_input.config));
} }
// ==== Input Port End ============== // ==== Input End ==============
// ==== Input Profile Begin ==== // ==== Input Profile Begin ====
std::array<std::vector<std::string>, to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)> control_names; std::array<std::vector<std::string>, to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)> control_names;
for (int device = 0; device < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); device++) { for (int device = 0; device < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); device++) {
if (dev_num_buttons[device] == 0) { if (dev_num_buttons[device] == 0) {
continue; continue;
} }
const auto &lambda = [&control_names, &device](int num_buttons, const char *const ctrl_names[]) { for (int i = 0; i < dev_num_buttons[device]; i++) {
for (int i = 0; i < num_buttons; i++) { char control_name[30];
char control_name[XBOX_BUTTON_NAME_LENGTH]; std::sprintf(control_name, sect_input_profiles.control, button_xbox_ctrl_names[i][0]);
std::sprintf(control_name, sect_input_profiles.control, ctrl_names[i]); control_names[device].push_back(control_name);
control_names[device].push_back(control_name);
}
};
switch (device)
{
case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE):
case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S):
case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK):
lambda(dev_num_buttons[device], button_xbox_ctrl_names);
break;
case to_underlying(XBOX_INPUT_DEVICE::STEEL_BATTALION_CONTROLLER):
lambda(dev_num_buttons[device], button_sbc_names);
break;
case to_underlying(XBOX_INPUT_DEVICE::LIGHTGUN):
lambda(dev_num_buttons[device], button_lightgun_names);
break;
} }
} }
// TODO: add the control names of the other devices
index = 0; index = 0;
while (true) { while (true) {
std::string current_section = std::string(section_input_profiles) + std::to_string(index); std::string current_section = std::string(section_input_profiles) + std::to_string(index);
@ -551,15 +513,9 @@ bool Settings::LoadConfig()
// ==== Input Profile End ====== // ==== Input Profile End ======
// ==== Overlay Begin ========= // Delete legacy configs from previous revisions
RemoveLegacyConfigs(m_core.Revision);
m_overlay.build_hash = m_si.GetBoolValue(section_overlay, sect_overlay_keys.build_hash, false); m_core.Revision = settings_version;
m_overlay.fps = m_si.GetBoolValue(section_overlay, sect_overlay_keys.FPS, false);
m_overlay.hle_lle_stats = m_si.GetBoolValue(section_overlay, sect_overlay_keys.hle_lle_stats, false);
m_overlay.title_name = m_si.GetBoolValue(section_overlay, sect_overlay_keys.title_name, false);
m_overlay.file_name = m_si.GetBoolValue(section_overlay, sect_overlay_keys.file_name, false);
// ==== Overlay End ===========
return true; return true;
} }
@ -588,11 +544,6 @@ bool Settings::Save(std::string file_path)
m_si.SetValue(section_gui, sect_gui_keys.RecentXbeFiles, m_gui.szRecentXbeFiles[i].c_str(), nullptr, false); m_si.SetValue(section_gui, sect_gui_keys.RecentXbeFiles, m_gui.szRecentXbeFiles[i].c_str(), nullptr, false);
} }
m_si.SetBoolValue(section_gui, sect_gui_keys.IgnoreInvalidXbeSig, m_gui.bIgnoreInvalidXbeSig, nullptr, true);
m_si.SetBoolValue(section_gui, sect_gui_keys.IgnoreInvalidXbeSec, m_gui.bIgnoreInvalidXbeSec, nullptr, true);
m_si.SetLongValue(section_gui, sect_gui_keys.ConsoleTypeToggle, m_gui.ConsoleTypeToggle, nullptr, true, true);
// ==== GUI End ============= // ==== GUI End =============
// ==== Core Begin ========== // ==== Core Begin ==========
@ -612,7 +563,6 @@ bool Settings::Save(std::string file_path)
stream << "0x" << std::hex << m_core.LoggedModules[i]; stream << "0x" << std::hex << m_core.LoggedModules[i];
m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false); m_si.SetValue(section_core, sect_core_keys.LoggedModules, stream.str().c_str(), nullptr, false);
} }
m_si.SetBoolValue(section_core, sect_core_keys.LogPopupTestCase, m_core.bLogPopupTestCase, nullptr, true);
// ==== Core End ============ // ==== Core End ============
@ -624,9 +574,8 @@ bool Settings::Save(std::string file_path)
m_si.SetLongValue(section_video, sect_video_keys.Direct3DDevice, m_video.direct3DDevice, nullptr, true, true); m_si.SetLongValue(section_video, sect_video_keys.Direct3DDevice, m_video.direct3DDevice, nullptr, true, true);
m_si.SetBoolValue(section_video, sect_video_keys.VSync, m_video.bVSync, nullptr, true); m_si.SetBoolValue(section_video, sect_video_keys.VSync, m_video.bVSync, nullptr, true);
m_si.SetBoolValue(section_video, sect_video_keys.FullScreen, m_video.bFullScreen, nullptr, true); m_si.SetBoolValue(section_video, sect_video_keys.FullScreen, m_video.bFullScreen, nullptr, true);
m_si.SetBoolValue(section_video, sect_video_keys.MaintainAspect, m_video.bMaintainAspect, nullptr, true); m_si.SetBoolValue(section_video, sect_video_keys.HardwareYUV, m_video.bHardwareYUV, nullptr, true);
m_si.SetLongValue(section_video, sect_video_keys.RenderResolution, m_video.renderScaleFactor, nullptr, false, true); m_si.SetLongValue(section_video, sect_video_keys.RenderResolution, m_video.renderScaleFactor, nullptr, false, true);
// ==== Video End =========== // ==== Video End ===========
// ==== Audio Begin ========= // ==== Audio Begin =========
@ -652,28 +601,18 @@ bool Settings::Save(std::string file_path)
// ==== Network End ========= // ==== Network End =========
// ==== Input General Begin ======= // ==== Input Begin ====
m_si.SetLongValue(section_input_general, sect_input_general.mo_axis_range, m_input_general.MoAxisRange, nullptr, false, true);
m_si.SetLongValue(section_input_general, sect_input_general.mo_wheel_range, m_input_general.MoWheelRange, nullptr, false, true);
m_si.SetBoolValue(section_input_general, sect_input_general.ignore_kbmo_unfocus, m_input_general.IgnoreKbMoUnfocus, nullptr, true);
// ==== Input General End =========
// ==== Input Port Begin ====
for (int port_num = 0; port_num < 4; port_num++) { for (int port_num = 0; port_num < 4; port_num++) {
std::string current_section = std::string(section_input_port) + std::to_string(port_num); std::string current_section = std::string(section_input) + std::to_string(port_num);
std::string quoted_prf_str = m_input_port[port_num].ProfileName.insert(0, "\""); std::string quoted_prf_str = m_input[port_num].ProfileName.insert(0, "\"");
quoted_prf_str += "\""; quoted_prf_str += "\"";
m_si.SetLongValue(current_section.c_str(), sect_input_port.type, m_input_port[port_num].Type, nullptr, false, true); m_si.SetLongValue(current_section.c_str(), sect_input.type, m_input[port_num].Type, nullptr, false, true);
m_si.SetValue(current_section.c_str(), sect_input_port.device, m_input_port[port_num].DeviceName.c_str(), nullptr, true); m_si.SetValue(current_section.c_str(), sect_input.device, m_input[port_num].DeviceName.c_str(), nullptr, true);
m_si.SetValue(current_section.c_str(), sect_input_port.config, quoted_prf_str.c_str(), nullptr, true); m_si.SetValue(current_section.c_str(), sect_input.config, quoted_prf_str.c_str(), nullptr, true);
m_si.SetLongValue(current_section.c_str(), sect_input_port.top_slot, m_input_port[port_num].SlotType[SLOT_TOP], nullptr, false, true);
m_si.SetLongValue(current_section.c_str(), sect_input_port.bottom_slot, m_input_port[port_num].SlotType[SLOT_BOTTOM], nullptr, false, true);
} }
// ==== Input Port End ============== // ==== Input End ==============
// ==== Input Profile Begin ==== // ==== Input Profile Begin ====
@ -683,32 +622,15 @@ bool Settings::Save(std::string file_path)
continue; continue;
} }
const auto &lambda = [&control_names, &device](int num_buttons, const char *const ctrl_names[]) { for (int i = 0; i < dev_num_buttons[device]; i++) {
for (int i = 0; i < num_buttons; i++) { char control_name[30];
char control_name[XBOX_BUTTON_NAME_LENGTH]; std::sprintf(control_name, sect_input_profiles.control, button_xbox_ctrl_names[i][0]);
std::sprintf(control_name, sect_input_profiles.control, ctrl_names[i]); control_names[device].push_back(control_name);
control_names[device].push_back(control_name);
}
};
switch (device)
{
case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_DUKE):
case to_underlying(XBOX_INPUT_DEVICE::MS_CONTROLLER_S):
case to_underlying(XBOX_INPUT_DEVICE::ARCADE_STICK):
lambda(dev_num_buttons[device], button_xbox_ctrl_names);
break;
case to_underlying(XBOX_INPUT_DEVICE::STEEL_BATTALION_CONTROLLER):
lambda(dev_num_buttons[device], button_sbc_names);
break;
case to_underlying(XBOX_INPUT_DEVICE::LIGHTGUN):
lambda(dev_num_buttons[device], button_lightgun_names);
break;
} }
} }
// TODO: add the control names of the other devices
int profile_num = 0; int profile_num = 0;
for (int i = 0; i < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); i++) { for (int i = 0; i < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX); i++) {
size_t vec_size = m_input_profiles[i].size(); size_t vec_size = m_input_profiles[i].size();
@ -744,16 +666,6 @@ bool Settings::Save(std::string file_path)
// ==== Input Profile End ====== // ==== Input Profile End ======
// ==== Overlay Begin =======
m_si.SetBoolValue(section_overlay, sect_overlay_keys.build_hash, m_overlay.build_hash, nullptr, true);
m_si.SetBoolValue(section_overlay, sect_overlay_keys.FPS, m_overlay.fps, nullptr, true);
m_si.SetBoolValue(section_overlay, sect_overlay_keys.hle_lle_stats, m_overlay.hle_lle_stats, nullptr, true);
m_si.SetBoolValue(section_overlay, sect_overlay_keys.title_name, m_overlay.title_name, nullptr, true);
m_si.SetBoolValue(section_overlay, sect_overlay_keys.file_name, m_overlay.file_name, nullptr, true);
// ==== Overlay End =========
// ==== Hack Begin ========== // ==== Hack Begin ==========
m_si.SetBoolValue(section_hack, sect_hack_keys.DisablePixelShaders, m_hacks.DisablePixelShaders, nullptr, true); m_si.SetBoolValue(section_hack, sect_hack_keys.DisablePixelShaders, m_hacks.DisablePixelShaders, nullptr, true);
@ -791,7 +703,6 @@ void Settings::SyncToEmulator()
// register Video settings // register Video settings
g_EmuShared->SetVideoSettings(&m_video); g_EmuShared->SetVideoSettings(&m_video);
g_EmuShared->SetOverlaySettings(&m_overlay);
// register Audio settings // register Audio settings
g_EmuShared->SetAudioSettings(&m_audio); g_EmuShared->SetAudioSettings(&m_audio);
@ -799,43 +710,33 @@ void Settings::SyncToEmulator()
// register Network settings // register Network settings
g_EmuShared->SetNetworkSettings(&m_network); g_EmuShared->SetNetworkSettings(&m_network);
// register xbox device input settings // register input settings
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
g_EmuShared->SetInputDevTypeSettings(&m_input_port[i].Type, i); g_EmuShared->SetInputDevTypeSettings(&m_input[i].Type, i);
g_EmuShared->SetInputSlotTypeSettings(&m_input_port[i].SlotType[SLOT_TOP], i, SLOT_TOP); if (m_input[i].Type != to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID)) {
g_EmuShared->SetInputSlotTypeSettings(&m_input_port[i].SlotType[SLOT_BOTTOM], i, SLOT_BOTTOM); g_EmuShared->SetInputDevNameSettings(m_input[i].DeviceName.c_str(), i);
if (m_input_port[i].Type != to_underlying(XBOX_INPUT_DEVICE::DEVICE_INVALID)) { auto it = std::find_if(m_input_profiles[m_input[i].Type].begin(),
g_EmuShared->SetInputDevNameSettings(m_input_port[i].DeviceName.c_str(), i); m_input_profiles[m_input[i].Type].end(), [this, i](const auto& profile) {
if (m_input_port[i].Type < to_underlying(XBOX_INPUT_DEVICE::DEVICE_MAX)) { if (profile.ProfileName == m_input[i].ProfileName) {
auto it = std::find_if(m_input_profiles[m_input_port[i].Type].begin(), return true;
m_input_profiles[m_input_port[i].Type].end(), [this, i](const auto &profile) {
if (profile.ProfileName == m_input_port[i].ProfileName) {
return true;
}
return false;
});
if (it != m_input_profiles[m_input_port[i].Type].end()) {
char controls_name[HIGHEST_NUM_BUTTONS][HOST_BUTTON_NAME_LENGTH];
for (int index = 0; index < dev_num_buttons[m_input_port[i].Type]; index++) {
strncpy(controls_name[index], it->ControlList[index].c_str(), 30);
} }
g_EmuShared->SetInputBindingsSettings(controls_name, dev_num_buttons[m_input_port[i].Type], i); return false;
});
if (it != m_input_profiles[m_input[i].Type].end()) {
char controls_name[XBOX_CTRL_NUM_BUTTONS][30];
for (int index = 0; index < dev_num_buttons[m_input[i].Type]; index++) {
strncpy(controls_name[index], it->ControlList[index].c_str(), 30);
} }
g_EmuShared->SetInputBindingsSettings(controls_name, XBOX_CTRL_NUM_BUTTONS, i);
} }
} }
} }
// register Input general settings
g_EmuShared->SetInputGeneralSettings(&m_input_general);
// register Hacks settings // register Hacks settings
g_EmuShared->SetHackSettings(&m_hacks); g_EmuShared->SetHackSettings(&m_hacks);
// register data location setting // register data location setting
g_EmuShared->SetDataLocation(GetDataLocation().c_str()); g_EmuShared->SetStorageLocation(GetDataLocation().c_str());
// reset title mount path
g_EmuShared->SetTitleMountPath("");
} }
void verifyDebugFilePath(DebugMode& debug_mode, std::string& file_path) void verifyDebugFilePath(DebugMode& debug_mode, std::string& file_path)
@ -919,131 +820,17 @@ std::string Settings::GetDataLocation()
return m_current_data_location; return m_current_data_location;
} }
// Detect where settings file is located and return default data mode.
CXBX_DATA Settings::FindSettingsLocation(std::string& file_path_out)
{
std::string fileSearch = GenerateExecDirectoryStr();
CXBX_DATA ret = CXBX_DATA_EXECDIR;
fileSearch.append(szSettings_settings_file);
// Check and see if file exists from portable, current, directory.
if (std::filesystem::exists(fileSearch) == false) {
fileSearch = GenerateUserProfileDirectoryStr();
if (fileSearch.size() == 0) {
return CXBX_DATA_INVALID;
}
CXBX_DATA ret = CXBX_DATA_APPDATA;
fileSearch.append(szSettings_settings_file);
// Check if the user profile directory settings file exists.
if (std::filesystem::exists(fileSearch) == false) {
return CXBX_DATA_INVALID;
}
}
file_path_out = fileSearch;
return ret;
}
// Enter setup installer process
CXBX_DATA Settings::SetupFile(std::string& file_path_out)
{
std::string setupFile;
CXBX_DATA data_ret = CXBX_DATA_INVALID;
#ifdef RETRO_API_VERSION // TODO: Change me to #ifndef QT_VERSION
// Can only have one option without Qt.
setupFile = GenerateExecDirectoryStr();
#else // Only support for Qt compile build.
PopupReturn eRet = PopupQuestion(nullptr, szSettings_save_user_option_message);
if (eRet == PopupReturn::Yes) {
setupFile = GenerateExecDirectoryStr();
data_ret = CXBX_DATA_EXECDIR;
}
else if (eRet == PopupReturn::No) {
setupFile = GenerateUserProfileDirectoryStr();
data_ret = CXBX_DATA_APPDATA;
if (setupFile.size() != 0) {
// Check if data directory exists.
if (!std::filesystem::exists(setupFile)) {
// Then try create data directory.
if (!std::filesystem::create_directory(setupFile)) {
// Unable to create a data directory
data_ret = CXBX_DATA_INVALID;
}
}
}
}
#endif
if (data_ret == CXBX_DATA_INVALID) {
PopupError(nullptr, szSettings_setup_error);
}
else {
setupFile.append(szSettings_settings_file);
// Create the file, that's it. Load the default configuration later on;
std::ofstream createFile(setupFile);
if (createFile.is_open()) {
createFile.close();
}
file_path_out = setupFile;
}
return data_ret;
}
void Settings::RemoveLegacyConfigs(unsigned int CurrentRevision) void Settings::RemoveLegacyConfigs(unsigned int CurrentRevision)
{ {
if (CurrentRevision < 5) { switch (CurrentRevision) {
case 2:
case 3:
case 4:
m_si.Delete(section_controller_dinput, nullptr, true); m_si.Delete(section_controller_dinput, nullptr, true);
m_si.Delete(section_controller_port, nullptr, true); m_si.Delete(section_controller_port, nullptr, true);
} break;
case 5:
if (CurrentRevision == 5) { default:
m_si.Delete(section_core, "LoaderExperiment", true); break;
}
if (CurrentRevision < 8) {
const std::string kb_str = "Keyboard";
for (unsigned port_num = 0; port_num < 4; ++port_num) {
std::string current_section = std::string(section_input_port) + std::to_string(port_num);
std::string device_name = m_si.GetValue(current_section.c_str(), sect_input_port.device, "");
if (device_name.ends_with(kb_str)) {
device_name += "Mouse";
m_si.SetValue(current_section.c_str(), sect_input_port.device, device_name.c_str(), nullptr, true);
}
}
for (unsigned index = 0; ; ++index) {
std::string current_section = std::string(section_input_profiles) + std::to_string(index);
if (m_si.GetSectionSize(current_section.c_str()) == -1) {
break;
}
std::string device_name = m_si.GetValue(current_section.c_str(), sect_input_profiles.device, "");
// NOTE: with C++20, this can be simplified by simply calling device_name.ends_with()
if (device_name.length() >= kb_str.length()) {
if (device_name.compare(device_name.length() - kb_str.length(), kb_str.length(), kb_str) == 0) {
device_name += "Mouse";
m_si.SetValue(current_section.c_str(), sect_input_profiles.device, device_name.c_str(), nullptr, true);
}
}
}
}
if(CurrentRevision < 9) {
m_si.Delete(section_video, "HardwareYUV", true);
}
// see settings_version for details.
if(false && CurrentRevision < 10) {
m_si.Delete(section_core, "LoaderExecutable", true);
} }
} }

View File

@ -26,15 +26,14 @@
// ****************************************************************** // ******************************************************************
#ifndef SETTINGS_HPP #ifndef SETTINGS_HPP
#define SETTINGS_HPP #define SETTINGS_HPP
#include "Cxbx.h"
#include "SimpleIni.h" #include "SimpleIni.h"
#include "common\input\InputManager.h" #include "input\InputDevice.h"
#include "common\util\CxbxUtil.h" #include "common\util\CxbxUtil.h"
#include <string> #include <string>
#include <array> #include <array>
#include "core/common/imgui/settings.h"
extern std::string g_exec_filepath; extern std::string g_exec_filepath;
// Individual library version // Individual library version
@ -42,21 +41,9 @@ extern uint16_t g_LibVersion_D3D8;
extern uint16_t g_LibVersion_DSOUND; extern uint16_t g_LibVersion_DSOUND;
#define szSettings_alloc_error "ERROR: Unable to allocate Settings class." #define szSettings_alloc_error "ERROR: Unable to allocate Settings class."
#define assert_check_shared_memory(type) \
"Invalid "#type" size, please verify structure is align, not adding new member, or is using placeholder reserves." \
" Otherwise, please perform versioning upgrade and update "#type" sizeof check."
// Toggle emulation console mode.
typedef enum _EMU_CONSOLE_TYPE {
EMU_CONSOLE_TYPE_AUTO = 0,
EMU_CONSOLE_TYPE_RETAIL = 1,
EMU_CONSOLE_TYPE_DEVKIT = 2,
EMU_CONSOLE_TYPE_CHIHIRO = 3,
} EMU_CONSOLE_TYPE;
// Cxbx-Reloaded's data storage location. // Cxbx-Reloaded's data storage location.
typedef enum _CXBX_DATA { typedef enum _CXBX_DATA {
CXBX_DATA_INVALID = -1,
CXBX_DATA_APPDATA = 0, CXBX_DATA_APPDATA = 0,
CXBX_DATA_EXECDIR = 1, CXBX_DATA_EXECDIR = 1,
CXBX_DATA_CUSTOM = 2, CXBX_DATA_CUSTOM = 2,
@ -65,7 +52,7 @@ typedef enum _CXBX_DATA {
// ****************************************************************** // ******************************************************************
// * Define number of integers required to store logging settings // * Define number of integers required to store logging settings
// ****************************************************************** // ******************************************************************
#define NUM_INTEGERS_LOG 3 #define NUM_INTEGERS_LOG 2
enum { enum {
LLE_NONE = 0, LLE_NONE = 0,
@ -87,8 +74,6 @@ public:
void SyncToEmulator(); void SyncToEmulator();
void Verify(); void Verify();
std::string GetDataLocation(); std::string GetDataLocation();
static CXBX_DATA FindSettingsLocation(std::string& file_path_out);
static CXBX_DATA SetupFile(std::string& file_path_out);
// GUI settings // GUI settings
struct s_gui { struct s_gui {
@ -97,9 +82,6 @@ public:
std::string szRecentXbeFiles[10]; std::string szRecentXbeFiles[10];
unsigned int DataStorageToggle; unsigned int DataStorageToggle;
std::string szCustomLocation = ""; std::string szCustomLocation = "";
bool bIgnoreInvalidXbeSig;
bool bIgnoreInvalidXbeSec;
unsigned int ConsoleTypeToggle;
} m_gui; } m_gui;
// Core settings // Core settings
@ -108,16 +90,15 @@ public:
unsigned int FlagsLLE; unsigned int FlagsLLE;
DebugMode KrnlDebugMode; DebugMode KrnlDebugMode;
char szKrnlDebug[MAX_PATH] = ""; char szKrnlDebug[MAX_PATH] = "";
char szStorageLocation[xbox::max_path] = ""; char szStorageLocation[MAX_PATH] = "";
bool allowAdminPrivilege;
unsigned int LoggedModules[NUM_INTEGERS_LOG]; unsigned int LoggedModules[NUM_INTEGERS_LOG];
int LogLevel = 1; int LogLevel = 1;
bool bUnused_WasUseLoaderExec; bool Reserved2 = 0;
bool allowAdminPrivilege; bool Reserved3 = 0;
bool bLogPopupTestCase;
bool Reserved4 = 0; bool Reserved4 = 0;
int Reserved99[10] = { 0 }; int Reserved99[10] = { 0 };
} m_core; } m_core;
static_assert(sizeof(s_core) == 0x250, assert_check_shared_memory(s_core));
// Video settings // Video settings
struct s_video { struct s_video {
@ -126,12 +107,11 @@ public:
unsigned int direct3DDevice; unsigned int direct3DDevice;
bool bVSync; bool bVSync;
bool bFullScreen; bool bFullScreen;
bool bMaintainAspect; bool bHardwareYUV;
bool Reserved3; bool Reserved3;
int renderScaleFactor = 1; int renderScaleFactor = 1;
int Reserved99[9] = { 0 }; int Reserved99[9] = { 0 };
} m_video; } m_video;
static_assert(sizeof(s_video) == 0x98, assert_check_shared_memory(s_video));
// Audio settings // Audio settings
struct s_audio { struct s_audio {
@ -142,24 +122,13 @@ public:
bool mute_on_unfocus; bool mute_on_unfocus;
int Reserved99[14] = { 0 }; int Reserved99[14] = { 0 };
} m_audio; } m_audio;
static_assert(sizeof(s_audio) == 0x4C, assert_check_shared_memory(s_audio));
// Input general settings struct s_input {
struct s_input_general {
long MoAxisRange;
long MoWheelRange;
bool IgnoreKbMoUnfocus;
bool Reserved1[3];
} m_input_general;
static_assert(sizeof(s_input_general) == 0xC, assert_check_shared_memory(s_input_general));
struct s_input_port {
int Type; int Type;
int SlotType[XBOX_CTRL_NUM_SLOTS];
std::string DeviceName; std::string DeviceName;
std::string ProfileName; std::string ProfileName;
}; };
std::array<s_input_port, 4> m_input_port; std::array<s_input, 4> m_input;
struct s_input_profiles { struct s_input_profiles {
int Type; int Type;
@ -173,7 +142,6 @@ public:
struct s_network { struct s_network {
char adapter_name[MAX_PATH] = ""; char adapter_name[MAX_PATH] = "";
} m_network; } m_network;
static_assert(sizeof(s_network) == 0x104, assert_check_shared_memory(s_network));
// Hack settings // Hack settings
// NOTE: When removing fields, replace them with place-holders // NOTE: When removing fields, replace them with place-holders
@ -190,9 +158,6 @@ public:
bool Reserved8 = 0; bool Reserved8 = 0;
int Reserved99[8] = { 0 }; int Reserved99[8] = { 0 };
} m_hacks; } m_hacks;
static_assert(sizeof(s_hack) == 0x28, assert_check_shared_memory(s_hack));
overlay_settings m_overlay;
private: private:
void RemoveLegacyConfigs(unsigned int CurrentRevision); void RemoveLegacyConfigs(unsigned int CurrentRevision);

View File

@ -25,165 +25,148 @@
// * // *
// ****************************************************************** // ******************************************************************
#include <core\kernel\exports\xboxkrnl.h> #ifdef _WIN32
#include <windows.h> #include <windows.h>
#include <chrono> #endif
#include <thread> #include <thread>
#include <vector> #include <vector>
#include <mutex> #include <mutex>
#include <array>
#include "Timer.h" #include "Timer.h"
#include "common\util\CxbxUtil.h" #include "common\util\CxbxUtil.h"
#include "core\kernel\support\EmuFS.h" #include "core\kernel\init\CxbxKrnl.h"
#include "core\kernel\exports\EmuKrnlPs.hpp" #ifdef __linux__
#include "core\kernel\exports\EmuKrnl.h" #include <time.h>
#include "devices\Xbox.h" #endif
#include "devices\usb\OHCI.h"
#include "core\hle\DSOUND\DirectSound\DirectSoundGlobal.hpp"
static std::atomic_uint64_t last_qpc; // last time when QPC was called // Virtual clocks will probably become useful once LLE CPU is implemented, but for now we don't need them.
static std::atomic_uint64_t exec_time; // total execution time in us since the emulation started // See the QEMUClockType QEMU_CLOCK_VIRTUAL of XQEMU for more info.
static uint64_t pit_last; // last time when the pit time was updated #define CLOCK_REALTIME 0
static uint64_t pit_last_qpc; // last QPC time of the pit //#define CLOCK_VIRTUALTIME 1
// The frequency of the high resolution clock of the host, and the start time
int64_t HostQPCFrequency, HostQPCStartTime;
void timer_init() // Vector storing all the timers created
static std::vector<TimerObject*> TimerList;
// The frequency of the high resolution clock of the host
uint64_t HostClockFrequency;
// Lock to acquire when accessing TimerList
std::mutex TimerMtx;
// Returns the current time of the timer
inline uint64_t GetTime_NS(TimerObject* Timer)
{ {
QueryPerformanceFrequency(reinterpret_cast<LARGE_INTEGER *>(&HostQPCFrequency)); #ifdef _WIN32
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER *>(&HostQPCStartTime)); LARGE_INTEGER li;
pit_last_qpc = last_qpc = HostQPCStartTime; QueryPerformanceCounter(&li);
pit_last = get_now(); uint64_t Ret = Muldiv64(li.QuadPart, SCALE_S_IN_NS, (uint32_t)HostClockFrequency);
#elif __linux__
// Synchronize xbox system time with host time static struct timespec ts;
LARGE_INTEGER HostSystemTime; clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
GetSystemTimeAsFileTime((LPFILETIME)&HostSystemTime); uint64_t Ret = Muldiv64(ts.tv_sec, SCALE_S_IN_NS, 1) + ts.tv_nsec;
xbox::KeSystemTime.High2Time = HostSystemTime.u.HighPart; #else
xbox::KeSystemTime.LowPart = HostSystemTime.u.LowPart; #error "Unsupported OS"
xbox::KeSystemTime.High1Time = HostSystemTime.u.HighPart; #endif
return Ret;
} }
// More precise sleep, but with increased CPU usage // Calculates the next expire time of the timer
void SleepPrecise(std::chrono::steady_clock::time_point targetTime) static inline uint64_t GetNextExpireTime(TimerObject* Timer)
{ {
using namespace std::chrono; return GetTime_NS(Timer) + Timer->ExpireTime_MS.load();
// If we don't need to wait, return right away
// TODO use waitable timers?
// TODO fetch the timer resolution to determine the sleep threshold?
// TODO adaptive wait? https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/
// Try to sleep for as much of the wait as we can
// to save CPU usage / power
// We expect sleep to overshoot, so give ourselves some extra time
// Note currently we ask Windows to give us 1ms timer resolution
constexpr auto sleepThreshold = 2ms; // Minimum remaining time before we attempt to use sleep
auto sleepFor = (targetTime - sleepThreshold) - steady_clock::now();
auto sleepMs = duration_cast<milliseconds>(sleepFor).count();
// Sleep if required
if (sleepMs >= 0) {
Sleep((DWORD)sleepMs);
}
// Spin wait
while (steady_clock::now() < targetTime) {
;
}
} }
// NOTE: the pit device is not implemented right now, so we put this here // Deallocates the memory of the timer
static uint64_t pit_next(uint64_t now) void Timer_Destroy(TimerObject* Timer)
{ {
constexpr uint64_t pit_period = 1000; unsigned int index, i;
uint64_t next = pit_last + pit_period; std::lock_guard<std::mutex>lock(TimerMtx);
if (now >= next) { index = TimerList.size();
xbox::KiClockIsr(now - pit_last); for (i = 0; i < index; i++) {
pit_last = get_now(); if (Timer == TimerList[i]) {
return pit_period; index = i;
}
return pit_last + pit_period - now; // time remaining until next clock interrupt
}
static void update_non_periodic_events()
{
// update dsound
dsound_worker();
// check for hw interrupts
for (int i = 0; i < MAX_BUS_INTERRUPT_LEVEL; i++) {
// If the interrupt is pending and connected, process it
if (g_bEnableAllInterrupts && HalSystemInterrupts[i].IsPending() && EmuInterruptList[i] && EmuInterruptList[i]->Connected) {
HalSystemInterrupts[i].Trigger(EmuInterruptList[i]);
} }
} }
assert(index != TimerList.size());
delete Timer;
TimerList.erase(TimerList.begin() + index);
} }
uint64_t get_now() // Thread that runs the timer
void ClockThread(TimerObject* Timer)
{ {
LARGE_INTEGER now; uint64_t NewExpireTime;
QueryPerformanceCounter(&now);
uint64_t elapsed_us = now.QuadPart - last_qpc;
last_qpc = now.QuadPart;
elapsed_us *= 1000000;
elapsed_us /= HostQPCFrequency;
exec_time += elapsed_us;
return exec_time;
}
static uint64_t get_next(uint64_t now) if (!Timer->Name.empty()) {
{ CxbxSetThreadName(Timer->Name.c_str());
std::array<uint64_t, 5> next = { }
pit_next(now), if (Timer->CpuAffinity != nullptr) {
g_NV2A->vblank_next(now), InitXboxThread(*Timer->CpuAffinity);
g_NV2A->ptimer_next(now), }
g_USB0->m_HostController->OHCI_next(now), NewExpireTime = GetNextExpireTime(Timer);
dsound_next(now)
};
return *std::min_element(next.begin(), next.end());
}
xbox::void_xt NTAPI system_events(xbox::PVOID arg)
{
// Testing shows that, if this thread has the same priority of the other xbox threads, it can take tens, even hundreds of ms to complete a single loop.
// So we increase its priority to above normal, so that it scheduled more often
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
// Always run this thread at dpc level to prevent it from ever executing APCs/DPCs
xbox::KeRaiseIrqlToDpcLevel();
while (true) { while (true) {
const uint64_t last_time = get_now(); if (GetTime_NS(Timer) > NewExpireTime) {
const uint64_t nearest_next = get_next(last_time); if (Timer->Exit.load()) {
Timer_Destroy(Timer);
while (true) { return;
update_non_periodic_events();
uint64_t elapsed_us = get_now() - last_time;
if (elapsed_us >= nearest_next) {
break;
} }
std::this_thread::yield(); Timer->Callback(Timer->Opaque);
NewExpireTime = GetNextExpireTime(Timer);
} }
Sleep(1); // prevent burning the cpu
} }
} }
int64_t Timer_GetScaledPerformanceCounter(int64_t Period) // Changes the expire time of a timer
void Timer_ChangeExpireTime(TimerObject* Timer, uint64_t Expire_ms)
{ {
LARGE_INTEGER currentQPC; Timer->ExpireTime_MS.store(Expire_ms);
QueryPerformanceCounter(&currentQPC);
// Scale frequency with overflow avoidance, like in std::chrono
// https://github.com/microsoft/STL/blob/6d2f8b0ed88ea6cba26cc2151f47f678442c1663/stl/inc/chrono#L703
const int64_t currentTime = currentQPC.QuadPart - HostQPCStartTime;
const int64_t whole = (currentTime / HostQPCFrequency) * Period;
const int64_t part = (currentTime % HostQPCFrequency) * Period / HostQPCFrequency;
return whole + part;
} }
// Destroys the timer
void Timer_Exit(TimerObject* Timer)
{
Timer->Exit.store(true);
}
// Allocates the memory for the timer object
TimerObject* Timer_Create(TimerCB Callback, void* Arg, std::string Name, unsigned long* Affinity)
{
std::lock_guard<std::mutex>lock(TimerMtx);
TimerObject* pTimer = new TimerObject;
pTimer->Type = CLOCK_REALTIME;
pTimer->Callback = Callback;
pTimer->ExpireTime_MS.store(0);
pTimer->Exit.store(false);
pTimer->Opaque = Arg;
Name.empty() ? pTimer->Name = "Unnamed thread" : pTimer->Name = Name;
pTimer->CpuAffinity = Affinity;
TimerList.emplace_back(pTimer);
return pTimer;
}
// Starts the timer
// Expire_MS must be expressed in NS
void Timer_Start(TimerObject* Timer, uint64_t Expire_MS)
{
Timer->ExpireTime_MS.store(Expire_MS);
std::thread(ClockThread, Timer).detach();
}
// Retrives the frequency of the high resolution clock of the host
void Timer_Init()
{
#ifdef _WIN32
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
HostClockFrequency = freq.QuadPart;
#elif __linux__
ClockFrequency = 0;
#else
#error "Unsupported OS"
#endif
}

View File

@ -29,7 +29,6 @@
#define TIMER_H #define TIMER_H
#include <atomic> #include <atomic>
#include <mutex>
#define SCALE_S_IN_NS 1000000000 #define SCALE_S_IN_NS 1000000000
#define SCALE_MS_IN_NS 1000000 #define SCALE_MS_IN_NS 1000000
@ -40,12 +39,28 @@
#define SCALE_MS_IN_US 1000 #define SCALE_MS_IN_US 1000
#define SCALE_US_IN_US 1 #define SCALE_US_IN_US 1
/* typedef of the timer object and the callback function */
typedef void(*TimerCB)(void*);
typedef struct _TimerObject
{
int Type; // timer type
std::atomic_uint64_t ExpireTime_MS; // when the timer expires (ms)
std::atomic_bool Exit; // indicates that the timer should be destroyed
TimerCB Callback; // function to call when the timer expires
void* Opaque; // opaque argument to pass to the callback
std::string Name; // the name of the timer thread (if any)
unsigned long* CpuAffinity; // the cpu affinity of the timer thread (if any)
}
TimerObject;
extern int64_t HostQPCFrequency; extern uint64_t HostClockFrequency;
void timer_init(); /* Timer exported functions */
uint64_t get_now(); TimerObject* Timer_Create(TimerCB Callback, void* Arg, std::string Name, unsigned long* Affinity);
int64_t Timer_GetScaledPerformanceCounter(int64_t Period); void Timer_Start(TimerObject* Timer, uint64_t Expire_MS);
void SleepPrecise(std::chrono::steady_clock::time_point targetTime); void Timer_Exit(TimerObject* Timer);
void Timer_ChangeExpireTime(TimerObject* Timer, uint64_t Expire_ms);
inline uint64_t GetTime_NS(TimerObject* Timer);
void Timer_Init();
#endif #endif

View File

@ -1,68 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of Cxbx-Reloaded.
// *
// * Cxbx-Reloaded is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2017-2019 Patrick van Logchem <pvanlogchem@gmail.com>
// * (c) 2019 ego720
// *
// * All rights reserved
// *
// ******************************************************************
#include "AddressRanges.h"
#include "core\kernel\init\CxbxKrnl.h" // For CXBX_BASE_ADDR
bool VerifyBaseAddr()
{
/*! CXBX_BASE_ADDR is defined as 0x00010000, which is the base address of
the cxbxr-ldr.exe host executable.
Set in cxbxr-ldr.exe Project options, Linker, Advanced, Base Address */
return ((UINT_PTR)GetModuleHandle(nullptr) == CXBX_BASE_ADDR);
}
void UnreserveMemoryRange(const int index)
{
uint32_t Start = XboxAddressRanges[index].Start;
int Size = XboxAddressRanges[index].Size;
while (Size > 0) {
VirtualFree((LPVOID)Start, (SIZE_T)0, MEM_RELEASE); // To release, dwSize must be zero!
Start += BLOCK_SIZE;
Size -= BLOCK_SIZE;
}
}
bool AllocateMemoryRange(const int index)
{
uint32_t Start = XboxAddressRanges[index].Start;
int Size = XboxAddressRanges[index].Size;
while (Size > 0) {
int BlockSize = (Size > BLOCK_SIZE) ? BLOCK_SIZE : Size;
if (nullptr == VirtualAlloc((void*)Start, BlockSize, MEM_COMMIT, PAGE_READWRITE)) { // MEM_RESERVE already done by Cxbx-Loader.exe
return false;
}
Start += BLOCK_SIZE;
Size -= BLOCK_SIZE;
}
return true;
}

View File

@ -1,32 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of Cxbx-Reloaded.
// *
// * Cxbx-Reloaded is free software; you can redistribute it
// * and/or modify it under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * (c) 2017-2019 Patrick van Logchem <pvanlogchem@gmail.com>
// *
// * All rights reserved
// *
// ******************************************************************
#pragma once
extern bool VerifyBaseAddr();
extern void UnreserveMemoryRange(const int index);
extern bool AllocateMemoryRange(const int index);

View File

@ -1,51 +0,0 @@
// ******************************************************************
// *
// * This file is part of the Cxbx project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// *
// * (c) 2020 RadWolfie
// *
// * All rights reserved
// *
// ******************************************************************
#pragma once
#include <cstdint>
// Convert frequency to pitch helper
static inline int32_t converter_freq2pitch(uint32_t freq) {
// NOTE: pitch = 0 is equal to 48 KHz.
/* For research purpose of how to convert frequency to pitch and back to frequency.
// Edit hertz variable to see the result.
float hertz = 12000.0f;
float hertzRatio = 48000.0f; // base frequency
float pitchRatio = 4096.0f; // pitch per octave
// Convert hertz to pitch
float pitch = log2(hertz / hertzRatio) * pitchRatio;
// Convert pitch to hertz
hertz = exp((pitch / pitchRatio) * log(2)) * hertzRatio;*/
return static_cast<int32_t>(log2(freq / 48000.0f) * 4096.0f);
}
// Convert pitch to frequency helper
static inline uint32_t converter_pitch2freq(int32_t pitch) {
//* See research documentation above for conversion example.
return static_cast<uint32_t>(exp((pitch / 4096.0f) * log(2)) * 48000.0f);
}

View File

@ -26,8 +26,6 @@
#ifndef EMURSA_H #ifndef EMURSA_H
#define EMURSA_H #define EMURSA_H
#include <cstdlib> // For size_t
#pragma pack(4) #pragma pack(4)
typedef union _RSA_PUBLIC_KEY typedef union _RSA_PUBLIC_KEY

View File

@ -1,169 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of the Cxbx-Reloaded project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * All rights reserved
// *
// ******************************************************************
#define LOG_PREFIX CXBXR_MODULE::FILE
#ifdef CXBXR_EMU
#include "core/kernel/support/EmuFile.h" // For g_io_mu_metadata
#include "common/Timer.h" // For Timer_Shutdown
#include "core/common/video/RenderBase.hpp" // For g_renderbase
#include "core/kernel/memory-manager/VMManager.h"
extern void CxbxrKrnlSuspendThreads();
#endif
#include "cxbxr.hpp"
#include "EmuShared.h"
#include "Settings.hpp"
#include "Logging.h"
#include "win32/WineEnv.h"
#include "Settings.hpp"
volatile bool g_bPrintfOn = true;
bool CreateSettings()
{
g_Settings = new Settings();
if (g_Settings == nullptr) {
PopupError(nullptr, szSettings_alloc_error);
return false;
}
if (!g_Settings->Init()) {
return false;
}
log_get_settings();
return true;
}
bool HandleFirstLaunch()
{
bool bFirstLaunch;
g_EmuShared->GetIsFirstLaunch(&bFirstLaunch);
/* check if process is launch with elevated access then prompt for continue on or not. */
if (!bFirstLaunch) {
if (!CreateSettings()) {
return false;
}
// Wine will always run programs as administrator by default, it can be safely disregard.
// Since Wine doesn't use root permission. Unless user is running Wine as root.
bool bElevated = CxbxrIsElevated();
if (bElevated && !isWineEnv() && !g_Settings->m_core.allowAdminPrivilege) {
PopupReturn ret = PopupWarningEx(nullptr, PopupButtons::YesNo, PopupReturn::No,
"Cxbx-Reloaded has detected that it has been launched with Administrator rights.\n"
"\nThis is dangerous, as a maliciously modified Xbox titles could take control of your system.\n"
"\nAre you sure you want to continue?");
if (ret != PopupReturn::Yes) {
return false;
}
}
g_EmuShared->SetIsFirstLaunch(true);
}
return true;
}
[[noreturn]] void CxbxrShutDown(bool is_reboot)
{
if (!is_reboot) {
// Clear all kernel boot flags. These (together with the shared memory) persist until Cxbx-Reloaded is closed otherwise.
int BootFlags = 0;
g_EmuShared->SetBootFlags(&BootFlags);
}
// NOTE: This causes a hang when exiting while NV2A is processing
// This is okay for now: It won't leak memory or resources since TerminateProcess will free everything
// delete g_NV2A; // TODO : g_pXbox
// Shutdown the input device manager
g_InputDeviceManager.Shutdown();
#ifdef CXBXR_EMU
// NOTE: this code causes freezes/crashes at shutdown, so avoid for now
// This is very important process to prevent false positive report and allow IDEs to continue debug multiple reboots.
//CxbxrKrnlSuspendThreads();
if (g_io_mu_metadata) {
delete g_io_mu_metadata;
g_io_mu_metadata = nullptr;
}
// Shutdown the render manager
if (g_renderbase != nullptr) {
g_renderbase->Shutdown();
g_renderbase = nullptr;
}
// NOTE: Require to be after g_renderbase's shutdown process.
// NOTE: Must be last step of shutdown process and before CxbxUnlockFilePath call!
// Shutdown the memory manager
g_VMManager.Shutdown();
CxbxrUnlockFilePath();
if (CxbxKrnl_hEmuParent != NULL && !is_reboot) {
SendMessage(CxbxKrnl_hEmuParent, WM_PARENTNOTIFY, WM_DESTROY, 0);
}
#endif
EmuShared::Cleanup();
TerminateProcess(GetCurrentProcess(), 0);
}
[[noreturn]] void CxbxrAbortEx(CXBXR_MODULE cxbxr_module, const char* szErrorMessage, ...)
{
// print out error message (if exists)
if (szErrorMessage != NULL)
{
char szBuffer2[1024];
va_list argp;
va_start(argp, szErrorMessage);
vsprintf(szBuffer2, szErrorMessage, argp);
va_end(argp);
(void)PopupCustomEx(nullptr, cxbxr_module, LOG_LEVEL::FATAL, PopupIcon::Error, PopupButtons::Ok, PopupReturn::Ok, "Received Fatal Message:\n\n* %s\n", szBuffer2); // Will also EmuLogEx
}
EmuLogInit(LOG_LEVEL::INFO, "MAIN: Terminating Process");
fflush(stdout);
// cleanup debug output
{
FreeConsole();
char buffer[16];
if (GetConsoleTitle(buffer, 16) != NULL)
freopen("nul", "w", stdout);
}
CxbxrShutDown();
}

View File

@ -1,58 +0,0 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// ******************************************************************
// *
// * This file is part of the Cxbx-Reloaded project.
// *
// * Cxbx and Cxbe are free software; you can redistribute them
// * and/or modify them under the terms of the GNU General Public
// * License as published by the Free Software Foundation; either
// * version 2 of the license, or (at your option) any later version.
// *
// * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU General Public License for more details.
// *
// * You should have recieved a copy of the GNU General Public License
// * along with this program; see the file COPYING.
// * If not, write to the Free Software Foundation, Inc.,
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
// *
// * All rights reserved
// *
// ******************************************************************
#pragma once
#include <string>
#include <optional>
#include "Logging.h"
bool CreateSettings();
bool HandleFirstLaunch();
// TODO: Eventually, we should remove this function to start using std::filesystem::path method for all host paths.
void CxbxResolveHostToFullPath(std::string& file_path, std::string_view finish_error_sentence);
// Loads a keys.bin file as generated by dump-xbox
// See https://github.com/JayFoxRox/xqemu-tools/blob/master/dump-xbox.c
void LoadXboxKeys();
bool CxbxrLockFilePath();
void CxbxrUnlockFilePath();
// Hybrid functions depending on specific platforms
bool CxbxrIsElevated();
std::optional<std::string> CxbxrExec(bool useDebugger, void** hProcess, bool requestHandleProcess);
/*! cleanup emulation */
[[noreturn]] void CxbxrAbortEx(CXBXR_MODULE cxbxr_module, const char* szErrorMessage, ...);
#define CxbxrAbort(fmt, ...) CxbxrAbortEx(LOG_PREFIX, fmt, ##__VA_ARGS__)
/*! terminate gracefully the emulation */
[[noreturn]] void CxbxrShutDown(bool is_reboot = false);

View File

@ -27,8 +27,8 @@
#include "Button.h" #include "Button.h"
#include "InputWindow.h" #include "InputWindow.h"
#include "layout_xbox_device.h" // TODO: Needs a better fix for custom input device support. #include "layout_xbox_controller.h" // TODO: Needs a better fix for custom input device support.
#include "gui/resource/ResCxbx.h" #include "..\..\gui\ResCxbx.h"
void Button::EnableButton(bool enable) const void Button::EnableButton(bool enable) const
@ -51,41 +51,27 @@ void Button::GetText(char* const text, size_t size) const
SendMessage(m_button_hwnd, WM_GETTEXT, size, reinterpret_cast<LPARAM>(text)); SendMessage(m_button_hwnd, WM_GETTEXT, size, reinterpret_cast<LPARAM>(text));
} }
void Button::AddTooltip(HWND hwnd, HWND tooltip_hwnd, std::string_view text) const std::string Button::GetName(int api, int idx) const
{ {
assert((hwnd != NULL) && (tooltip_hwnd != NULL)); assert(api == XINPUT_DEFAULT || api == DINPUT_DEFAULT);
return button_xbox_ctrl_names[idx][api];
std::string tooltip_text(text);
TOOLINFO tool = { 0 };
tool.cbSize = sizeof(tool);
tool.hwnd = hwnd;
tool.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
tool.uId = reinterpret_cast<UINT_PTR>(m_button_hwnd);
tool.lpszText = tooltip_text.data();
SendMessage(tooltip_hwnd, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&tool));
} }
LRESULT CALLBACK ButtonDukeSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) LRESULT CALLBACK ButtonSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{ {
switch (uMsg) switch (uMsg)
{ {
// Remove the window subclass when this window is destroyed // Remove the window subclass when this window is destroyed
case WM_NCDESTROY: { case WM_NCDESTROY: {
RemoveWindowSubclass(hWnd, ButtonDukeSubclassProc, uIdSubclass); RemoveWindowSubclass(hWnd, ButtonSubclassProc, uIdSubclass);
} }
break; break;
case WM_RBUTTONDOWN: { case WM_RBUTTONDOWN: {
Button *button = reinterpret_cast<Button *>(dwRefData); reinterpret_cast<Button*>(dwRefData)->ClearText();
if (wParam & MK_SHIFT) { g_InputWindow->UpdateProfile(std::string(), BUTTON_CLEAR);
static_cast<DukeInputWindow *>(button->GetWnd())->SwapMoCursorAxis(button); if (reinterpret_cast<Button*>(dwRefData)->GetId() == IDC_SET_MOTOR) {
} g_InputWindow->UpdateProfile(std::string(), RUMBLE_CLEAR);
else if (!(wParam & ~MK_RBUTTON)) {
button->ClearText();
static_cast<DukeInputWindow *>(button->GetWnd())->UpdateProfile(std::string(), BUTTON_CLEAR);
if (button->GetId() == IDC_SET_MOTOR) {
static_cast<DukeInputWindow *>(button->GetWnd())->UpdateProfile(std::string(), RUMBLE_CLEAR);
}
} }
} }
break; break;
@ -94,47 +80,3 @@ LRESULT CALLBACK ButtonDukeSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
return DefSubclassProc(hWnd, uMsg, wParam, lParam); return DefSubclassProc(hWnd, uMsg, wParam, lParam);
} }
LRESULT CALLBACK ButtonSbcSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
switch (uMsg)
{
// Remove the window subclass when this window is destroyed
case WM_NCDESTROY: {
RemoveWindowSubclass(hWnd, ButtonSbcSubclassProc, uIdSubclass);
}
break;
case WM_RBUTTONDOWN: {
Button *button = reinterpret_cast<Button *>(dwRefData);
button->ClearText();
static_cast<SbcInputWindow *>(button->GetWnd())->UpdateProfile(std::string(), BUTTON_CLEAR);
}
break;
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
LRESULT CALLBACK ButtonLightgunSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
switch (uMsg)
{
// Remove the window subclass when this window is destroyed
case WM_NCDESTROY: {
RemoveWindowSubclass(hWnd, ButtonLightgunSubclassProc, uIdSubclass);
}
break;
case WM_RBUTTONDOWN: {
Button *button = reinterpret_cast<Button *>(dwRefData);
button->ClearText();
static_cast<LightgunInputWindow *>(button->GetWnd())->UpdateProfile(std::string(), BUTTON_CLEAR);
}
break;
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}

Some files were not shown because too many files have changed in this diff Show More