├── import ├── DirectX9 │ ├── include │ │ └── DxErr.h │ └── lib │ │ ├── d3dx9.lib │ │ └── DxErr9.lib ├── OpenXDK │ ├── include │ │ ├── xusb │ │ │ ├── linux │ │ │ │ ├── config.h │ │ │ │ └── bitops.h │ │ │ ├── host │ │ │ │ └── ohci_config.h │ │ │ ├── usb_wrapper.h │ │ │ ├── core │ │ │ │ └── usb.h │ │ │ ├── xusb.h │ │ │ └── config.h │ │ ├── glibc │ │ │ ├── sys │ │ │ │ ├── cdefs.h │ │ │ │ └── djtypes.h │ │ │ ├── features_old.h │ │ │ ├── limits.h │ │ │ ├── errnos.h │ │ │ ├── endian.h │ │ │ ├── bits │ │ │ │ └── endian.h │ │ │ ├── conio.h │ │ │ ├── defs.h │ │ │ ├── errno.h │ │ │ ├── huge_val.h │ │ │ ├── stdio.h │ │ │ └── attic │ │ │ │ └── stdio.h │ │ ├── xlibc │ │ │ ├── malloc.h │ │ │ ├── ctype.h │ │ │ ├── ansidecl.h │ │ │ ├── stdarg.h │ │ │ ├── string.h │ │ │ ├── math.h │ │ │ └── stdlib.h │ │ ├── xvga │ │ │ ├── xvga_tables.h │ │ │ ├── xvga.h │ │ │ └── xvga_internal.h │ │ ├── xhal │ │ │ ├── xohci_pci.h │ │ │ └── xhal.h │ │ └── xgfx2d │ │ │ ├── bitmap.h │ │ │ ├── blit.h │ │ │ └── blitters.h │ └── readme.txt ├── ntdll │ └── lib │ │ └── ntdll.lib ├── glew-2.0.0 │ ├── doc │ │ ├── new.png │ │ ├── github.png │ │ ├── glew.png │ │ ├── ogl_sm.jpg │ │ ├── travis.png │ │ ├── khronos.txt │ │ ├── mesa.txt │ │ └── glew.txt │ ├── bin │ │ └── Release │ │ │ ├── x64 │ │ │ ├── glew32.dll │ │ │ ├── glewinfo.exe │ │ │ └── visualinfo.exe │ │ │ └── Win32 │ │ │ ├── glew32.dll │ │ │ ├── glewinfo.exe │ │ │ └── visualinfo.exe │ └── lib │ │ └── Release │ │ ├── x64 │ │ ├── glew32.lib │ │ └── glew32s.lib │ │ └── Win32 │ │ ├── glew32.lib │ │ └── glew32s.lib ├── winpcap │ └── Lib │ │ ├── Packet.lib │ │ ├── wpcap.lib │ │ └── x64 │ │ ├── wpcap.lib │ │ └── Packet.lib └── distorm │ └── lib │ └── Win32 │ └── distorm.lib ├── src ├── core │ ├── hle │ │ ├── D3D8 │ │ │ ├── XbState.cpp │ │ │ ├── Direct3D9 │ │ │ │ ├── WalkIndexBuffer.h │ │ │ │ ├── PixelShader.h │ │ │ │ ├── VertexShader.h │ │ │ │ ├── VertexShaderCache.h │ │ │ │ └── Shader.h │ │ │ ├── FixedFunctionState.h │ │ │ └── XbPushBuffer.h │ │ ├── Patches.hpp │ │ └── DSOUND │ │ │ ├── common │ │ │ └── XbInternalStruct.cpp │ │ │ └── DirectSound │ │ │ ├── DirectSoundLogging.hpp │ │ │ └── DSStream_PacketManager.hpp │ ├── common │ │ ├── imgui │ │ │ ├── audio.hpp │ │ │ ├── video.hpp │ │ │ ├── audio.cpp │ │ │ ├── ui.hpp │ │ │ └── settings.h │ │ └── video │ │ │ ├── RenderBase.cpp │ │ │ └── RenderBase.hpp │ └── kernel │ │ ├── common │ │ └── dbg.h │ │ ├── exports │ │ ├── EmuKrnlPs.hpp │ │ └── EmuKrnlKe.h │ │ └── support │ │ ├── NativeHandle.h │ │ └── PatchRdtsc.hpp ├── version.h.in ├── gui │ ├── DlgAbout.cpp │ ├── resource │ │ ├── Cxbx-R.ico │ │ ├── Logo.bmp │ │ ├── Logo-License-CC4.bmp │ │ └── .editorconfig │ ├── targetver.h │ ├── DlgEepromConfig.h │ ├── DlgLoggingConfig.h │ ├── DlgAbout.h │ ├── DlgAudioConfig.h │ ├── DlgNetworkConfig.h │ ├── DlgVideoConfig.h │ ├── input │ │ ├── DlgLightgunConfig.h │ │ ├── DlgDukeControllerConfig.h │ │ ├── DlgSBControllerConfig.h │ │ └── DlgLibusbControllerConfig.h │ └── DlgInputConfig.h ├── devices │ ├── SMCDevice.h │ ├── usb │ │ ├── OHCI.cpp │ │ ├── UsbCommon.h │ │ └── USBDevice.cpp │ ├── video │ │ ├── thread-win32.h │ │ ├── nv2a_shaders_common.h │ │ ├── qstring.h │ │ └── nv2a_psh.h │ ├── SMDevice.cpp │ ├── MCPXDevice.h │ └── audio │ │ └── AC97Device.h ├── CxbxDebugger │ ├── Resources │ │ ├── Run_16x_24.bmp │ │ ├── Pause_16x_24.bmp │ │ ├── BreakpointEnable_16x_24.bmp │ │ └── BreakpointDisable_16x_24.bmp │ ├── Win32 │ │ ├── Constants.cs │ │ ├── Debugging │ │ │ ├── CONTINUE_STATUS.cs │ │ │ ├── EXIT_THREAD_DEBUG_INFO.cs │ │ │ ├── RIP_INFO.cs │ │ │ ├── EXIT_PROCESS_DEBUG_INFO.cs │ │ │ ├── UNLOAD_DLL_DEBUG_INFO.cs │ │ │ ├── EXCEPTION_DEBUG_INFO.cs │ │ │ ├── CREATE_THREAD_DEBUG_INFO.cs │ │ │ ├── DEBUG_EVENT_CODE.cs │ │ │ ├── LOAD_DLL_DEBUG_INFO.cs │ │ │ ├── CREATE_PROCESS_DEBUG_INFO.cs │ │ │ ├── EXCEPTION_RECORD.cs │ │ │ ├── OUTPUT_DEBUG_STRING_INFO.cs │ │ │ └── NativeMethods.cs │ │ ├── Jobs │ │ │ ├── JOBOBJECT_ASSOCIATE_COMPLETION_PORT.cs │ │ │ ├── JOBOBJECTINFOCLASS.cs │ │ │ ├── IO_COUNTERS.cs │ │ │ ├── JOBOBJECT_EXTENDED_LIMIT_INFORMATION.cs │ │ │ ├── JobMsgInfoMessages.cs │ │ │ ├── JOBOBJECT_BASIC_LIMIT_INFORMATION.cs │ │ │ └── JobInformationLimitFlags.cs │ │ ├── Interop │ │ │ └── SecurityAttributes.cs │ │ ├── Processes │ │ │ ├── SafeThreadHandle.cs │ │ │ ├── PROCESS_INFORMATION.cs │ │ │ ├── SafeProcessHandle.cs │ │ │ └── Startupinfo.cs │ │ ├── Windows │ │ │ └── NativeMethods.cs │ │ ├── LastWin32ErrorException.cs │ │ ├── Handles │ │ │ └── NativeMethods.cs │ │ ├── vschromium-LICENSE │ │ ├── NtStatus.cs │ │ └── UnicodeString.cs │ ├── App.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ └── AssemblyInfo.cs │ ├── Debugger │ │ ├── DebuggerModule.cs │ │ ├── DebuggerEventInterfaces.cs │ │ └── DebuggerCallstack.cs │ ├── DebuggerSymbols │ │ ├── Kernel │ │ │ └── KernelSymbolProvider.cs │ │ ├── HLECache │ │ │ ├── HLECacheProvider.cs │ │ │ └── HLECacheFile.cs │ │ └── DebuggerSymbolProvider.cs │ ├── DebugOutputManager.cs │ ├── Program.cs │ ├── IDebugWindow.cs │ ├── Common.cs │ ├── FileEventManager.cs │ └── README.md ├── .editorconfig ├── HighPerformanceGraphicsEnabler.c ├── emulator │ ├── targetver.h │ └── dllmain.cpp ├── CxbxVersion.h ├── CxbxVersion.cpp └── common │ ├── win32 │ ├── Util.h │ ├── AlignPosfix1.h │ ├── WineEnv.h │ ├── AlignPrefix1.h │ ├── Util.cpp │ ├── Mutex.h │ └── WineEnv.cpp │ ├── xbdm │ └── CxbxXbdm.h │ ├── xbox │ ├── Logging.hpp │ ├── Types.hpp │ └── Logging.cpp │ ├── util │ ├── cliConverter.hpp │ ├── hasher.h │ ├── CPUID.h │ ├── gloffscreen │ │ ├── glextensions.h │ │ └── glextensions.cpp │ └── std_extend.hpp │ ├── linux │ ├── AlignPosfix1.h │ └── AlignPrefix1.h │ ├── VerifyAddressRanges.h │ ├── xdvdfs-tools │ └── buffered_io.h │ ├── input │ └── RawDevice.h │ └── crypto │ └── EmuSha.h ├── doc ├── Sorted Reordered Dxbx Patterns.7z ├── Sorted D3D8LTCG Patterns (TXT, IDA signature).7z └── Sorted Reordered Dxbx Patterns (D3D only as TXT, CSV and JSON).7z ├── projects ├── libtom │ └── CMakeLists.txt ├── debugger │ └── README.md ├── misc │ └── batch.cmake └── imgui │ └── CMakeLists.txt ├── .github ├── ISSUE_TEMPLATE │ ├── config.yml │ └── issue-template.md ├── workflows │ ├── pull-request.yml │ └── autoclose.yml └── labeler.yml ├── .gitignore ├── .gitattributes ├── setup.bat ├── CMakeSettings.json ├── .gitmodules ├── .appveyor.yml └── .azure-pipelines.yml /import/DirectX9/include/DxErr.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/core/hle/D3D8/XbState.cpp: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/linux/config.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/sys/cdefs.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /import/OpenXDK/readme.txt: -------------------------------------------------------------------------------- 1 | Pulled from OpenXDK CVS @ 2004.09.30 (07:00) 2 | -------------------------------------------------------------------------------- /src/version.h.in: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #cmakedefine _GIT_VERSION "@_GIT_VERSION@" 4 | -------------------------------------------------------------------------------- /src/gui/DlgAbout.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/gui/DlgAbout.cpp -------------------------------------------------------------------------------- /src/devices/SMCDevice.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/devices/SMCDevice.h -------------------------------------------------------------------------------- /src/devices/usb/OHCI.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/devices/usb/OHCI.cpp -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/host/ohci_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configs for OHCI 3 | */ 4 | 5 | #define CONFIG_PCI 6 | -------------------------------------------------------------------------------- /import/ntdll/lib/ntdll.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/ntdll/lib/ntdll.lib -------------------------------------------------------------------------------- /src/devices/usb/UsbCommon.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/devices/usb/UsbCommon.h -------------------------------------------------------------------------------- /src/gui/resource/Cxbx-R.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/gui/resource/Cxbx-R.ico -------------------------------------------------------------------------------- /src/gui/resource/Logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/gui/resource/Logo.bmp -------------------------------------------------------------------------------- /import/DirectX9/lib/d3dx9.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/DirectX9/lib/d3dx9.lib -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/doc/new.png -------------------------------------------------------------------------------- /import/winpcap/Lib/Packet.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/winpcap/Lib/Packet.lib -------------------------------------------------------------------------------- /import/winpcap/Lib/wpcap.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/winpcap/Lib/wpcap.lib -------------------------------------------------------------------------------- /src/devices/usb/USBDevice.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/devices/usb/USBDevice.cpp -------------------------------------------------------------------------------- /import/DirectX9/lib/DxErr9.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/DirectX9/lib/DxErr9.lib -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/doc/github.png -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/glew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/doc/glew.png -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/ogl_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/doc/ogl_sm.jpg -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/travis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/doc/travis.png -------------------------------------------------------------------------------- /import/winpcap/Lib/x64/wpcap.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/winpcap/Lib/x64/wpcap.lib -------------------------------------------------------------------------------- /import/winpcap/Lib/x64/Packet.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/winpcap/Lib/x64/Packet.lib -------------------------------------------------------------------------------- /doc/Sorted Reordered Dxbx Patterns.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/doc/Sorted Reordered Dxbx Patterns.7z -------------------------------------------------------------------------------- /import/distorm/lib/Win32/distorm.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/distorm/lib/Win32/distorm.lib -------------------------------------------------------------------------------- /src/gui/resource/Logo-License-CC4.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/gui/resource/Logo-License-CC4.bmp -------------------------------------------------------------------------------- /src/CxbxDebugger/Resources/Run_16x_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/CxbxDebugger/Resources/Run_16x_24.bmp -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/features_old.h: -------------------------------------------------------------------------------- 1 | #define __USE_MISC 1 2 | #define __USE_GNU 1 3 | #define __P(arg) arg 4 | #define __ptr_t void * 5 | -------------------------------------------------------------------------------- /import/glew-2.0.0/bin/Release/x64/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/bin/Release/x64/glew32.dll -------------------------------------------------------------------------------- /import/glew-2.0.0/lib/Release/x64/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/lib/Release/x64/glew32.lib -------------------------------------------------------------------------------- /projects/libtom/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/crypt") 3 | add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/math") 4 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Resources/Pause_16x_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/CxbxDebugger/Resources/Pause_16x_24.bmp -------------------------------------------------------------------------------- /import/glew-2.0.0/bin/Release/Win32/glew32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/bin/Release/Win32/glew32.dll -------------------------------------------------------------------------------- /import/glew-2.0.0/bin/Release/x64/glewinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/bin/Release/x64/glewinfo.exe -------------------------------------------------------------------------------- /import/glew-2.0.0/lib/Release/Win32/glew32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/lib/Release/Win32/glew32.lib -------------------------------------------------------------------------------- /import/glew-2.0.0/lib/Release/Win32/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/lib/Release/Win32/glew32s.lib -------------------------------------------------------------------------------- /import/glew-2.0.0/lib/Release/x64/glew32s.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/lib/Release/x64/glew32s.lib -------------------------------------------------------------------------------- /import/glew-2.0.0/bin/Release/Win32/glewinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/bin/Release/Win32/glewinfo.exe -------------------------------------------------------------------------------- /import/glew-2.0.0/bin/Release/x64/visualinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/bin/Release/x64/visualinfo.exe -------------------------------------------------------------------------------- /src/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_size = 4 5 | trim_trailing_whitespace = true 6 | end_of_line = lf 7 | insert_final_newline = true 8 | -------------------------------------------------------------------------------- /doc/Sorted D3D8LTCG Patterns (TXT, IDA signature).7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/doc/Sorted D3D8LTCG Patterns (TXT, IDA signature).7z -------------------------------------------------------------------------------- /import/glew-2.0.0/bin/Release/Win32/visualinfo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/import/glew-2.0.0/bin/Release/Win32/visualinfo.exe -------------------------------------------------------------------------------- /src/CxbxDebugger/Resources/BreakpointEnable_16x_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/CxbxDebugger/Resources/BreakpointEnable_16x_24.bmp -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/usb_wrapper.h: -------------------------------------------------------------------------------- 1 | #include "linux_wrapper.h" 2 | #define __KERNEL__ 3 | #undef CONFIG_PCI 4 | #define CONFIG_PCI 5 | 6 | #include "linux/usb.h" 7 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Resources/BreakpointDisable_16x_24.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/src/CxbxDebugger/Resources/BreakpointDisable_16x_24.bmp -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Constants.cs: -------------------------------------------------------------------------------- 1 | namespace VsChromium.Core.Win32 { 2 | public static class Constants { 3 | public const uint INFINITE = 0xFFFFFFFF; 4 | } 5 | } -------------------------------------------------------------------------------- /src/gui/resource/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.rc] 4 | indent_size = 4 5 | trim_trailing_whitespace = true 6 | end_of_line = crlf 7 | insert_final_newline = true 8 | charset = utf-8 9 | -------------------------------------------------------------------------------- /doc/Sorted Reordered Dxbx Patterns (D3D only as TXT, CSV and JSON).7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LukeUsher/Cxbx-Reloaded/HEAD/doc/Sorted Reordered Dxbx Patterns (D3D only as TXT, CSV and JSON).7z -------------------------------------------------------------------------------- /projects/debugger/README.md: -------------------------------------------------------------------------------- 1 | Since cmake isn't able to perform virtual folder group from source_group command. 2 | Go to /src/CxbxDebugger directory to find CMakeLists.txt file for any updates if need to. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Cxbx-Reloaded Discord server 4 | url: https://discord.gg/26Xjx23 5 | about: You can ask questions here. 6 | -------------------------------------------------------------------------------- /src/CxbxDebugger/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/CONTINUE_STATUS.cs: -------------------------------------------------------------------------------- 1 | namespace VsChromium.Core.Win32.Debugging { 2 | public enum CONTINUE_STATUS : uint { 3 | DBG_CONTINUE = 0x00010002, 4 | DBG_EXCEPTION_NOT_HANDLED = 0x80010001, 5 | } 6 | } -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/core/usb.h: -------------------------------------------------------------------------------- 1 | /* Functions local to drivers/usb/core/ */ 2 | 3 | extern void usb_create_driverfs_dev_files (struct usb_device *dev); 4 | extern void usb_create_driverfs_intf_files (struct usb_interface *intf); 5 | 6 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/limits.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _LIMITS 3 | #define _LIMITS 4 | 5 | 6 | 7 | #define LONG_MIN (-2147483647-1) 8 | #define LONG_MAX (2147483647) 9 | #define ULONG_MAX (0xffffffff) 10 | 11 | 12 | #endif // _LIMITS 13 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/EXIT_THREAD_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace VsChromium.Core.Win32.Debugging { 4 | [StructLayout(LayoutKind.Sequential)] 5 | public struct EXIT_THREAD_DEBUG_INFO { 6 | public uint dwExitCode; 7 | } 8 | } -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/RIP_INFO.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace VsChromium.Core.Win32.Debugging { 4 | [StructLayout(LayoutKind.Sequential)] 5 | public struct RIP_INFO { 6 | public uint dwError; 7 | public uint dwType; 8 | } 9 | } -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/EXIT_PROCESS_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace VsChromium.Core.Win32.Debugging { 4 | [StructLayout(LayoutKind.Sequential)] 5 | public struct EXIT_PROCESS_DEBUG_INFO { 6 | public uint dwExitCode; 7 | } 8 | } -------------------------------------------------------------------------------- /src/HighPerformanceGraphicsEnabler.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Default to High Performance Mode on machines with dual graphics 4 | __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; // AMD 5 | __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; // NVIDIA 6 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/UNLOAD_DLL_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace VsChromium.Core.Win32.Debugging { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct UNLOAD_DLL_DEBUG_INFO { 7 | public IntPtr lpBaseOfDll; 8 | } 9 | } -------------------------------------------------------------------------------- /src/CxbxDebugger/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/EXCEPTION_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace VsChromium.Core.Win32.Debugging { 4 | [StructLayout(LayoutKind.Sequential)] 5 | public struct EXCEPTION_DEBUG_INFO { 6 | public EXCEPTION_RECORD ExceptionRecord; 7 | public uint dwFirstChance; 8 | } 9 | } -------------------------------------------------------------------------------- /src/core/hle/D3D8/Direct3D9/WalkIndexBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef WALKINDEXBUFFER_H 2 | #define WALKINDEXBUFFER_H 3 | 4 | #include "core/hle/D3D8/XbD3D8Types.h" 5 | 6 | extern void(*WalkIndexBuffer) 7 | ( 8 | INDEX16 &LowIndex, 9 | INDEX16 &HighIndex, 10 | INDEX16 *pIndexData, 11 | DWORD dwIndexCount 12 | ); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/malloc.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __OPENXDK_MALLOC__ 3 | #define __OPENXDK_MALLOC__ 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | //dummy malloc to make bitmap lib compile :P 10 | 11 | void *malloc(size_t); 12 | void free(void *); 13 | 14 | #ifdef __cplusplus 15 | }; 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /.github/workflows/pull-request.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Manager 2 | 3 | on: pull_request_target 4 | 5 | jobs: 6 | pr_manager: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Labeler 10 | uses: actions/labeler@v4 11 | with: 12 | repo-token: ${{ secrets.GITHUB_TOKEN }} 13 | sync-labels: true 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build folders 2 | [Bb]uild/ 3 | [Bb]uild-*/ 4 | 5 | # CLion 6 | .idea/ 7 | cmake-build-*/ 8 | 9 | # Visual Studio Cache 10 | .vs/ 11 | 12 | # Generated files 13 | *.aps 14 | 15 | #Test files 16 | src/[Vv]ersion.h 17 | *.xbe 18 | 19 | # Last known git hash 20 | LAST_GIT_VERSION 21 | 22 | # git mergetool backup 23 | *.orig 24 | -------------------------------------------------------------------------------- /src/gui/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/emulator/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | //#include 9 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/JOBOBJECT_ASSOCIATE_COMPLETION_PORT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace LowLevelDesign.Win32.Jobs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct JOBOBJECT_ASSOCIATE_COMPLETION_PORT 8 | { 9 | public IntPtr CompletionKey; 10 | public IntPtr CompletionPort; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/JOBOBJECTINFOCLASS.cs: -------------------------------------------------------------------------------- 1 | namespace LowLevelDesign.Win32.Jobs 2 | { 3 | public enum JOBOBJECTINFOCLASS 4 | { 5 | AssociateCompletionPortInformation = 7, 6 | BasicLimitInformation = 2, 7 | BasicUIRestrictions = 4, 8 | EndOfJobTimeInformation = 6, 9 | ExtendedLimitInformation = 9, 10 | SecurityLimitInformation = 5, 11 | GroupInformation = 11 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/errnos.h: -------------------------------------------------------------------------------- 1 | #ifdef _ERRNO_H 2 | #endif /* included. */ 3 | 4 | #if !defined(__Emath_defined) && (defined(_ERRNO_H) || defined(__need_Emath)) 5 | #define EDOM 1 6 | #define ERANGE 2 7 | #else /* Emath not defined and included or need Emath. */ 8 | #define ENOSYS 3 9 | #endif /* included. */ 10 | 11 | #undef __need_Emath 12 | #ifndef __Emath_defined 13 | #define __Emath_defined 1 14 | #endif 15 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/CREATE_THREAD_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace VsChromium.Core.Win32.Debugging { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct CREATE_THREAD_DEBUG_INFO { 7 | public IntPtr hThread; 8 | public IntPtr lpThreadLocalBase; 9 | // x1nix: Alignment fix, as PTHREAD_START_ROUTINE is failing to Marshal 10 | public IntPtr lpStartAddress; 11 | } 12 | } -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/endian.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if defined _LIBC && !defined _ISOMAC 4 | # if __FLOAT_WORD_ORDER == __BIG_ENDIAN 5 | # define BIG_ENDI 1 6 | # undef LITTLE_ENDI 7 | # define HIGH_HALF 0 8 | # define LOW_HALF 1 9 | # else 10 | # if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN 11 | # undef BIG_ENDI 12 | # define LITTLE_ENDI 1 13 | # define HIGH_HALF 1 14 | # define LOW_HALF 0 15 | # endif 16 | # endif 17 | #endif 18 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/DEBUG_EVENT_CODE.cs: -------------------------------------------------------------------------------- 1 | namespace VsChromium.Core.Win32.Debugging { 2 | public enum DEBUG_EVENT_CODE : uint { 3 | EXCEPTION_DEBUG_EVENT = 1, 4 | CREATE_THREAD_DEBUG_EVENT = 2, 5 | CREATE_PROCESS_DEBUG_EVENT = 3, 6 | EXIT_THREAD_DEBUG_EVENT = 4, 7 | EXIT_PROCESS_DEBUG_EVENT = 5, 8 | LOAD_DLL_DEBUG_EVENT = 6, 9 | UNLOAD_DLL_DEBUG_EVENT = 7, 10 | OUTPUT_DEBUG_STRING_EVENT = 8, 11 | RIP_EVENT = 9, 12 | } 13 | } -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/LOAD_DLL_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace VsChromium.Core.Win32.Debugging { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct LOAD_DLL_DEBUG_INFO { 7 | public IntPtr hFile; 8 | public IntPtr lpBaseOfDll; 9 | public uint dwDebugInfoFileOffset; 10 | public uint nDebugInfoSize; 11 | public IntPtr lpImageName; 12 | public ushort fUnicode; 13 | } 14 | } -------------------------------------------------------------------------------- /src/core/hle/D3D8/Direct3D9/PixelShader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Shader.h" // ID3DBlob (via d3dcompiler.h > d3d11shader.h > d3dcommon.h) 4 | #include "core\hle\D3D8\XbPixelShader.h" // DecodedRegisterCombiner 5 | 6 | static const char* ps_model_2_a = "ps_2_a"; 7 | static const char* ps_model_3_0 = "ps_3_0"; 8 | extern const char* g_ps_model; 9 | 10 | extern HRESULT EmuCompilePixelShader 11 | ( 12 | DecodedRegisterCombiner* pIntermediateShader, 13 | ID3DBlob** ppHostShader 14 | ); 15 | -------------------------------------------------------------------------------- /src/CxbxVersion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern const char* CxbxVersionStr; 4 | extern const char *CxbxrHashBuild; 5 | 6 | // Note: GitVersionMaxLength should be large enough to accomodate the longest git version string we can practically expect to have. This is necessary 7 | // to avoid possible mismatches in the string length which can happen if the user mixes different cxbxr versions 8 | inline constexpr size_t GitVersionMaxLength = 80; 9 | const char *const GetGitVersionStr(); 10 | const size_t GetGitVersionLength(); 11 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/IO_COUNTERS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace LowLevelDesign.Win32.Jobs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct IO_COUNTERS 8 | { 9 | public UInt64 ReadOperationCount; 10 | public UInt64 WriteOperationCount; 11 | public UInt64 OtherOperationCount; 12 | public UInt64 ReadTransferCount; 13 | public UInt64 WriteTransferCount; 14 | public UInt64 OtherTransferCount; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/core/common/imgui/audio.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cxbx-Reloaded Project 2 | // Licensed under GPLv2+ 3 | // Refer to the COPYING file included. 4 | #pragma once 5 | 6 | #include 7 | #include "settings.h" 8 | 9 | class ImGuiAudio 10 | { 11 | public: 12 | ImGuiAudio() = default; 13 | virtual ~ImGuiAudio() = default; 14 | 15 | bool Initialize(); 16 | void Shutdown(); 17 | 18 | void DrawMenu(); 19 | void DrawWidgets(bool is_focus, ImGuiWindowFlags input_handler); 20 | 21 | protected: 22 | 23 | imgui_audio_windows m_windows; 24 | }; 25 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Interop/SecurityAttributes.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace VsChromium.Core.Win32.Interop 9 | { 10 | [StructLayout(LayoutKind.Sequential)] 11 | public class SecurityAttributes 12 | { 13 | public int nLength; 14 | public IntPtr lpSecurityDescriptor; 15 | public int bInheritHandle; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Debugger/DebuggerModule.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | 6 | namespace CxbxDebugger 7 | { 8 | public class DebuggerModule 9 | { 10 | public IntPtr ImageBase { get; set; } 11 | public string Path { get; set; } 12 | public bool Core { get; set; } 13 | 14 | // Based on DebugProcessModule 15 | public DebuggerModule() 16 | { 17 | ImageBase = IntPtr.Zero; 18 | Path = ""; 19 | Core = false; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/core/common/imgui/video.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cxbx-Reloaded Project 2 | // Licensed under GPLv2+ 3 | // Refer to the COPYING file included. 4 | #pragma once 5 | 6 | #include 7 | #include "settings.h" 8 | 9 | class ImGuiVideo 10 | { 11 | public: 12 | ImGuiVideo() = default; 13 | virtual ~ImGuiVideo() = default; 14 | 15 | bool Initialize(); 16 | void Shutdown(); 17 | 18 | void DrawMenu(); 19 | void DrawWidgets(bool is_focus, ImGuiWindowFlags input_handler); 20 | 21 | protected: 22 | imgui_video_windows m_windows; 23 | static const ImColor m_laser_col[4]; 24 | }; 25 | -------------------------------------------------------------------------------- /src/CxbxDebugger/DebuggerSymbols/Kernel/KernelSymbolProvider.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | namespace CxbxDebugger 5 | { 6 | public class KernelProvider : DebuggerSymbolProviderBase 7 | { 8 | public void AddKernelSymbolFromMessage(DebuggerMessages.KernelPatch Message) 9 | { 10 | DebuggerSymbol NewSymbol = new DebuggerSymbol(); 11 | 12 | NewSymbol.Name = Message.Name; 13 | NewSymbol.AddrBegin = (uint)Message.Address; 14 | 15 | AddSymbol(NewSymbol); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/JOBOBJECT_EXTENDED_LIMIT_INFORMATION.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace LowLevelDesign.Win32.Jobs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION 8 | { 9 | public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; 10 | public IO_COUNTERS IoInfo; 11 | public UIntPtr ProcessMemoryLimit; 12 | public UIntPtr JobMemoryLimit; 13 | public UIntPtr PeakProcessMemoryUsed; 14 | public UIntPtr PeakJobMemoryUsed; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/JobMsgInfoMessages.cs: -------------------------------------------------------------------------------- 1 | namespace LowLevelDesign.Win32.Jobs 2 | { 3 | public enum JobMsgInfoMessages 4 | { 5 | JOB_OBJECT_MSG_END_OF_JOB_TIME = 1, 6 | JOB_OBJECT_MSG_END_OF_PROCESS_TIME = 2, 7 | JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT = 3, 8 | JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO = 4, 9 | JOB_OBJECT_MSG_NEW_PROCESS = 6, 10 | JOB_OBJECT_MSG_EXIT_PROCESS = 7, 11 | JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS = 8, 12 | JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT = 9, 13 | JOB_OBJECT_MSG_JOB_MEMORY_LIMIT = 10 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/sys/djtypes.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ 2 | #ifndef __DJ_sys_djtypes_h_ 3 | #define __DJ_sys_djtypes_h_ 4 | 5 | #define __DJ_clock_t typedef int clock_t; 6 | #define __DJ_gid_t typedef int gid_t; 7 | #define __DJ_off_t typedef int off_t; 8 | #define __DJ_pid_t typedef int pid_t; 9 | #define __DJ_size_t typedef long unsigned int size_t; 10 | #define __DJ_ssize_t typedef int ssize_t; 11 | #define __DJ_time_t typedef unsigned int time_t; 12 | #define __DJ_uid_t typedef int uid_t; 13 | #define __DJ_va_list typedef void *va_list; 14 | #define __DJ_wchar_t typedef int wchar_t; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /.github/workflows/autoclose.yml: -------------------------------------------------------------------------------- 1 | on: 2 | issues: 3 | types: opened 4 | 5 | jobs: 6 | auto_close_issues: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v3 11 | - name: Automatically close issues that don't follow the issue template 12 | uses: ergo720/auto-close-issues@v1.0.4 13 | with: 14 | github-token: ${{ secrets.GITHUB_TOKEN }} 15 | issue-close-message: "@${issue.user.login}: your issue has been automatically closed because it does not follow the issue template." # optional property 16 | closed-issues-label: "invalid" # optional property 17 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/bits/endian.h: -------------------------------------------------------------------------------- 1 | /* This file should define __BYTE_ORDER as appropriate for the machine 2 | in question. See string/endian.h for how to define it. 3 | 4 | If only the stub bits/endian.h applies to a particular configuration, 5 | bytesex.h is generated by running a program on the host machine. 6 | So if cross-compiling to a machine with a different byte order, 7 | the bits/endian.h file for that machine must exist. */ 8 | 9 | #ifndef _ENDIAN_H 10 | # error "Never use directly; include instead." 11 | #endif 12 | 13 | #define __BYTE_ORDER __LITTLE_ENDIAN 14 | //#error Machine byte order unknown. 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Standard to msysgit 2 | *.doc diff=astextplain 3 | *.DOC diff=astextplain 4 | *.docx diff=astextplain 5 | *.DOCX diff=astextplain 6 | *.dot diff=astextplain 7 | *.DOT diff=astextplain 8 | *.pdf diff=astextplain 9 | *.PDF diff=astextplain 10 | *.rtf diff=astextplain 11 | *.RTF diff=astextplain 12 | 13 | * text=auto 14 | 15 | [Cc][Mm]ake[Ll]ists.txt text eol=lf 16 | *.bat text eol=lf 17 | *.c text eol=lf 18 | *.h text eol=lf 19 | *.cpp text eol=lf 20 | *.hpp text eol=lf 21 | *.unused-patches text eol=lf 22 | *.rc text eol=lf 23 | 24 | # All module imports are vendor, remove them from linguist stats chart for accurate stats. 25 | import/* linguist-vendored 26 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xvga/xvga_tables.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : xvga_tables.h 8 | // * 9 | // * note : XBox VGA 10 | // * 11 | // ****************************************************************** 12 | #ifndef XVGA_TABLES_H 13 | #define XVGA_TABLES_H 14 | 15 | #include "xvga_internal.h" 16 | 17 | #define MODE256x240SIZE 25 18 | extern vga_reg mode_256x240[]; 19 | 20 | #define MODE320x240SIZE 25 21 | extern vga_reg mode_320x240[]; 22 | 23 | #define MODE320x200SIZE 25 24 | extern vga_reg mode_320x200[]; 25 | 26 | #endif -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/conio.h: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // 3 | // CONIO.H : Standard Port IO routines 4 | // 5 | // ************************************************************************** 6 | #ifndef __CONIO_H__ 7 | #define __CONIO_H__ 8 | 9 | 10 | 11 | 12 | void _outb( unsigned short port, unsigned char data ); 13 | void _outw( unsigned short port, unsigned short data ); 14 | void _outd( unsigned short port, unsigned int data ); 15 | unsigned char _inb( unsigned short port ); 16 | unsigned short _inw( unsigned short port ); 17 | unsigned int _ind( unsigned short port ); 18 | 19 | 20 | 21 | 22 | 23 | #endif //__CONIO_H__ -------------------------------------------------------------------------------- /src/core/hle/D3D8/Direct3D9/VertexShader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "core\hle\D3D8\XbVertexShader.h" 4 | #include "FixedFunctionVertexShaderState.hlsli" 5 | 6 | enum class ShaderType { 7 | Empty = 0, 8 | Compilable, 9 | Unsupported, 10 | }; 11 | 12 | static const char* vs_model_2_a = "vs_2_a"; 13 | static const char* vs_model_3_0 = "vs_3_0"; 14 | extern const char* g_vs_model; 15 | 16 | extern HRESULT EmuCompileVertexShader 17 | ( 18 | IntermediateVertexShader* pIntermediateShader, 19 | ID3DBlob** ppHostShader 20 | ); 21 | 22 | extern void EmuCompileFixedFunction(ID3DBlob** ppHostShader); 23 | 24 | extern void EmuCompileXboxPassthrough(ID3DBlob** ppHostShader); 25 | 26 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/CREATE_PROCESS_DEBUG_INFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace VsChromium.Core.Win32.Debugging { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct CREATE_PROCESS_DEBUG_INFO { 7 | public IntPtr hFile; 8 | public IntPtr hProcess; 9 | public IntPtr hThread; 10 | public IntPtr lpBaseOfImage; 11 | public uint dwDebugInfoFileOffset; 12 | public uint nDebugInfoSize; 13 | public IntPtr lpThreadLocalBase; 14 | // x1nix: Alignment fix, as PTHREAD_START_ROUTINE is failing to Marshal 15 | public IntPtr lpStartAddress; 16 | public IntPtr lpImageName; 17 | public ushort fUnicode; 18 | } 19 | } -------------------------------------------------------------------------------- /src/devices/video/thread-win32.h: -------------------------------------------------------------------------------- 1 | #ifndef __QEMU_THREAD_WIN32_H 2 | #define __QEMU_THREAD_WIN32_H 1 3 | #include "windows.h" 4 | 5 | struct QemuMutex { 6 | CRITICAL_SECTION lock; 7 | LONG owner; 8 | }; 9 | 10 | struct QemuCond { 11 | LONG waiters, target; 12 | HANDLE sema; 13 | HANDLE continue_event; 14 | }; 15 | 16 | struct QemuSemaphore { 17 | HANDLE sema; 18 | }; 19 | 20 | struct QemuEvent { 21 | HANDLE event; 22 | }; 23 | 24 | typedef struct QemuThreadData QemuThreadData; 25 | struct QemuThread { 26 | QemuThreadData *data; 27 | unsigned tid; 28 | }; 29 | 30 | /* Only valid for joinable threads. */ 31 | HANDLE qemu_thread_get_handle(QemuThread *thread); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/JOBOBJECT_BASIC_LIMIT_INFORMATION.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace LowLevelDesign.Win32.Jobs 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct JOBOBJECT_BASIC_LIMIT_INFORMATION 8 | { 9 | public Int64 PerProcessUserTimeLimit; 10 | public Int64 PerJobUserTimeLimit; 11 | public JobInformationLimitFlags LimitFlags; 12 | public UIntPtr MinimumWorkingSetSize; 13 | public UIntPtr MaximumWorkingSetSize; 14 | public UInt32 ActiveProcessLimit; 15 | public Int64 Affinity; 16 | public UInt32 PriorityClass; 17 | public UInt32 SchedulingClass; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /setup.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | REM Cxbx-Reloaded setup script 4 | REM 5 | REM Depends on git, cmake and Visual Studio being installed. 6 | 7 | echo Pulling latest version from git... 8 | REM git clone --recurse-submodules https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/ 9 | git pull --recurse-submodules 10 | 11 | REM echo Synchronizing submodules... 12 | REM git submodule update --init --recursive 13 | 14 | echo Initializing most recent Visual Studio build environment... 15 | @call "%VS140COMNTOOLS%vsvars32.bat" 16 | 17 | echo Generating solution... 18 | mkdir build 19 | cd build 20 | REM cmake .. -G "Visual Studio 16 2019" -A Win32 21 | cmake .. -A Win32 22 | 23 | echo Building solution... 24 | cmake --build . -j %NUMBER_OF_PROCESSORS% 25 | 26 | echo Done! Enjoy using Cxbx-Reloaded! 27 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xhal/xohci_pci.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : xohci_pci.h 8 | // * 9 | // * note : XBox USB Open Host Controller Interface (PCI) 10 | // * 11 | // ****************************************************************** 12 | #ifndef XOHCI_PCI_H 13 | #define XOHCI_PCI_H 14 | 15 | #if defined(__cplusplus) 16 | extern "C" 17 | { 18 | #endif 19 | 20 | // ****************************************************************** 21 | // * external functions 22 | // ****************************************************************** 23 | void xohci_pci_init(); 24 | 25 | #if defined(__cplusplus) 26 | } 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/xusb.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : xusb.h 8 | // * 9 | // * note : Xbox USB Support 10 | // * 11 | // ****************************************************************** 12 | #ifndef XUSB_H 13 | #define XUSB_H 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | // ****************************************************************** 20 | // * Xbox USB Support by Georg Archer 21 | // ****************************************************************** 22 | #include "linux_wrapper.h" 23 | #include "linux/usb.h" 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /CMakeSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "x86-Release", 5 | "configurationType": "Release", 6 | "inheritEnvironments": [ 7 | "msvc_x86" 8 | ], 9 | "buildRoot": "${workspaceRoot}\\build\\${name}", 10 | "installRoot": "${workspaceRoot}\\bin\\Release", 11 | "cmakeCommandArgs": "", 12 | "buildCommandArgs": "/v:m", 13 | "ctestCommandArgs": "" 14 | }, 15 | { 16 | "name": "x86-Debug", 17 | "configurationType": "Debug", 18 | "inheritEnvironments": [ 19 | "msvc_x86" 20 | ], 21 | "buildRoot": "${workspaceRoot}\\build\\${name}", 22 | "installRoot": "${workspaceRoot}\\bin\\Debug", 23 | "cmakeCommandArgs": "", 24 | "buildCommandArgs": "/v:m", 25 | "ctestCommandArgs": "" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Processes/SafeThreadHandle.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using Microsoft.Win32.SafeHandles; 7 | 8 | namespace VsChromium.Core.Win32.Processes { 9 | public sealed class SafeThreadHandle : SafeHandleZeroOrMinusOneIsInvalid { 10 | public SafeThreadHandle() 11 | : base(true) { 12 | } 13 | 14 | public SafeThreadHandle(IntPtr handle) 15 | : base(true) { 16 | base.SetHandle(handle); 17 | } 18 | 19 | public void InitialSetHandle(IntPtr h) { 20 | base.SetHandle(h); 21 | } 22 | 23 | protected override bool ReleaseHandle() { 24 | return Handles.NativeMethods.CloseHandle(handle); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/core/common/video/RenderBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cxbx-Reloaded Project 2 | // Licensed under GPLv2+ 3 | // Refer to the COPYING file included. 4 | // 5 | // Copyright 2010 Dolphin Emulator Project 6 | // Licensed under GPLv2+ 7 | // Refer to the COPYING file included. 8 | 9 | //#define LOG_PREFIX CXBXR_MODULE::GUI 10 | 11 | #include 12 | 13 | #include "RenderBase.hpp" 14 | 15 | //#include "core/kernel/init/CxbxKrnl.h" 16 | 17 | std::unique_ptr g_renderbase; 18 | 19 | bool RenderBase::Initialize() 20 | { 21 | if (!ImGuiUI::Initialize()) { 22 | return false; 23 | } 24 | 25 | return true; 26 | } 27 | 28 | void RenderBase::Shutdown() 29 | { 30 | DeviceRelease(); 31 | m_device_release = std::function{}; 32 | WindowRelease(); 33 | m_window_release = std::function{}; 34 | ImGuiUI::Shutdown(); 35 | } 36 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Processes/PROCESS_INFORMATION.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace VsChromium.Core.Win32.Processes { 9 | [StructLayout(LayoutKind.Sequential)] 10 | public class PROCESS_INFORMATION { 11 | /// 12 | /// Handle to the created process. The caller *must* call CloseHandle to avoid leaks. 13 | /// 14 | public IntPtr hProcess; 15 | /// 16 | /// Handle to the created process main thread. The caller *must* call CloseHandle to avoid leaks. 17 | /// 18 | public IntPtr hThread; 19 | public int dwProcessId; 20 | public int dwThreadId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Processes/SafeProcessHandle.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using Microsoft.Win32.SafeHandles; 7 | 8 | namespace VsChromium.Core.Win32.Processes { 9 | public sealed class SafeProcessHandle : SafeHandleZeroOrMinusOneIsInvalid { 10 | public SafeProcessHandle() 11 | : base(true) { 12 | } 13 | 14 | public SafeProcessHandle(IntPtr handle) 15 | : base(true) { 16 | base.SetHandle(handle); 17 | } 18 | 19 | public void InitialSetHandle(IntPtr handlePtr) { 20 | handle = handlePtr; 21 | } 22 | 23 | protected override bool ReleaseHandle() { 24 | return Handles.NativeMethods.CloseHandle(handle); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /projects/misc/batch.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_package(Git) 3 | 4 | if(Git_FOUND) 5 | message("Git found: ${GIT_EXECUTABLE}") 6 | 7 | execute_process( 8 | COMMAND git describe --always --tags --first-parent --dirty 9 | OUTPUT_VARIABLE _GIT_VERSION 10 | OUTPUT_STRIP_TRAILING_WHITESPACE 11 | ) 12 | 13 | message("Git version: " ${_GIT_VERSION}) 14 | else() 15 | set(_GIT_VERSION "unknown") 16 | endif() 17 | 18 | # Appears to update whenever define has changed. 19 | configure_file( 20 | "${CMAKE_SOURCE_DIR}/src/version.h.in" "${CMAKE_SOURCE_DIR}/src/version.h" @ONLY 21 | NEWLINE_STYLE LF 22 | ) 23 | 24 | 25 | message("Runtime Build Directory: ${TargetRunTimeDir}") 26 | 27 | # Copy glew32.dll to build type's folder. 28 | set(CXBXR_GLEW_DLL "${CMAKE_SOURCE_DIR}/import/glew-2.0.0/bin/Release/Win32/glew32.dll") 29 | file(COPY ${CXBXR_GLEW_DLL} DESTINATION ${TargetRunTimeDir}) 30 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/EXCEPTION_RECORD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace VsChromium.Core.Win32.Debugging 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | public struct EXCEPTION_RECORD 8 | { 9 | public UInt32 ExceptionCode; 10 | public UInt32 ExceptionFlags; 11 | public IntPtr ExceptionRecord; 12 | public IntPtr ExceptionAddress; 13 | public UInt32 NumberParameters; 14 | #if X64 15 | public UInt32 __unusedAlignment; 16 | #endif 17 | #if X64 18 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.U8)] 19 | public UInt64[] ExceptionInformation; 20 | #else 21 | [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.U4)] 22 | public uint[] ExceptionInformation; 23 | #endif 24 | } 25 | } -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Windows/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace LowLevelDesign.Win32.Windows 5 | { 6 | public static class NativeMethods 7 | { 8 | public const int SW_HIDE = 0; 9 | public const int SW_SHOW = 5; 10 | 11 | [DllImport("kernel32.dll")] 12 | public static extern IntPtr GetConsoleWindow(); 13 | 14 | [DllImport("user32.dll")] 15 | public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); 16 | 17 | // x1nix: added 18 | [DllImport("kernel32.dll")] 19 | public static extern uint GetProcessId(IntPtr hProcess); 20 | 21 | // x1nix: added 22 | [DllImport("kernel32.dll", SetLastError = true)] 23 | public static extern uint GetFinalPathNameByHandleW(IntPtr hFile, IntPtr lpszFilePath, uint cchFilePath = 0u, uint dwFlags = 0u); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/LastWin32ErrorException.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System.ComponentModel; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace VsChromium.Core.Win32 { 9 | public class LastWin32ErrorException : Win32Exception { 10 | public LastWin32ErrorException() 11 | : base(Marshal.GetLastWin32Error()) { 12 | } 13 | public LastWin32ErrorException(string message) 14 | : this(Marshal.GetLastWin32Error(), message) { 15 | } 16 | public LastWin32ErrorException(int errorCode) 17 | : base(errorCode) { 18 | } 19 | public LastWin32ErrorException(int errorCode, string message) 20 | : base(errorCode, string.Format("{0}: {1}", message, new Win32Exception(errorCode).Message)) { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/defs.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEFS__ 2 | #define __DEFS__ 3 | 4 | typedef unsigned char byte; 5 | typedef unsigned char u8; 6 | typedef signed char s8; 7 | typedef unsigned short u16; 8 | typedef signed short s16; 9 | typedef unsigned int u32; 10 | typedef signed int s32; 11 | typedef signed __int64 s64; 12 | typedef unsigned __int64 u64; 13 | 14 | 15 | 16 | #ifndef NULL 17 | #define NULL 0x00 18 | #endif 19 | 20 | // 21 | // LIBC basics 22 | // 23 | 24 | // GET rid of C4146 compiler warnings: unary minus operator applied to unsigned type, result still unsigned 25 | #define NEGU32(a) ((u32) (-((s32)(a))) ) 26 | 27 | //typedef unsigned int size_t; 28 | #define op_t unsigned long int 29 | #define OPSIZ (sizeof(op_t)) 30 | 31 | /* 32 | #define CONST const*/ 33 | #define __CONSTVALUE 34 | #define __alloca _alloca // MSDEV has a built in _alloca 35 | 36 | 37 | int isascii(int c); 38 | 39 | 40 | #endif //__DEFS__ 41 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/OUTPUT_DEBUG_STRING_INFO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace VsChromium.Core.Win32.Debugging { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct OUTPUT_DEBUG_STRING_INFO { 7 | /// 8 | /// The debugging string in the calling process's address space. The 9 | /// debugger can use the ReadProcessMemory function to retrieve the value of 10 | /// the string. 11 | /// 12 | public IntPtr lpDebugStringData; 13 | /// 14 | /// The format of the debugging string. If this member is zero, the debugging 15 | /// string is ANSI; if it is nonzero, the string is Unicode. 16 | /// 17 | public ushort fUnicode; 18 | /// 19 | /// The size of the debugging string, in characters. The length includes the 20 | /// string's terminating null character. 21 | /// 22 | public ushort nDebugStringLength; 23 | } 24 | } -------------------------------------------------------------------------------- /src/CxbxVersion.cpp: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | #include "Version.h" 4 | #include "CxbxVersion.h" 5 | #include 6 | 7 | /*! version string dependent on trace flag */ 8 | #ifndef _DEBUG_TRACE 9 | const char* CxbxVersionStr = _GIT_VERSION " (" __DATE__ ")"; 10 | const char *CxbxrHashBuild = _GIT_VERSION; 11 | #else 12 | const char* CxbxVersionStr = _GIT_VERSION "-Trace (" __DATE__ ")"; 13 | const char *CxbxrHashBuild = _GIT_VERSION "-Trace"; 14 | #endif 15 | 16 | static constexpr const char *GitVersionStr = _GIT_VERSION; 17 | static constexpr size_t GitVersionLength = std::char_traits::length(GitVersionStr); 18 | static_assert(GitVersionLength < GitVersionMaxLength); 19 | 20 | const char *const GetGitVersionStr() { 21 | return GitVersionStr; 22 | } 23 | 24 | const size_t GetGitVersionLength() { 25 | return GitVersionLength; 26 | } 27 | -------------------------------------------------------------------------------- /src/CxbxDebugger/DebuggerSymbols/HLECache/HLECacheProvider.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System.Collections.Generic; 5 | using System.IO; 6 | 7 | namespace CxbxDebugger 8 | { 9 | public class HLECacheProvider : DebuggerSymbolProviderBase 10 | { 11 | public bool Load(string FileName) 12 | { 13 | if (!File.Exists(FileName)) 14 | return false; 15 | 16 | HLECacheFile CacheFile = new HLECacheFile(); 17 | if (!CacheFile.Load(FileName)) 18 | return false; 19 | 20 | foreach(KeyValuePair Item in CacheFile.AddressMap) 21 | { 22 | DebuggerSymbol NewSymbol = new DebuggerSymbol(); 23 | NewSymbol.Name = Item.Value; 24 | NewSymbol.AddrBegin = Item.Key; 25 | 26 | AddSymbol(NewSymbol); 27 | } 28 | 29 | return true; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Jobs/JobInformationLimitFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LowLevelDesign.Win32.Jobs 4 | { 5 | [Flags] 6 | public enum JobInformationLimitFlags 7 | { 8 | JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008, 9 | JOB_OBJECT_LIMIT_AFFINITY = 0x00000010, 10 | JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800, 11 | JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400, 12 | JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200, 13 | JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004, 14 | JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000, 15 | JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040, 16 | JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020, 17 | JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100, 18 | JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002, 19 | JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080, 20 | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000, 21 | JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/CxbxDebugger/DebugOutputManager.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System.Collections.Generic; 5 | using System.Windows.Forms; 6 | 7 | namespace CxbxDebugger 8 | { 9 | class DebugOutputManager 10 | { 11 | List DebugInfo = new List(); 12 | ListBox Handler; 13 | 14 | public DebugOutputManager(ListBox Target) 15 | { 16 | Handler = Target; 17 | } 18 | 19 | private void RefreshUI() 20 | { 21 | // TODO: filter 22 | } 23 | 24 | public void AddLine(string Message) 25 | { 26 | DebugInfo.Add(Message); 27 | 28 | if ( Handler.InvokeRequired) 29 | { 30 | Handler.Invoke(new MethodInvoker(delegate () 31 | { 32 | Handler.Items.Insert(0, Message); 33 | })); 34 | } 35 | else 36 | { 37 | Handler.Items.Insert(0, Message); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Program.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | using System.Windows.Forms; 6 | 7 | namespace CxbxDebugger 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | 20 | string[] args = Environment.GetCommandLineArgs(); 21 | #if !DEBUG 22 | if( args.Length == 1 ) 23 | { 24 | // TODO: Valid usage message 25 | MessageBox.Show("The debugger must be launched from Cxbx with the child process arguments", "Cxbx-Debugger", MessageBoxButtons.OK, MessageBoxIcon.Information); 26 | Application.Exit(); 27 | } 28 | else 29 | #endif 30 | { 31 | Application.Run(new CxbxDebuggerMain(args)); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/khronos.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007 The Khronos Group Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and/or associated documentation files (the 5 | "Materials"), to deal in the Materials without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Materials, and to 8 | permit persons to whom the Materials are furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Materials. 13 | 14 | THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 21 | -------------------------------------------------------------------------------- /src/CxbxDebugger/IDebugWindow.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | namespace CxbxDebugger 5 | { 6 | public enum SessionState 7 | { 8 | Inactive, 9 | Running, 10 | Ended, 11 | } 12 | 13 | public enum DebugState 14 | { 15 | Unknown, 16 | Idle, 17 | Suspended, 18 | Breakpoint, 19 | Running, 20 | Terminated, 21 | } 22 | 23 | public struct DebugStateInfo 24 | { 25 | public DebugState State; 26 | public string Detail; 27 | } 28 | 29 | public interface IDebugWindow 30 | { 31 | void StartSession(); 32 | 33 | void SuspendSession(); 34 | 35 | void ResumeSession(); 36 | 37 | SessionState GetSessionState(); 38 | 39 | DebugStateInfo GetDebugStateInfo(); 40 | } 41 | 42 | public interface IDebugContainerWindow 43 | { 44 | void AddDebugSession(string[] Arguments, bool StartAutomatically); 45 | 46 | void ReportGameTitle(string GameTitle); 47 | 48 | void ReportStatus(IDebugWindow Window, DebugState Status, string Detail); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Debugging/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System.Runtime.InteropServices; 6 | 7 | namespace VsChromium.Core.Win32.Debugging { 8 | public static class NativeMethods { 9 | [DllImport("kernel32.dll", SetLastError = true)] 10 | public static extern bool DebugActiveProcess(int processId); 11 | 12 | [DllImport("kernel32.dll", SetLastError = true)] 13 | public static extern bool DebugActiveProcessStop(int processId); 14 | 15 | [DllImport("kernel32.dll", SetLastError = true)] 16 | public static extern bool WaitForDebugEvent(out DEBUG_EVENT debugEvent, uint timeout); 17 | 18 | [DllImport("kernel32.dll", SetLastError = true)] 19 | public static extern bool ContinueDebugEvent(int processId, int threadId, CONTINUE_STATUS continuteStatus); 20 | 21 | [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, SetLastError = true)] 22 | [return: MarshalAs(UnmanagedType.Bool)] 23 | public static extern bool DebugSetProcessKillOnExit([In] bool flag); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/mesa.txt: -------------------------------------------------------------------------------- 1 | Mesa 3-D graphics library 2 | Version: 7.0 3 | 4 | Copyright (C) 1999-2007 Brian Paul All Rights Reserved. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a 7 | copy of this software and associated documentation files (the "Software"), 8 | to deal in the Software without restriction, including without limitation 9 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 | and/or sell copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 | BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 20 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace CxbxDebugger.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/config.h: -------------------------------------------------------------------------------- 1 | ////////////////////// compile-time options //////////////////////////////// 2 | 3 | // selects between the supported video modes, see boot.h for enum listing those available 4 | #define VIDEO_PREFERRED_MODE VIDEO_MODE_800x600 5 | 6 | #define FLASH 7 | 8 | // 9 | // uncomment to force CD boot mode even if MBR present 10 | // default is to boot from HDD if MBR present, else CD 11 | //#define FORCE_CD_BOOT 12 | //#define IS_XBE_CDLOADER 13 | #define MENU 14 | 15 | // uncomment to default to FATX boot if you 16 | // run xromwell as bootloader for FATX 17 | 18 | //#define DEFAULT_FATX 19 | 20 | // Usefull combinations 21 | // 22 | // Booting from CD 23 | // 24 | // #define FORCE_CD_BOOT 25 | // #define IS_XBE_CDLOADER 26 | // #undef MENU 27 | // 28 | // Use xromwell as a normal bootselector from 29 | // HDD 30 | // 31 | // #undef FORCE_CD_BOOT 32 | // #undef IS_XBE_CDLOADER 33 | // #define MENU 34 | 35 | // display a line like Composite 480 detected if uncommented 36 | #undef REPORT_VIDEO_MODE 37 | 38 | // show the MBR table if the MBR is valid 39 | #undef DISPLAY_MBR_INFO 40 | 41 | // uncomment to do Ethernet init 42 | //#define DO_ETHERNET 1 43 | 44 | 45 | #undef DEBUG_MODE 46 | #undef XPAD_VIBRA_STARTUP 47 | -------------------------------------------------------------------------------- /src/common/win32/Util.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2021 ergo720 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #pragma once 27 | 28 | #include 29 | 30 | std::string WinError2Str(); 31 | -------------------------------------------------------------------------------- /src/core/kernel/common/dbg.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : dbg.h 8 | // * 9 | // * note : XBox Kernel *Debug* Declarations 10 | // * 11 | // ****************************************************************** 12 | #ifndef XBOXKRNL_DBG_H 13 | #define XBOXKRNL_DBG_H 14 | 15 | #include "types.h" 16 | 17 | namespace xbox 18 | { 19 | 20 | XBSYSAPI EXPORTNUM(5) void_xt NTAPI DbgBreakPoint(); 21 | XBSYSAPI EXPORTNUM(6) void_xt NTAPI DbgBreakPointWithStatus 22 | ( 23 | IN ulong_xt Status 24 | ); 25 | XBSYSAPI EXPORTNUM(7) ntstatus_xt NTAPI DbgLoadImageSymbols 26 | ( 27 | IN PANSI_STRING Name, 28 | IN PVOID Base, 29 | IN ulong_ptr_xt ProcessId 30 | ); 31 | XBSYSAPI EXPORTNUM(8) ulong_xt _cdecl DbgPrint 32 | ( 33 | PCHAR Format, ... 34 | ); 35 | XBSYSAPI EXPORTNUM(10) ulong_xt NTAPI DbgPrompt 36 | ( 37 | IN PCCH Prompt, 38 | OUT PCH Response, 39 | IN ulong_xt MaximumResponseLength 40 | ); 41 | XBSYSAPI EXPORTNUM(11) void_xt NTAPI DbgUnLoadImageSymbols 42 | ( 43 | IN PANSI_STRING Name, 44 | IN PVOID Base, 45 | IN ulong_ptr_xt ProcessId 46 | ); 47 | 48 | } 49 | 50 | #endif 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/common/win32/AlignPosfix1.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | // turn off 1-byte structure alignment 27 | #pragma pack() 28 | -------------------------------------------------------------------------------- /src/common/win32/WineEnv.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #pragma once 27 | 28 | bool isWineEnv(); 29 | 30 | const char* getWineVersion(); 31 | -------------------------------------------------------------------------------- /src/gui/DlgEepromConfig.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2018 ergo720 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef DLGEEPROMCONFIG_H 26 | #define DLGEEPROMCONFIG_H 27 | 28 | 29 | void ShowEepromConfig(HWND hwnd); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /src/common/xbdm/CxbxXbdm.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2018 Patrick van Logchem 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | /*! xbdm thunk table */ 28 | extern uint32_t Cxbx_LibXbdmThunkTable[1+72]; 29 | -------------------------------------------------------------------------------- /src/gui/DlgLoggingConfig.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2018 ergo720 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #ifndef DLGLOGGINGCONFIG_H 27 | #define DLGLOGGINGCONFIG_H 28 | 29 | void ShowLoggingConfig(HWND hwnd, HWND ChildWnd); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/core/hle/D3D8/Direct3D9/VertexShaderCache.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DIRECT3D9SHADERCACHE_H 3 | #define DIRECT3D9SHADERCACHE_H 4 | 5 | #include "VertexShader.h" 6 | #include 7 | 8 | typedef uint64_t ShaderKey; 9 | 10 | // Manages creation and caching of vertex shaders 11 | class VertexShaderCache { 12 | 13 | public: 14 | ShaderKey CreateShader(const xbox::dword_xt* pXboxFunction, DWORD* pXboxFunctionSize); 15 | IDirect3DVertexShader *GetShader(ShaderKey key); 16 | void ReleaseShader(ShaderKey key); 17 | 18 | void ResetD3DDevice(IDirect3DDevice9* pD3DDevice); 19 | void Clear(); 20 | 21 | // TODO 22 | // WriteCacheToDisk 23 | // LoadCacheFromDisk 24 | 25 | private: 26 | struct LazyVertexShader { 27 | bool isReady = false; 28 | std::future compileResult; 29 | IDirect3DVertexShader* pHostVertexShader = nullptr; 30 | 31 | // TODO when is it a good idea to releas eshaders? 32 | int referenceCount = 0; 33 | 34 | // TODO persist shaders to disk 35 | // ShaderVersion? 36 | // OptimizationLevel? 37 | }; 38 | 39 | IDirect3DDevice9* pD3DDevice; 40 | std::mutex cacheMutex; 41 | std::map cache; 42 | 43 | bool _FindShader(ShaderKey key, LazyVertexShader** ppLazyShader); 44 | }; 45 | 46 | extern VertexShaderCache g_VertexShaderCache; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/common/xbox/Logging.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2020 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | #include "common/xbox_types.h" 28 | #include "common/Logging.h" 29 | 30 | namespace xbox { 31 | 32 | LOGRENDER_HEADER(D3DVECTOR) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Issue template 3 | about: Issue template. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 13 | 19 | 20 | 21 | ## Quick summary 22 | 25 | 26 | 27 | ## Details 28 | 31 | 32 | 33 | ### System Configuration: 34 | 37 | * OS 38 | * CPU 39 | * GPU 40 | * etc. 41 | 42 | ### Additional Information (if any): 43 | 46 | -------------------------------------------------------------------------------- /src/core/common/imgui/audio.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cxbx-Reloaded Project 2 | // Licensed under GPLv2+ 3 | // Refer to the COPYING file included. 4 | 5 | #define LOG_PREFIX CXBXR_MODULE::GUI 6 | 7 | #include 8 | 9 | #include "audio.hpp" 10 | 11 | #include "EmuShared.h" 12 | 13 | bool ImGuiAudio::Initialize() 14 | { 15 | g_EmuShared->GetImGuiAudioWindows(&m_windows); 16 | return true; 17 | } 18 | 19 | void ImGuiAudio::Shutdown() 20 | { 21 | g_EmuShared->SetImGuiAudioWindows(&m_windows); 22 | } 23 | 24 | void ImGuiAudio::DrawMenu() 25 | { 26 | if (ImGui::BeginMenu("Audio")) { 27 | ImGui::MenuItem("Debug General Cache Stats", NULL, &m_windows.cache_stats_general); 28 | ImGui::MenuItem("SoundBuffer Visualization", NULL, &m_windows.cache_visualization); 29 | ImGui::EndMenu(); 30 | } 31 | } 32 | 33 | void ImGuiAudio::DrawWidgets(bool is_focus, ImGuiWindowFlags input_handler) 34 | { 35 | //TODO: In need of make interface class to return generic info in some way. 36 | extern void DSound_PrintStats(bool, ImGuiWindowFlags, bool m_show_audio_stats); 37 | DSound_PrintStats(is_focus, input_handler, m_windows.cache_stats_general); 38 | 39 | extern void DSound_DrawBufferVisualization(bool, bool *p_show, ImGuiWindowFlags); 40 | DSound_DrawBufferVisualization(is_focus, &m_windows.cache_visualization, input_handler); 41 | } 42 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xhal/xhal.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : xhal.h 8 | // * 9 | // * note : XBox Hardware Abstraction Layer 10 | // * 11 | // ****************************************************************** 12 | #ifndef XHAL_H 13 | #define XHAL_H 14 | 15 | #if defined(__cplusplus) 16 | extern "C" 17 | { 18 | #endif 19 | 20 | // ****************************************************************** 21 | // * XVGA 22 | // ****************************************************************** 23 | #include "xvga.h" 24 | 25 | // ****************************************************************** 26 | // * XFile 27 | // ****************************************************************** 28 | #include "xfile.h" 29 | 30 | // ****************************************************************** 31 | // * XOHCI 32 | // ****************************************************************** 33 | #include "xohci.h" 34 | 35 | // ****************************************************************** 36 | // * The user application starts here 37 | // ****************************************************************** 38 | extern VOID XBoxStartup(); 39 | 40 | #if defined(__cplusplus) 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/ctype.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : openLIBC 4 | // * 5 | // * desc : Totally Free LIC replacement 6 | // * 7 | // * file : ctype.h 8 | // * 9 | // * note : This LIBC is TOTALLY free - do what you like with it!! 10 | // * 11 | // ****************************************************************** 12 | 13 | #ifndef __OPENXDK_CTYPE__ 14 | #define __OPENXDK_CTYPE__ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include 21 | 22 | // ***************************************************************************** 23 | // 24 | // Structures 25 | // 26 | // ***************************************************************************** 27 | 28 | 29 | // ***************************************************************************** 30 | // 31 | // Functions 32 | // 33 | // ***************************************************************************** 34 | 35 | #define tolower(c) (c>='A' && c<='Z')?c+('a'-'A'):c 36 | #define toupper(c) (c>='a' && c<='z')?c+('A'-'a'):c 37 | #define isdigit(c) (c>='0' && c<='9')?1:0 38 | #define isxdigit(c) (c>='0' && c<='9' || c>='a' && c<='f' || c>='A' && c<='F')?1:0 39 | 40 | 41 | 42 | 43 | #ifdef __cplusplus 44 | }; 45 | #endif 46 | 47 | #endif // __OPENXDK_CTYPE__ 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/gui/DlgAbout.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef DLGABOUT_H 26 | #define DLGABOUT_H 27 | 28 | #include 29 | 30 | /*! show About dialog */ 31 | extern void ShowAboutDialog(HWND hwnd); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/gui/DlgAudioConfig.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2017 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef DLGAUDIOCONFIG_H 26 | #define DLGAUDIOCONFIG_H 27 | 28 | #include 29 | 30 | /*! show audio configuration dialog */ 31 | extern void ShowAudioConfig(HWND hwnd); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xvga/xvga.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : xvga.h 8 | // * 9 | // * note : XBox VGA 10 | // * 11 | // ****************************************************************** 12 | #ifndef XVGA_H 13 | #define XVGA_H 14 | 15 | #include "openxdk.h" 16 | 17 | #if defined(__cplusplus) 18 | extern "C" 19 | { 20 | #endif 21 | 22 | // ****************************************************************** 23 | // * xvga video modes 24 | // ****************************************************************** 25 | typedef enum _xvga_mode 26 | { 27 | XVGA_MODE_256x240 = 0, 28 | XVGA_MODE_320x240, 29 | XVGA_MODE_320x200 30 | } 31 | xvga_mode; 32 | 33 | // ****************************************************************** 34 | // * set video mode 35 | // ****************************************************************** 36 | extern void xvga_setmode(xvga_mode mode); 37 | 38 | // ****************************************************************** 39 | // * wait for vblank / end vblank 40 | // ****************************************************************** 41 | extern void xvga_wait_vblank(); 42 | extern void xvga_wait_vblank_end(); 43 | 44 | #if defined(__cplusplus) 45 | } 46 | #endif 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/gui/DlgNetworkConfig.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2018 Luke Usher 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef DLGNETWORKCONFIG_H 26 | #define DLGNETWORKCONFIG_H 27 | 28 | #include 29 | 30 | /*! show network configuration dialog */ 31 | extern void ShowNetworkConfig(HWND hwnd); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/common/win32/AlignPrefix1.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | // turn on 1-byte structure alignment 27 | #pragma pack(1) 28 | 29 | // tell the compiler not to complain about this *odd* circumstance 30 | #pragma warning(disable:4103) 31 | -------------------------------------------------------------------------------- /src/core/hle/Patches.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2018 Luke Usher 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef HLEPATCHES_HPP 26 | #define HLEPATCHES_HPP 27 | 28 | #include 29 | 30 | void EmuInstallPatches(); 31 | void* GetPatchedFunctionTrampoline(std::string functionName); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/gui/DlgVideoConfig.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef DLGVIDEOCONFIG_H 26 | #define DLGVIDEOCONFIG_H 27 | 28 | #include 29 | 30 | /*! show video configuration dialog */ 31 | extern void ShowVideoConfig(HWND hwnd); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/devices/SMDevice.cpp: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2018 Patrick van Logchem 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #include "SMDevice.h" 29 | 30 | -------------------------------------------------------------------------------- /src/CxbxDebugger/DebuggerSymbols/HLECache/HLECacheFile.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Globalization; 7 | 8 | namespace CxbxDebugger 9 | { 10 | public class HLECacheFile 11 | { 12 | public Dictionary AddressMap { get; private set; } 13 | 14 | public bool Load(string FileName) 15 | { 16 | var iniReader = new Utils.INIReader(FileName); 17 | if (!iniReader.IsValid) 18 | return false; 19 | 20 | var Pairs = iniReader.GetSectionContentsPairs("Symbols"); 21 | if (Pairs == null) 22 | return false; 23 | 24 | AddressMap = new Dictionary(Pairs.Length); 25 | 26 | // Swap SYMBOL, ADDR to be ADDR -> SYMBOL 27 | uint Addr = 0; 28 | foreach (KeyValuePair Symbol in Pairs) 29 | { 30 | if (!Common.ReadHex(Symbol.Value, ref Addr)) 31 | continue; 32 | 33 | // See https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/issues/832 34 | if (!AddressMap.ContainsKey(Addr)) 35 | { 36 | AddressMap.Add(Addr, Symbol.Key); 37 | } 38 | } 39 | 40 | return true; 41 | } 42 | 43 | } 44 | } -------------------------------------------------------------------------------- /src/common/util/cliConverter.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2019 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | #include 28 | #include 29 | 30 | std::string cliMapPairsToString(std::unordered_map& array_map_out); 31 | 32 | std::unordered_map cliToMapPairs(char** argv, int argc); 33 | -------------------------------------------------------------------------------- /src/common/xbox/Types.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2017 Patrick van Logchem 21 | // * (c) 2020 RadWolfie 22 | // * 23 | // * All rights reserved 24 | // * 25 | // ****************************************************************** 26 | #pragma once 27 | 28 | /*! type of Xbe */ 29 | enum class XbeType { xtRetail, xtDebug, xtChihiro }; 30 | 31 | const char* GetSystemTypeToStr(unsigned int system); 32 | 33 | const char* GetXbeTypeToStr(XbeType xbe_type); 34 | -------------------------------------------------------------------------------- /src/common/util/hasher.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2019 - Luke Usher 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | #ifndef _HASHER_H 28 | #define _HASHER_H 29 | 30 | #include "xxhash.h" 31 | #define ComputeHash XXH3_64bits 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/core/common/video/RenderBase.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cxbx-Reloaded Project 2 | // Licensed under GPLv2+ 3 | // Refer to the COPYING file included. 4 | // 5 | // Copyright 2010 Dolphin Emulator Project 6 | // Licensed under GPLv2+ 7 | // Refer to the COPYING file included. 8 | 9 | #pragma once 10 | 11 | #include "../imgui/ui.hpp" 12 | 13 | class RenderBase : public ImGuiUI 14 | { 15 | public: 16 | RenderBase() = default; 17 | virtual ~RenderBase() = default; 18 | 19 | virtual bool Initialize(); 20 | virtual void Shutdown(); 21 | 22 | template 23 | void Render(std::function callback, T arg) 24 | { 25 | ImGuiUI::Render(callback, arg); 26 | } 27 | 28 | // When video backends has its own class, make DeviceRelease call as virtual requirement for parent class usage. 29 | void SetDeviceRelease(const std::function& func_register) { 30 | m_device_release = func_register; 31 | } 32 | 33 | void DeviceRelease() { 34 | if (m_device_release) { 35 | m_device_release(); 36 | } 37 | } 38 | 39 | void SetWindowRelease(const std::function& func_register) { 40 | m_window_release = func_register; 41 | } 42 | 43 | void WindowRelease() { 44 | if (m_window_release) { 45 | m_window_release(); 46 | } 47 | } 48 | 49 | protected: 50 | 51 | std::function m_device_release; 52 | std::function m_window_release; 53 | }; 54 | 55 | extern std::unique_ptr g_renderbase; 56 | -------------------------------------------------------------------------------- /src/core/hle/D3D8/Direct3D9/Shader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include // std::string 5 | #include // ID3DBlob (via d3d9.h > d3d11shader.h > d3dcommon.h) 6 | 7 | extern HRESULT EmuCompileShader 8 | ( 9 | std::string hlsl_str, 10 | const char* shader_profile, 11 | ID3DBlob** ppHostShader, 12 | const char* pSourceName = nullptr 13 | ); 14 | 15 | struct ShaderSources { 16 | // Pixel Shader 17 | std::string pixelShaderTemplateHlsl[3]; 18 | 19 | std::string fixedFunctionPixelShaderHlsl; 20 | std::string fixedFunctionPixelShaderPath; 21 | 22 | // Vertex Shader 23 | std::string vertexShaderTemplateHlsl[2]; 24 | 25 | std::string fixedFunctionVertexShaderHlsl; 26 | std::string fixedFunctionVertexShaderPath; 27 | 28 | std::string vertexShaderPassthroughHlsl; 29 | std::string vertexShaderPassthroughPath; 30 | 31 | // Load shaders from disk (if out-of-date) 32 | // and return the current loaded shader version 33 | int Update(); 34 | 35 | // Start a thread to watch for changes in the shader folder 36 | void InitShaderHotloading(); 37 | 38 | private: 39 | void LoadShadersFromDisk(); 40 | 41 | // counts upwards on every change detected to the shader source files at runtime 42 | std::atomic_int shaderVersionOnDisk = 0; 43 | // current loaded shader version 44 | // Initialized to < shaderVersionOnDisk 45 | int shaderVersionLoadedFromDisk = -1; 46 | }; 47 | 48 | extern ShaderSources g_ShaderSources; 49 | -------------------------------------------------------------------------------- /src/gui/input/DlgLightgunConfig.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2021 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #pragma once 29 | 30 | INT_PTR CALLBACK DlgLightgunConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 31 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/ansidecl.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : openLIBC 4 | // * 5 | // * desc : Totally Free LIC replacement 6 | // * 7 | // * file : ansidecl.h 8 | // * 9 | // * note : This LIBC is TOTALLY free - do what you like with it!! 10 | // * 11 | // ****************************************************************** 12 | 13 | #ifndef __OPENXDK_ANSIDECL__ 14 | #define __OPENXDK_ANSIDECL__ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | 21 | 22 | // ****************************************************************** 23 | // * Bigboy types 24 | // ****************************************************************** 25 | #ifndef _BIGBOY_TYPES_ 26 | #define _BIGBOY_TYPES_ 27 | typedef unsigned char byte; 28 | typedef unsigned char u8; 29 | typedef signed char s8; 30 | typedef unsigned short u16; 31 | typedef signed short s16; 32 | typedef unsigned int u32; 33 | typedef signed int s32; 34 | #endif //_BIGBOY_TYPES_ 35 | 36 | 37 | 38 | #ifndef NULL 39 | #define NULL 0x00 40 | #endif 41 | 42 | #ifndef true 43 | #define true 1 44 | #endif 45 | #ifndef false 46 | #define false 0 47 | #endif 48 | 49 | #ifndef __SIZE_T_ 50 | #define __SIZE_T_ 51 | typedef unsigned int size_t; 52 | #endif //__SIZE_T_ 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | #ifdef __cplusplus 64 | }; 65 | #endif 66 | 67 | #endif // __OPENXDK_ANSIDECL__ 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /src/gui/input/DlgDukeControllerConfig.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2019 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #pragma once 29 | 30 | INT_PTR CALLBACK DlgXidControllerConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 31 | -------------------------------------------------------------------------------- /src/gui/input/DlgSBControllerConfig.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2019 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #pragma once 29 | 30 | INT_PTR CALLBACK DlgSBControllerConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 31 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Handles/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using Microsoft.Win32.SafeHandles; 8 | 9 | namespace VsChromium.Core.Win32.Handles 10 | { 11 | static class NativeMethods 12 | { 13 | public static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); 14 | 15 | [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)] 16 | public static extern bool CloseHandle(IntPtr handle); 17 | 18 | [DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true)] 19 | public static extern IntPtr GetStdHandle(int whichHandle); 20 | 21 | [DllImport("kernel32.dll", BestFitMapping = false, CharSet = CharSet.Ansi, SetLastError = true)] 22 | public static extern bool DuplicateHandle( 23 | HandleRef hSourceProcessHandle, 24 | SafeHandle hSourceHandle, 25 | HandleRef hTargetProcess, 26 | out SafeFileHandle targetHandle, 27 | int dwDesiredAccess, 28 | bool bInheritHandle, 29 | int dwOptions); 30 | 31 | [DllImport("kernel32.dll", SetLastError = true)] 32 | public static extern UInt32 WaitForSingleObject(SafeHandle hHandle, UInt32 dwMilliseconds); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/gui/input/DlgLibusbControllerConfig.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2021 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #pragma once 29 | 30 | INT_PTR CALLBACK DlgLibUsbControllerConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); 31 | -------------------------------------------------------------------------------- /src/common/linux/AlignPosfix1.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef ALIGNPOSFIX1_H 26 | #define ALIGNPOSFIX1_H 27 | 28 | // ****************************************************************** 29 | // * 1-byte structure alignment 30 | // ****************************************************************** 31 | __attribute((packed)) 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/core/hle/D3D8/FixedFunctionState.h: -------------------------------------------------------------------------------- 1 | #ifndef FIXEDFUNCTIONSTATE_H 2 | #define FIXEDFUNCTIONSTATE_H 3 | 4 | #include "XbD3D8Types.h" 5 | #include 6 | 7 | class D3D8LightState { 8 | public: 9 | std::array Lights; 10 | 11 | // The indices of last 8 enabled lights 12 | // From least recently to most recently enabled 13 | // -1 represents empty light slots 14 | // which always appear after enabled lights 15 | std::array EnabledLights; 16 | 17 | // The number of enabled lights 18 | uint32_t EnabledLightCount = 0; 19 | 20 | D3D8LightState(); 21 | 22 | // Enable a light 23 | void EnableLight(uint32_t index, bool enable); 24 | }; 25 | 26 | class D3D8TransformState { 27 | public: 28 | D3D8TransformState(); 29 | void SetTransform(xbox::X_D3DTRANSFORMSTATETYPE state, const D3DMATRIX* pMatrix); 30 | D3DMATRIX* GetWorldView(unsigned i); 31 | void SetWorldView(unsigned i, const D3DMATRIX* pMatrix); 32 | D3DMATRIX* GetWorldViewInverseTranspose(unsigned i); 33 | 34 | // The transforms set by the Xbox title 35 | std::array Transforms; 36 | 37 | private: 38 | void RecalculateDependentMatrices(unsigned i); 39 | 40 | std::array bWorldViewDirty; 41 | // Combines world/view matrices 42 | std::array WorldView; 43 | // World/view inverse transpose for lighting calculations 44 | std::array WorldViewInverseTranspose; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/common/linux/AlignPrefix1.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef ALIGNPREFIX1_H 26 | #define ALIGNPREFIX1_H 27 | 28 | // ****************************************************************** 29 | // * For linux, we don't have any alignment prefix (just posfix) 30 | // ****************************************************************** 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/core/hle/DSOUND/common/XbInternalStruct.cpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2020 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #include "XbInternalStruct.hpp" 27 | 28 | xbox::CUnknownTemplate::CUnknownTemplate() { ref_count = 1; } 29 | 30 | xbox::CMcpxVoiceClient::_settings xbox::CMcpxVoiceClient::default_settings = 31 | { 32 | 0, // 0x08 33 | // ... 34 | }; 35 | -------------------------------------------------------------------------------- /src/gui/DlgInputConfig.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2019 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #ifndef DLGINPUTCONFIG_H 29 | #define DLGINPUTCONFIG_H 30 | 31 | void ShowInputConfig(HWND hwnd, HWND ChildWnd); 32 | extern HWND g_ChildWnd; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xgfx2d/bitmap.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : bitmap.h 8 | // * 9 | // * note : Simple 2D Bitmap library 10 | // * 11 | // ****************************************************************** 12 | 13 | #ifndef XBITMAP_H 14 | #define XBITMAP_H 15 | 16 | #include "openxdk.h" 17 | 18 | #if defined(__cplusplus) 19 | extern "C" 20 | { 21 | #endif 22 | 23 | 24 | //you shouldn't need to mess with this if you use the functions in this lib, 25 | //but feel free to :) 26 | //data = the raw 32-bit bitmap data 27 | //w = width in pixels 28 | //h = height in pixels 29 | //pitch = memory distance between rows, in pixels (you don't need to care) 30 | 31 | typedef struct 32 | { 33 | uint32 *data; 34 | int w, h; 35 | int pitch; // pitch is in pixels, not bytes as many libs do 36 | // will in most cases be same as w 37 | } Bitmap; 38 | 39 | 40 | //creates a 32-bit bitmap, sized WxH 41 | Bitmap *create_bitmap(int w, int h); 42 | 43 | //gets the screen bitmap, so you can draw to it easily 44 | //you have to have inited VGA before calling this 45 | //also currently UNTESTED, but should work :D 46 | Bitmap *get_screen_bitmap(); 47 | 48 | //destroys a bitmap 49 | void destroy_bitmap(Bitmap *bmp); 50 | 51 | //image loaders 52 | Bitmap *load_tga(char *filename); 53 | 54 | #if defined(__cplusplus) 55 | } 56 | #endif 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Common.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | 6 | namespace CxbxDebugger 7 | { 8 | class Common 9 | { 10 | static public bool ReadNumeric(string Text, ref int Out) 11 | { 12 | if (int.TryParse(Text, out Out)) 13 | { 14 | return true; 15 | } 16 | 17 | return false; 18 | } 19 | 20 | static public bool ReadNumeric(string Text, ref uint Out) 21 | { 22 | if (uint.TryParse(Text, out Out)) 23 | { 24 | return true; 25 | } 26 | 27 | return false; 28 | } 29 | 30 | static public bool ReadHex(string Text, ref uint Out) 31 | { 32 | try 33 | { 34 | if (Text.StartsWith("0x")) 35 | { 36 | Text = Text.Substring(0); 37 | } 38 | 39 | Out = Convert.ToUInt32(Text, 16); 40 | return true; 41 | } 42 | catch (Exception) { } 43 | 44 | return false; 45 | } 46 | 47 | static public bool ReadByte(string Text, ref byte Out) 48 | { 49 | try 50 | { 51 | Out = Convert.ToByte(Text, 16); 52 | return true; 53 | } 54 | catch (Exception) { } 55 | 56 | return false; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/core/kernel/exports/EmuKrnlPs.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * All rights reserved 21 | // * 22 | // ****************************************************************** 23 | #pragma once 24 | 25 | namespace xbox 26 | { 27 | void_xt PsInitSystem(); 28 | }; 29 | 30 | xbox::ntstatus_xt NTAPI CxbxrCreateThread 31 | ( 32 | OUT xbox::PHANDLE ThreadHandle, 33 | OUT xbox::PHANDLE ThreadId OPTIONAL, 34 | IN xbox::PKSTART_ROUTINE StartRoutine, 35 | IN xbox::PVOID StartContext, 36 | IN xbox::boolean_xt DebuggerThread 37 | ); 38 | -------------------------------------------------------------------------------- /projects/imgui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | project(imgui LANGUAGES CXX) 3 | # Since imgui doesn't have CMake, we'll make an interface project here. 4 | 5 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 6 | add_compile_definitions( 7 | _CRT_SECURE_NO_WARNINGS 8 | _CRT_NONSTDC_NO_DEPRECATE 9 | ) 10 | endif() 11 | 12 | # Add any defines from imconfig.h file in here without need to edit import file directly. 13 | add_compile_definitions( 14 | IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS 15 | IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS 16 | ) 17 | 18 | file (GLOB HEADERS 19 | "${CXBXR_ROOT_DIR}/import/imgui/imconfig.h" 20 | "${CXBXR_ROOT_DIR}/import/imgui/imgui.h" 21 | "${CXBXR_ROOT_DIR}/import/imgui/imgui_internal.h" 22 | "${CXBXR_ROOT_DIR}/import/imgui/imstb_rectpack.h" 23 | "${CXBXR_ROOT_DIR}/import/imgui/imstb_textedit.h" 24 | "${CXBXR_ROOT_DIR}/import/imgui/imstb_truetype.h" 25 | ) 26 | 27 | file (GLOB SOURCES 28 | "${CXBXR_ROOT_DIR}/import/imgui/imgui.cpp" 29 | "${CXBXR_ROOT_DIR}/import/imgui/imgui_draw.cpp" 30 | "${CXBXR_ROOT_DIR}/import/imgui/imgui_tables.cpp" 31 | "${CXBXR_ROOT_DIR}/import/imgui/imgui_widgets.cpp" 32 | ) 33 | 34 | source_group(TREE ${CXBXR_ROOT_DIR}/import/imgui PREFIX header FILES ${HEADERS}) 35 | 36 | source_group(TREE ${CXBXR_ROOT_DIR}/import/imgui PREFIX source FILES ${SOURCES}) 37 | 38 | add_library(${PROJECT_NAME} ${HEADERS} ${SOURCES}) 39 | 40 | target_include_directories(${PROJECT_NAME} 41 | PUBLIC "${CXBXR_ROOT_DIR}/import/imgui" 42 | ) 43 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "import/subhook"] 2 | path = import/subhook 3 | url = https://github.com/Zeex/subhook.git 4 | shallow = true 5 | [submodule "import/cs_x86"] 6 | path = import/cs_x86 7 | url = https://github.com/x1nixmzeng/cs_x86.git 8 | [submodule "import/XbSymbolDatabase"] 9 | path = import/XbSymbolDatabase 10 | url = https://github.com/Cxbx-Reloaded/XbSymbolDatabase.git 11 | [submodule "import/simpleini"] 12 | path = import/simpleini 13 | url = https://github.com/brofield/simpleini.git 14 | shallow = true 15 | [submodule "import/libtommath"] 16 | path = import/libtommath 17 | url = https://github.com/libtom/libtommath.git 18 | branch = master 19 | shallow = true 20 | [submodule "import/libtomcrypt"] 21 | path = import/libtomcrypt 22 | url = https://github.com/libtom/libtomcrypt.git 23 | branch = master 24 | shallow = true 25 | [submodule "import/xxHash"] 26 | path = import/xxHash 27 | url = https://github.com/Cyan4973/xxHash.git 28 | branch = release 29 | shallow = true 30 | [submodule "import/imgui"] 31 | path = import/imgui 32 | url = https://github.com/ocornut/imgui.git 33 | shadow = true 34 | [submodule "import/SDL2"] 35 | path = import/SDL2 36 | url = https://github.com/libsdl-org/SDL 37 | shallow = true 38 | [submodule "import/libusb"] 39 | path = import/libusb 40 | url = https://github.com/Cxbx-Reloaded/libusb 41 | branch = deadlock_fix 42 | shallow = true 43 | [submodule "import/nv2a_vsh_cpu"] 44 | path = import/nv2a_vsh_cpu 45 | url = https://github.com/abaire/nv2a_vsh_cpu.git 46 | -------------------------------------------------------------------------------- /.appveyor.yml: -------------------------------------------------------------------------------- 1 | # Documentation is here: https://www.appveyor.com/docs/appveyor-yml/ 2 | # You can validate ymls here: https://ci.appveyor.com/tools/validate-yaml 3 | 4 | skip_commits: 5 | files: 6 | - doc/* 7 | - doc/*/* 8 | - .github/* 9 | - .github/*/* 10 | - .azure-pipelines.yml 11 | - CONTRIBUTORS 12 | - COPYING 13 | - README.md 14 | - gen-msvc-project.bat 15 | - setup.bat 16 | 17 | init: 18 | - ps: |- 19 | echo "This CI isn't tested against master, and therefore, isn't guaranteed to work. Pull requests are welcome." 20 | echo "If it doesn't work and you'd rather not fix it, it's recommended to use GitHub Actions CI instead." 21 | Update-AppveyorBuild -Version "$env:appveyor_repo_commit" 22 | 23 | image: # If this is modified, please also update the build script 24 | - Visual Studio 2019 25 | 26 | configuration: # The builds will be run in this order 27 | - Release 28 | - Debug 29 | 30 | before_build: 31 | - |- 32 | git submodule update --init --recursive 33 | mkdir build 34 | cd build 35 | cmake .. -G "Visual Studio 16 2019" -A Win32 36 | 37 | build_script: 38 | - cmake --build . --config %configuration% 39 | 40 | on_success: 41 | - ps: |- 42 | If ($env:configuration -eq 'Release') { 43 | cmake --install . --config $env:configuration --prefix artifacts 44 | 7z a "$env:configuration.zip" ./artifacts/bin/* 45 | Get-ChildItem .\*.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } 46 | } 47 | -------------------------------------------------------------------------------- /src/common/VerifyAddressRanges.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of Cxbx-Reloaded. 6 | // * 7 | // * Cxbx-Reloaded is free software; you can redistribute it 8 | // * and/or modify it under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2017-2019 Patrick van Logchem 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | #pragma once 28 | 29 | extern bool VerifyBaseAddr(); 30 | 31 | extern void UnreserveMemoryRange(const int index); 32 | extern bool AllocateMemoryRange(const int index); 33 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | # Labels are in alphabetical order. 2 | 3 | cmake: 4 | - 'CMake*' 5 | - '**/CMakeLists.txt' 6 | - '**/*.cmake' 7 | 8 | cpu-emulation: 9 | - 'src/devices/x86/**' 10 | 11 | deployment: 12 | - '*.yml' 13 | - '.github/workflows/CI.yml' 14 | 15 | file-system: 16 | - 'src/core/kernel/support/EmuFile*' 17 | 18 | graphics: 19 | - 'src/core/hle/D3D8/**' 20 | - 'src/core/hle/XGRAPHIC/**' 21 | - 'src/devices/video/**' 22 | - 'src/gui/*Video*' 23 | 24 | HLE: 25 | - 'src/core/hle/**' 26 | - 'src/core/kernel/**' 27 | 28 | informational: 29 | - '**/*Logging*' 30 | - '**/*Logging*/**' 31 | - '**/README.md' 32 | 33 | input: 34 | - 'src/common/input/**' 35 | - 'src/core/hle/XAPI/input/**' 36 | - 'src/devices/usb/**' 37 | - 'src/gui/controllers/**' 38 | - 'src/gui/*Input*' 39 | 40 | kernel: 41 | - 'src/core/kernel/**' 42 | 43 | LLE: 44 | - 'src/devices/**' 45 | 46 | memory: 47 | - 'src/core/kernel/memory-manager/**' 48 | 49 | networking: 50 | - 'src/core/hle/XONLINE/**' 51 | - 'src/devices/network/**' 52 | - 'src/gui/*Network*' 53 | 54 | sound: 55 | - 'src/common/audio/**' 56 | - 'src/core/hle/DSOUND/**' 57 | - 'src/core/hle/XACTENG/**' 58 | - 'src/devices/audio/**' 59 | - 'src/gui/*Audio*' 60 | 61 | modules: 62 | - 'import/**' 63 | 64 | threading: 65 | - 'src/core/kernel/support/EmuFS*' 66 | 67 | timing: 68 | - 'src/common/Timer*' 69 | 70 | user interface: 71 | - 'src/core/common/imgui/*' 72 | - 'src/gui/**' 73 | 74 | xbdm: 75 | - 'src/common/xbdm/**' 76 | -------------------------------------------------------------------------------- /src/CxbxDebugger/DebuggerSymbols/DebuggerSymbolProvider.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | 7 | namespace CxbxDebugger 8 | { 9 | public class DebuggerSymbol 10 | { 11 | public string Name { get; set; } = ""; 12 | 13 | public uint AddrBegin { get; set; } = 0; 14 | public uint AddrEnd { get; set; } = 0; 15 | } 16 | 17 | public class DebuggerSymbolProviderBase 18 | { 19 | // Stored in a map so the addresses are sorted 20 | Dictionary Symbols = new Dictionary(); 21 | 22 | protected void AddSymbol(DebuggerSymbol Symbol) 23 | { 24 | Symbols.Add(Symbol.AddrBegin, Symbol); 25 | } 26 | 27 | protected void RemoveSymbol(DebuggerSymbol Symbol) 28 | { 29 | Symbols.Remove(Symbol.AddrBegin); 30 | } 31 | 32 | // TODO Find an inbuilt lower bound method 33 | public DebuggerSymbol FindSymbolFromAddress(uint Address) 34 | { 35 | uint BestAddr = 0; 36 | 37 | foreach (uint SymbolAddr in Symbols.Keys) 38 | { 39 | if (SymbolAddr > Address) 40 | break; 41 | 42 | BestAddr = SymbolAddr; 43 | } 44 | 45 | if (!Symbols.ContainsKey(BestAddr)) 46 | return null; 47 | 48 | return Symbols[BestAddr]; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/stdarg.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : openLIBC 4 | // * 5 | // * desc : Totally Free LIC replacement 6 | // * 7 | // * file : stdarg.h 8 | // * 9 | // * note : This LIBC is TOTALLY free - do what you like with it!! 10 | // * 11 | // ****************************************************************** 12 | // a 13 | #ifndef __OPENXDK_STDARG__ 14 | #define __OPENXDK_STDARG__ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #ifdef _MSC_VER 21 | #pragma pack(push,8) 22 | #endif 23 | 24 | 25 | #ifndef _VA_LIST_DEFINED 26 | #ifdef _M_ALPHA 27 | typedef struct { 28 | char *a0; // pointer to first argument 29 | int offset; // byte offset of next arg 30 | } va_list; 31 | #else 32 | typedef char * va_list; 33 | #endif 34 | #define _VA_LIST_DEFINED 35 | #endif 36 | 37 | 38 | 39 | // GET rid of C4146 compiler warnings: unary minus operator applied to unsigned type, result still unsigned 40 | #define NEGU32(a) ((u32) (-((s32)(a))) ) 41 | 42 | 43 | #define _INTSIZEOF(n) ( (sizeof(n) + (sizeof(int) - 1)) & NEGU32(sizeof(int)) ) 44 | #define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) ) 45 | #define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) 46 | #define va_end(ap) ( ap = (va_list)0 ) 47 | 48 | 49 | 50 | 51 | #ifdef _MSC_VER 52 | #pragma pack(pop) 53 | #endif 54 | 55 | 56 | 57 | 58 | #ifdef __cplusplus 59 | }; 60 | #endif 61 | #endif // __OPENXDK_STDARG__ 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/devices/video/nv2a_shaders_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU Geforce NV2A shader common definitions 3 | * 4 | * Copyright (c) 2015 espes 5 | * Copyright (c) 2015 Jannik Vogel 6 | * 7 | * This program is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU General Public License as 9 | * published by the Free Software Foundation; either version 2 or 10 | * (at your option) version 3 of the License. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, see . 19 | */ 20 | 21 | #ifndef HW_NV2A_SHADERS_COMMON_H 22 | #define HW_NV2A_SHADERS_COMMON_H 23 | 24 | #define STRUCT_VERTEX_DATA "struct VertexData {\n" \ 25 | " float inv_w;\n" \ 26 | " vec4 D0;\n" \ 27 | " vec4 D1;\n" \ 28 | " vec4 B0;\n" \ 29 | " vec4 B1;\n" \ 30 | " float Fog;\n" \ 31 | " vec4 T0;\n" \ 32 | " vec4 T1;\n" \ 33 | " vec4 T2;\n" \ 34 | " vec4 T3;\n" \ 35 | "};\n" 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("cxbxdbg")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("cxbxdbg")] 13 | [assembly: AssemblyCopyright("Copyright © 2017")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4a68e962-3805-4376-99d3-0ac59e9bee69")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/common/xbox/Logging.cpp: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2020 RadWolfie 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #include "common/Logging.h" 29 | #include "Logging.hpp" 30 | 31 | namespace xbox { 32 | 33 | LOGRENDER(D3DVECTOR) 34 | { 35 | return os 36 | LOGRENDER_MEMBER(x) 37 | LOGRENDER_MEMBER(y) 38 | LOGRENDER_MEMBER(z) 39 | ; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/string.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : openLIBC 4 | // * 5 | // * desc : Totally Free LIC replacement 6 | // * 7 | // * file : string.h 8 | // * 9 | // * note : This LIBC is TOTALLY free - do what you like with it!! 10 | // * 11 | // ****************************************************************** 12 | 13 | #ifndef __OPENXDK_STRING__ 14 | #define __OPENXDK_STRING__ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include 21 | 22 | // ***************************************************************************** 23 | // 24 | // Structures 25 | // 26 | // ***************************************************************************** 27 | 28 | 29 | // ***************************************************************************** 30 | // 31 | // Functions 32 | // 33 | // ***************************************************************************** 34 | char* strcat( char *dest, const char *src ); 35 | char* strncpy( char *dest, const char *src, unsigned int count ); 36 | char* strcpy( char *dest, const char *src ); 37 | size_t strlen( const char *string ); 38 | void* memcpy( void *dest, const void *src, int count ); 39 | void* memccpy( void *dest, const void *src, int c, unsigned int count ); 40 | int memcmp( const void *buff1, const void *buff2, size_t count ); 41 | void *memset( void *Dest, int fill, size_t length ); 42 | 43 | 44 | 45 | 46 | 47 | #ifdef __cplusplus 48 | }; 49 | #endif 50 | 51 | 52 | #endif // __OPENXDK_STRING__ 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/core/kernel/support/NativeHandle.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2021 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #pragma once 29 | 30 | #include 31 | 32 | void RegisterXboxHandle(xbox::HANDLE xhandle, HANDLE nhandle); 33 | void RemoveXboxHandle(xbox::HANDLE xhandle); 34 | template std::optional GetNativeHandle(xbox::HANDLE xhandle); 35 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/vschromium-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 The Chromium Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /src/core/kernel/support/PatchRdtsc.hpp: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx-Reloaded project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | #include "core\kernel\exports\xboxkrnl.h" 28 | 29 | // NOTE: This file is intended to be used only with Cxbxkrnl.cpp file. 30 | // NOTE2: If need to include header, please do in Cxbxkrnl.cpp file. 31 | 32 | bool IsRdtscInstruction(xbox::addr_xt addr); 33 | 34 | void PatchRdtscInstructions(); 35 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/errno.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 2 | This file is part of the GNU C Library. 3 | 4 | The GNU C Library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public License as 6 | published by the Free Software Foundation; either version 2 of the 7 | License, or (at your option) any later version. 8 | 9 | The GNU C Library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public 15 | License along with the GNU C Library; see the file COPYING.LIB. If 16 | not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave, 17 | Cambridge, MA 02139, USA. */ 18 | 19 | /* 20 | * ANSI Standard: 4.1.3 Errors 21 | */ 22 | 23 | #ifndef _ERRNO_H 24 | 25 | #define _ERRNO_H 1 26 | 27 | /* Get the error number constants. */ 28 | #include 29 | 30 | /* Declare the `errno' variable. */ 31 | extern int __errno; 32 | 33 | #define errno __errno 34 | 35 | #ifdef __USE_GNU 36 | /* The full and simple forms of the name with which the program was 37 | invoked. These variables are set up automatically at startup based on 38 | the value of ARGV[0] (this works only if you use GNU ld). */ 39 | extern char *program_invocation_name, *program_invocation_short_name; 40 | #endif 41 | 42 | #endif /* errno.h */ 43 | #define EINVAL -1 44 | -------------------------------------------------------------------------------- /src/devices/video/qstring.h: -------------------------------------------------------------------------------- 1 | #ifndef __QSTRING_H__ 2 | #define __QSTRING_H__ 3 | // Tiny compatibility layer until we have proper C++ strings (or something) 4 | 5 | #include 6 | #include 7 | 8 | typedef std::string QString; 9 | 10 | static QString* qstring_from_fmt(std::string fmt, ...) { 11 | int size = ((int)fmt.size()) * 2 + 50; // Use a rubric appropriate for your code 12 | std::string *str = new std::string(""); 13 | va_list ap; 14 | while (1) { // Maximum two passes on a POSIX system... 15 | str->resize(size); 16 | va_start(ap, fmt); 17 | int n = vsnprintf((char *)str->data(), size, fmt.c_str(), ap); 18 | va_end(ap); 19 | if (n > -1 && n < size) { // Everything worked 20 | str->resize(n); 21 | return str; 22 | } 23 | if (n > -1) // Needed size returned 24 | size = n + 1; // For null char 25 | else 26 | size *= 2; // Guess at a larger size (OS specific) 27 | } 28 | return str; 29 | } 30 | 31 | #define qstring_new() new std::string("") 32 | #define qstring_from_str(str) new std::string(str) 33 | #define qstring_append_chr(qs, c) qs->append(c) 34 | #define qstring_append(gs1, s2) gs1->append(s2) 35 | #define qstring_get_str(gs) gs->c_str() //FIXME: Needs to be free'd later! 36 | #define qstring_append_int(gs, i) qstring_append_fmt(gs, "%d", (i)) 37 | #define qstring_append_fmt(gs, fmt, ...) gs->append(*(std::string*)(qstring_from_fmt(fmt, ##__VA_ARGS__))) 38 | #define qstring_get_length(gs) gs->size() 39 | 40 | #define qobject_unref(X) // FIXME: Mostly free, but needs to be reviewed case-by-case 41 | #define qobject_ref(X) // FIXME: Tricky! 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/common/util/CPUID.h: -------------------------------------------------------------------------------- 1 | // https://stackoverflow.com/questions/1666093/cpuid-implementations-in-c 2 | 3 | #ifndef CPUID_H 4 | #define CPUID_H 5 | 6 | #ifdef _WIN32 7 | #include 8 | #include 9 | #include 10 | typedef unsigned __int32 uint32_t; 11 | 12 | #else 13 | #include 14 | #endif 15 | 16 | class CPUID { 17 | uint32_t regs[4]; 18 | 19 | public: 20 | explicit CPUID(unsigned i) { 21 | #ifdef _WIN32 22 | __cpuid((int *)regs, (int)i); 23 | 24 | #else 25 | asm volatile 26 | ("cpuid" : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3]) 27 | : "a" (i), "c" (0)); 28 | // ECX is set to zero for CPUID function 4 29 | #endif 30 | } 31 | 32 | const std::bitset<32> &EAX() const { return (std::bitset<32> &)regs[0]; } 33 | const std::bitset<32> &EBX() const { return (std::bitset<32> &)regs[1]; } 34 | const std::bitset<32> &ECX() const { return (std::bitset<32> &)regs[2]; } 35 | const std::bitset<32> &EDX() const { return (std::bitset<32> &)regs[3]; } 36 | }; 37 | 38 | class SimdCaps { 39 | 40 | public: 41 | const bool SSE(void) { return f_1.EDX()[25]; } 42 | const bool SSE2(void) { return f_1.EDX()[26]; } 43 | const bool SSE3(void) { return f_1.ECX()[0]; } 44 | const bool SSSE3(void) { return f_1.ECX()[9]; } 45 | const bool SSE41(void) { return f_1.ECX()[19]; } 46 | const bool SSE42(void) { return f_1.ECX()[20]; } 47 | const bool AVX(void) { return f_1.ECX()[1]; } 48 | const bool AVX2(void) { return f_7.EBX()[5]; } 49 | 50 | private: 51 | const CPUID f_1 = CPUID(1); 52 | const CPUID f_7 = CPUID(7); 53 | }; 54 | 55 | static SimdCaps bob; 56 | 57 | #endif // CPUID_H 58 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/NtStatus.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | namespace CxbxDebugger 5 | { 6 | // Documented codes from https://msdn.microsoft.com/en-gb/library/cc704588.aspx 7 | 8 | public static class NtStatus 9 | { 10 | public const uint STATUS_SUCCESS = 0; 11 | 12 | public const uint STATUS_WAIT_1 = 1; 13 | public const uint STATUS_WAIT_2 = 2; 14 | public const uint STATUS_WAIT_3 = 3; 15 | 16 | public const uint STATUS_ACCESS_VIOLATION = 0xC0000005; 17 | 18 | public const uint STATUS_CONTROL_C_EXIT = 0xC000013A; 19 | 20 | public static string PrettyPrint(uint ExitCode) 21 | { 22 | string ExitCodeString; 23 | 24 | switch (ExitCode) 25 | { 26 | case STATUS_SUCCESS: 27 | ExitCodeString = "Finished"; 28 | break; 29 | 30 | case STATUS_WAIT_1: 31 | case STATUS_WAIT_2: 32 | case STATUS_WAIT_3: 33 | ExitCodeString = "Aborted"; 34 | break; 35 | 36 | case STATUS_ACCESS_VIOLATION: 37 | ExitCodeString = "Access violation"; 38 | break; 39 | 40 | case STATUS_CONTROL_C_EXIT: 41 | ExitCodeString = "Debug session ended"; 42 | break; 43 | 44 | default: 45 | ExitCodeString = string.Format("{0:X8}", ExitCode); 46 | break; 47 | } 48 | 49 | return ExitCodeString; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/UnicodeString.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | 8 | namespace VsChromium.Core.Win32 { 9 | // Win32 UNICODE_STRING structure. 10 | [StructLayout(LayoutKind.Sequential, Pack=1)] 11 | public struct UnicodeString { 12 | // The length in bytes of the string pointed to by buffer, not including the null-terminator. 13 | private ushort length; 14 | // The total allocated size in memory pointed to by buffer. 15 | private ushort maximumLength; 16 | // A pointer to the buffer containing the string data. 17 | private IntPtr buffer; 18 | 19 | public ushort Length { get { return length; } } 20 | public ushort MaximumLength { get { return maximumLength; } } 21 | public IntPtr Buffer { get { return buffer; } } 22 | } 23 | 24 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 25 | public struct UnicodeStringWow64 { 26 | // The length in bytes of the string pointed to by buffer, not including the null-terminator. 27 | private ushort length; 28 | // The total allocated size in memory pointed to by buffer. 29 | private ushort maximumLength; 30 | 31 | // 4 bytes of padding. 32 | private uint padding; 33 | 34 | // A 64-bit pointer to the buffer containing the string data. 35 | private ulong buffer; 36 | 37 | public ushort Length { get { return length; } } 38 | public ushort MaximumLength { get { return maximumLength; } } 39 | public ulong Buffer { get { return buffer; } } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/core/hle/D3D8/XbPushBuffer.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef XBPUSHBUFFER_H 26 | #define XBPUSHBUFFER_H 27 | 28 | #include "core/hle/D3D8/XbVertexBuffer.h" // for CxbxDrawContext 29 | 30 | extern void CxbxDrawIndexed(CxbxDrawContext &DrawContext); 31 | extern void CxbxDrawPrimitiveUP(CxbxDrawContext &DrawContext); 32 | 33 | extern void EmuExecutePushBuffer 34 | ( 35 | xbox::X_D3DPushBuffer *pPushBuffer, 36 | xbox::X_D3DFixup *pFixup 37 | ); 38 | 39 | extern void EmuExecutePushBufferRaw 40 | ( 41 | void *pPushData, 42 | uint32_t uSizeInBytes 43 | ); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/common/xdvdfs-tools/buffered_io.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | #ifndef __BUFFERED_IO_H__ 4 | #define __BUFFERED_IO_H__ 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | namespace xbox 11 | { 12 | 13 | #define BOOL xbox::boolean_xt 14 | #define LPSTR LPCH 15 | 16 | // Determines how large a sector is 17 | #define SECTOR_SIZE 2048 18 | 19 | // Determines how many sectors are buffered in each instance of CDIO_READ 20 | #define DISK_BUFFER 64 21 | 22 | typedef struct { 23 | xbox::dword_xt SectorList[DISK_BUFFER]; // Ring buffer for buffered disk i/o 24 | xbox::dword_xt LockList[DISK_BUFFER]; // Lock for each buffered sector 25 | xbox::byte_xt DiskBuffer[SECTOR_SIZE * DISK_BUFFER]; // Storage room for buffered sectors 26 | xbox::dword_xt WriteIndex; // Write pointer 27 | 28 | // Pointer to arbitrary data passed at init 29 | // (usually a file or device handle) 30 | PVOID Data; 31 | 32 | BOOL (*Sectors)( // Routine to get sectors 33 | PVOID Data, // Pointer to arbitrary data 34 | PVOID Buffer, // Buffer to fill 35 | xbox::dword_xt StartSector, // Start sector 36 | xbox::dword_xt ReadSize); // Number of sectors to read 37 | 38 | } CDIO_READ, *PCDIO_READ; 39 | 40 | // Get a sector from buffer and lock it 41 | extern PBYTE GetSectorBuffered( 42 | PCDIO_READ This, 43 | xbox::dword_xt SectorNumber); 44 | 45 | // Release a locked buffer 46 | extern void ReleaseBufferedSector( 47 | PCDIO_READ This, 48 | xbox::dword_xt SectorNumber); 49 | 50 | }; 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif // __BUFFERED_IO_H__ 57 | -------------------------------------------------------------------------------- /src/common/win32/Util.cpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2021 ergo720 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #include "Util.h" 27 | #include "Windows.h" 28 | 29 | 30 | std::string WinError2Str() 31 | { 32 | DWORD error_id = GetLastError(); 33 | if (error_id == ERROR_SUCCESS) { 34 | return std::string(); 35 | } 36 | 37 | LPSTR msg_buff = nullptr; 38 | size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 39 | nullptr, error_id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast(&msg_buff), 0, nullptr); 40 | 41 | std::string msg(msg_buff, size); 42 | LocalFree(msg_buff); 43 | 44 | return msg; 45 | } 46 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Debugger/DebuggerEventInterfaces.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | 6 | namespace CxbxDebugger 7 | { 8 | public interface IDebuggerSessionEvents 9 | { 10 | void OnDebugStart(); 11 | void OnDebugEnd(); 12 | void OnDebugTitleLoaded(string Title); 13 | void OnDebugTargetChanged(string CommandLine); 14 | } 15 | 16 | public interface IDebuggerProcessEvents 17 | { 18 | void OnProcessCreate(DebuggerProcess Process); 19 | void OnProcessExit(DebuggerProcess Process, uint ExitCode); 20 | } 21 | 22 | public interface IDebuggerThreadEvents 23 | { 24 | void OnThreadCreate(DebuggerThread Thread); 25 | void OnThreadExit(DebuggerThread Thread, uint ExitCode); 26 | void OnThreadNamed(DebuggerThread Thread); 27 | } 28 | 29 | public interface IDebuggerModuleEvents 30 | { 31 | void OnModuleLoaded(DebuggerModule Module); 32 | void OnModuleUnloaded(DebuggerModule Module); 33 | } 34 | 35 | public interface IDebuggerOutputEvents 36 | { 37 | void OnDebugOutput(string Message); 38 | } 39 | 40 | public interface IDebuggerExceptionEvents 41 | { 42 | bool OnAccessViolation(DebuggerThread Thread, uint Code, uint Address); 43 | void OnBreakpoint(DebuggerThread Thread, uint Address, uint Code, bool FirstChance); 44 | } 45 | 46 | public interface IDebuggerFileEvents 47 | { 48 | void OnFileOpened(DebuggerMessages.FileOpened Info); 49 | void OnFileRead(DebuggerMessages.FileRead Info); 50 | void OnFileWrite(DebuggerMessages.FileWrite Info); 51 | void OnFileClosed(DebuggerMessages.FileClosed Info); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Win32/Processes/Startupinfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System; 6 | using System.Runtime.InteropServices; 7 | using Microsoft.Win32.SafeHandles; 8 | 9 | namespace VsChromium.Core.Win32.Processes { 10 | [StructLayout(LayoutKind.Sequential)] 11 | public class STARTUPINFO : IDisposable { 12 | public int cb; 13 | public IntPtr lpReserved = IntPtr.Zero; 14 | public IntPtr lpDesktop = IntPtr.Zero; 15 | public IntPtr lpTitle = IntPtr.Zero; 16 | public int dwX; 17 | public int dwY; 18 | public int dwXSize; 19 | public int dwYSize; 20 | public int dwXCountChars; 21 | public int dwYCountChars; 22 | public int dwFillAttribute; 23 | public int dwFlags; 24 | public short wShowWindow; 25 | public short cbReserved2; 26 | public IntPtr lpReserved2 = IntPtr.Zero; 27 | public SafeFileHandle hStdInput = new SafeFileHandle(IntPtr.Zero, false); 28 | public SafeFileHandle hStdOutput = new SafeFileHandle(IntPtr.Zero, false); 29 | public SafeFileHandle hStdError = new SafeFileHandle(IntPtr.Zero, false); 30 | 31 | public STARTUPINFO() { 32 | cb = Marshal.SizeOf(this); 33 | } 34 | 35 | public void Dispose() { 36 | if (hStdInput != null && !hStdInput.IsInvalid) { 37 | hStdInput.Close(); 38 | hStdInput = null; 39 | } 40 | if (hStdOutput != null && !hStdOutput.IsInvalid) { 41 | hStdOutput.Close(); 42 | hStdOutput = null; 43 | } 44 | if (hStdError != null && !hStdError.IsInvalid) { 45 | hStdError.Close(); 46 | hStdError = null; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/common/win32/Mutex.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef MUTEX_H 26 | #define MUTEX_H 27 | 28 | #include 29 | 30 | // mutex object (intended to be inherited from) 31 | class Mutex 32 | { 33 | public: 34 | Mutex(); 35 | 36 | void Lock(); 37 | void Unlock(); 38 | bool IsLocked() { return m_LockCount > 0; } 39 | 40 | private: 41 | LONG m_MutexLock; // Mutex lock 42 | LONG m_OwnerProcess; // Current owner process (or zero) 43 | LONG m_OwnerThread; // Current owner thread 44 | LONG m_LockCount; // Lock count within this thread 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/common/input/RawDevice.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2021 ergo720 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #pragma once 29 | 30 | #include "Windows.h" 31 | #include 32 | 33 | 34 | namespace RawInput 35 | { 36 | typedef enum _INIT_STATUS : int 37 | { 38 | NOT_INIT = -2, 39 | INIT_ERROR, 40 | INIT_SUCCESS, 41 | } 42 | INIT_STATUS; 43 | 44 | extern int InitStatus; 45 | extern bool IgnoreHotplug; 46 | 47 | // initialize RawInput 48 | void Init(std::mutex &Mtx, bool is_gui, HWND hwnd); 49 | // shutdown RawInput 50 | void DeInit(); 51 | } 52 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xvga/xvga_internal.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : xvga_internal.h 8 | // * 9 | // * note : XBox VGA 10 | // * 11 | // ****************************************************************** 12 | #ifndef XVGA_INTERNAL_H 13 | #define XVGA_INTERNAL_H 14 | 15 | #include "openxdk.h" 16 | 17 | #if defined(__cplusplus) 18 | extern "C" 19 | { 20 | #endif 21 | 22 | // ****************************************************************** 23 | // * vga registers 24 | // ****************************************************************** 25 | static volatile char * const ATTR_REG_INDEX = (char * const)0xFD6013c0; 26 | static volatile char * const ATTR_REG_DATA = (char * const)0xFD6013c1; 27 | static volatile char * const CRTC_REG_INDEX = (char * const)0xFD6013d4; 28 | static volatile char * const CRTC_REG_DATA = (char * const)0xFD6013d5; 29 | static volatile char * const GRA_REG_INDEX = (char * const)0xFD0c03ce; 30 | static volatile char * const GRA_REG_DATA = (char * const)0xFD0c03cf; 31 | static volatile char * const SEQ_REG_INDEX = (char * const)0xFD0c03c4; 32 | static volatile char * const SEQ_REG_DATA = (char * const)0xFD0c03c5; 33 | static volatile char * const MISC_REG = (char * const)0xFD0c03c2; 34 | 35 | #define XVGA_VBL 0xfd6013da 36 | 37 | // ****************************************************************** 38 | // * vga_reg 39 | // ****************************************************************** 40 | typedef struct _vga_reg 41 | { 42 | unsigned short port; 43 | unsigned char index; 44 | unsigned char value; 45 | } 46 | vga_reg; 47 | 48 | #if defined(__cplusplus) 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /src/CxbxDebugger/FileEventManager.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace CxbxDebugger 11 | { 12 | enum FileEventType 13 | { 14 | Opened, 15 | Read, 16 | Write, 17 | Closed, 18 | FailedOpen, 19 | } 20 | 21 | struct FileEvents 22 | { 23 | public FileEventType Type; 24 | public string Name; 25 | public uint Length; 26 | public uint Offset; 27 | 28 | public FileEvents(FileEventType Type, string Name, uint Length = 0, uint Offset = uint.MaxValue) 29 | { 30 | this.Type = Type; 31 | this.Name = Name; 32 | this.Length = Length; 33 | this.Offset = Offset; 34 | } 35 | 36 | public static FileEvents Opened(string Name) 37 | { 38 | return new FileEvents(FileEventType.Opened, Name); 39 | } 40 | 41 | public static FileEvents OpenedFailed(string Name) 42 | { 43 | return new FileEvents(FileEventType.FailedOpen, Name); 44 | } 45 | 46 | public static FileEvents Read(string Name, uint Length, uint Offset) 47 | { 48 | return new FileEvents(FileEventType.Read, Name, Length, Offset); 49 | } 50 | 51 | public static FileEvents Write(string Name, uint Length, uint Offset) 52 | { 53 | return new FileEvents(FileEventType.Write, Name, Length, Offset); 54 | } 55 | 56 | public static FileEvents Closed(string Name) 57 | { 58 | return new FileEvents(FileEventType.Closed, Name); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/CxbxDebugger/Debugger/DebuggerCallstack.cs: -------------------------------------------------------------------------------- 1 | // Written by x1nixmzeng for the Cxbx-Reloaded project 2 | // 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace CxbxDebugger 8 | { 9 | public class DebuggerStackFrame 10 | { 11 | public IntPtr PC { get; } 12 | public IntPtr Base { get; } 13 | public IntPtr Stack { get; } 14 | 15 | // TOOD Resolve symbol for this frame 16 | 17 | public DebuggerStackFrame(IntPtr EIP, IntPtr EBP, IntPtr ESP) 18 | { 19 | PC = EIP; 20 | Base = EBP; 21 | Stack = ESP; 22 | } 23 | 24 | public DebuggerStackFrame(IntPtr EIP, IntPtr EBP) 25 | { 26 | PC = EIP; 27 | Base = EBP; 28 | Stack = IntPtr.Zero; 29 | } 30 | } 31 | 32 | public class DebuggerCallstack 33 | { 34 | int NumSupportedFrames = 16; 35 | public List StackFrames { get; } 36 | 37 | public DebuggerCallstack() 38 | { 39 | StackFrames = new List(NumSupportedFrames); 40 | } 41 | 42 | public DebuggerCallstack(int MaxFrames) 43 | { 44 | NumSupportedFrames = MaxFrames; 45 | StackFrames = new List(NumSupportedFrames); 46 | } 47 | 48 | public void AddFrame(DebuggerStackFrame StackFrame) 49 | { 50 | if (CanCollect) 51 | { 52 | StackFrames.Add(StackFrame); 53 | } 54 | } 55 | 56 | public bool CanCollect 57 | { 58 | get 59 | { 60 | return StackFrames.Count < NumSupportedFrames; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/common/crypto/EmuSha.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * (c) 2018 ergo720 22 | // * 23 | // * All rights reserved 24 | // * 25 | // ****************************************************************** 26 | 27 | #ifndef EMUSHA_H 28 | #define EMUSHA_H 29 | 30 | #include "stdint.h" 31 | 32 | #define A_SHA_DIGEST_LEN 20 33 | 34 | typedef struct _SHA1_CTX 35 | { 36 | uint32_t state[5]; 37 | uint32_t count[2]; 38 | unsigned char buffer[64]; 39 | } SHA1_CTX; 40 | 41 | void SHA1Init(SHA1_CTX* context); 42 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len); 43 | void SHA1Final(unsigned char digest[A_SHA_DIGEST_LEN], SHA1_CTX* context); 44 | void CalcSHA1Hash(unsigned char digest[A_SHA_DIGEST_LEN], const unsigned char* data, uint32_t len); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /.azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | branches: 3 | include: 4 | - '*' 5 | paths: 6 | exclude: # Azure Pipelines doesn't support recursive wildcards, see 7 | - '.github/*' # https://developercommunity.visualstudio.com/t/support-wildcards-in-trigger-path-filters-1/366363 8 | - '.github/*/*' 9 | - '*.bat' 10 | - '.appveyor.yml' 11 | - 'doc/*/*' 12 | - 'doc/*' 13 | 14 | pr: 15 | branches: 16 | include: 17 | - '*' 18 | paths: 19 | exclude: 20 | - '.github/*' 21 | - '.github/*/*' 22 | - '*.bat' 23 | - '.appveyor.yml' 24 | - 'doc/*/*' 25 | - 'doc/*' 26 | 27 | pool: 28 | vmImage: windows-latest 29 | strategy: 30 | matrix: 31 | Release: 32 | configuration: Release 33 | Debug: 34 | configuration: Debug 35 | 36 | steps: 37 | - pwsh: | 38 | echo "This CI isn't tested against master, and therefore, isn't guaranteed to work. Pull requests are welcome." 39 | echo "If it doesn't work and you'd rather not fix it, it's recommended to use GitHub Actions CI instead." 40 | displayName: Third-Party CI Warning 41 | 42 | - checkout: self 43 | submodules: recursive 44 | 45 | - pwsh: cmake -B build -A Win32 46 | displayName: Before build 47 | 48 | - pwsh: cmake --build . --config $env:configuration 49 | workingDirectory: build 50 | displayName: Build 51 | 52 | - pwsh: cmake --install . --config $env:configuration --prefix $(Build.ArtifactStagingDirectory) 53 | workingDirectory: build 54 | condition: and(succeeded(), eq(variables['configuration'], 'Release')) 55 | displayName: Prepare artifacts 56 | 57 | - publish: $(Build.ArtifactStagingDirectory) 58 | artifact: $(configuration) 59 | condition: and(succeeded(), eq(variables['configuration'], 'Release')) 60 | displayName: Publish artifacts 61 | -------------------------------------------------------------------------------- /import/glew-2.0.0/doc/glew.txt: -------------------------------------------------------------------------------- 1 | The OpenGL Extension Wrangler Library 2 | Copyright (C) 2008-2016, Nigel Stewart 3 | Copyright (C) 2002-2008, Milan Ikits 4 | Copyright (C) 2002-2008, Marcelo E. Magallon 5 | Copyright (C) 2002, Lev Povalahev 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without 9 | modification, are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, 12 | this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | * The name of the author may be used to endorse or promote products 17 | derived from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29 | THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /src/common/util/gloffscreen/glextensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU OpenGL extensions 3 | * 4 | * Copyright (c) 2015 espes 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 or 9 | * (at your option) version 3 of the License. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | */ 19 | #ifndef GLEXTEENSIONS_H_ 20 | #define GLEXTEENSIONS_H_ 21 | 22 | #ifdef __APPLE__ 23 | #include "gl/gloffscreen.h" 24 | extern void (*glFrameTerminatorGREMEDY)(void); 25 | 26 | #define GL_DEBUG_SOURCE_APPLICATION 0x824A 27 | #define GL_DEBUG_TYPE_MARKER 0x8268 28 | #define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B 29 | #define GL_DEBUG_OUTPUT 0x92E0 30 | 31 | extern void (*glDebugMessageInsert) (GLenum source, GLenum type, GLuint id, 32 | GLenum severity, GLsizei length, 33 | const GLchar *buf); 34 | extern void (*glPushDebugGroup)(GLenum source, GLuint id, GLsizei length, 35 | const GLchar *message); 36 | extern void (*glPopDebugGroup)(void); 37 | extern void (*glObjectLabel)(GLenum identifier, GLuint name, GLsizei length, 38 | const GLchar *label); 39 | 40 | #endif 41 | 42 | void glextensions_init(void); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xgfx2d/blit.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : blit.c 8 | // * 9 | // * note : blitter with clipping, uses any one of the blitters from 10 | // * blitters.h per scanline 11 | // * 12 | // ****************************************************************** 13 | 14 | #ifndef XBLIT_H 15 | #define XBLIT_H 16 | 17 | #include 18 | #include "xgfx2d/bitmap.h" 19 | 20 | #if defined(__cplusplus) 21 | extern "C" 22 | { 23 | #endif 24 | 25 | 26 | // INSTRUCTIONS 27 | // ************ 28 | // pass in a blitter from blitters.h 29 | // dx,dy = destination x,y 30 | // sx,sy = source x,y 31 | // sw,sh = width and height of the copy 32 | // blitter = copying method, check blitters.h 33 | // parameter = if a blitter method needs a parameter pass it here, 34 | // else pass 0 35 | // Sample: 36 | // blit(source,dest,10,10,0,0,20,20,alphavalue_blit,128) 37 | // will blit the topleft 20x20 of source to 10,10 in dest, 38 | // blended ~50% (128/255) 39 | void blit(Bitmap *dest, Bitmap *src, 40 | int dx, int dy, 41 | int sx, int sy, int sw, int sh, 42 | void (*blitter)(uint32*,uint32*,int,int), 43 | int parameter); 44 | 45 | // just copies entire source bitmap to 0,0 of dest 46 | void full_blit(Bitmap *dest, Bitmap *src, 47 | void (*blitter)(uint32*,uint32*,int,int), 48 | int parameter); 49 | 50 | // shortcut to copy entire source bitmap to a coordinate in dest 51 | // use for simple sprites 52 | void blit_at(Bitmap *dest, Bitmap *src, 53 | int x, int y, 54 | void (*blitter)(uint32*,uint32*,int,int), 55 | int parameter); 56 | 57 | 58 | #if defined(__cplusplus) 59 | } 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/core/kernel/exports/EmuKrnlKe.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2019 ergo720 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #pragma once 27 | 28 | namespace xbox 29 | { 30 | void_xt NTAPI KeSetSystemTime 31 | ( 32 | IN PLARGE_INTEGER NewTime, 33 | OUT PLARGE_INTEGER OldTime 34 | ); 35 | 36 | void_xt NTAPI KeInitializeTimer 37 | ( 38 | IN PKTIMER Timer 39 | ); 40 | 41 | template 42 | void_xt KeInitializeThread( 43 | IN OUT PKTHREAD Thread, 44 | IN PVOID KernelStack, 45 | IN ulong_xt KernelStackSize, 46 | IN ulong_xt TlsDataSize, 47 | IN PKSYSTEM_ROUTINE SystemRoutine, 48 | IN PKSTART_ROUTINE StartRoutine, 49 | IN PVOID StartContext, 50 | IN PKPROCESS Process 51 | ); 52 | 53 | void_xt KeEmptyQueueApc(); 54 | } 55 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/huge_val.h: -------------------------------------------------------------------------------- 1 | /* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity). 2 | Used by and functions for overflow. 3 | 4 | Copyright (C) 1992 Free Software Foundation, Inc. 5 | This file is part of the GNU C Library. 6 | 7 | The GNU C Library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Library General Public License as 9 | published by the Free Software Foundation; either version 2 of the 10 | License, or (at your option) any later version. 11 | 12 | The GNU C Library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Library General Public License for more details. 16 | 17 | You should have received a copy of the GNU Library General Public 18 | License along with the GNU C Library; see the file COPYING.LIB. If 19 | not, write to the Free Software Foundation, Inc., 675 Mass Ave, 20 | Cambridge, MA 02139, USA. */ 21 | 22 | #ifndef _HUGE_VAL_H 23 | #define _HUGE_VAL_H 1 24 | 25 | #include 26 | #include 27 | 28 | /* IEEE positive infinity. */ 29 | 30 | #if __BYTE_ORDER == __BIG_ENDIAN 31 | #define __huge_val_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } 32 | #endif 33 | #if __BYTE_ORDER == __LITTLE_ENDIAN 34 | #define __huge_val_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } 35 | #endif 36 | 37 | #ifdef __GNUC__ 38 | #define HUGE_VAL \ 39 | (__extension__ ((union { unsigned char __c[8]; \ 40 | double __d; }) \ 41 | { __huge_val_bytes }).__d) 42 | #else /* Not GCC. */ 43 | static __const unsigned char __huge_val[8] = __huge_val_bytes; 44 | #define HUGE_VAL (*(__const double *) __huge_val) 45 | #endif /* GCC. */ 46 | 47 | #endif /* huge_val.h */ 48 | -------------------------------------------------------------------------------- /src/core/common/imgui/ui.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cxbx-Reloaded Project 2 | // Licensed under GPLv2+ 3 | // Refer to the COPYING file included. 4 | // 5 | // Copyright 2010 Dolphin Emulator Project 6 | // Licensed under GPLv2+ 7 | // Refer to the COPYING file included. 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | #include "settings.h" 17 | #include "audio.hpp" 18 | #include "video.hpp" 19 | 20 | constexpr float IMGUI_MIN_DIST_TOP = 20.0f; 21 | constexpr float IMGUI_MIN_DIST_SIDE = 1.0f; 22 | 23 | class ImGuiUI 24 | { 25 | public: 26 | ImGuiUI() = default; 27 | virtual ~ImGuiUI() = default; 28 | 29 | void ToggleImGui(); 30 | bool IsImGuiFocus(); 31 | void UpdateFPSCounter(); 32 | 33 | void DrawMenu(); 34 | void DrawWidgets(); 35 | 36 | protected: 37 | 38 | bool Initialize(); 39 | void Shutdown(); 40 | 41 | template 42 | void Render(C callback, T arg) 43 | { 44 | // Some games seem to call Swap concurrently, so we need to ensure only one thread 45 | // at a time can render ImGui 46 | std::unique_lock lock(m_imgui_mutex, std::try_to_lock); 47 | if (!lock) return; 48 | 49 | callback(this, arg); 50 | } 51 | 52 | void UpdateCurrentMSpFAndFPS(); 53 | 54 | std::mutex m_imgui_mutex; 55 | ImGuiContext* m_imgui_context; 56 | char m_file_path[FILENAME_MAX+1]; 57 | bool m_is_focus; 58 | // Using as their own member than integrate may be helpful to bind different plugin at latter change? 59 | ImGuiAudio m_audio; 60 | ImGuiVideo m_video; 61 | overlay_settings m_settings; 62 | unsigned int m_lle_flags; 63 | float fps_counter; 64 | // Make them as settings storage. 65 | /*bool m_show_fps; 66 | bool m_show_LLE_stats; 67 | // Make them as memory storage. 68 | bool m_show_vertex_stats; 69 | bool m_show_audio_stats; 70 | */ 71 | }; 72 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDIO_H__ 2 | #define __STDIO_H__ 1 3 | 4 | 5 | # ifdef __cplusplus 6 | extern "C" { 7 | # endif 8 | 9 | #include 10 | 11 | //int sprintf(char*, const char *format, ...); 12 | int __cdecl sprintf(char *, const char *, ...); 13 | 14 | //#include 15 | #include 16 | #include 17 | 18 | 19 | #define _O_RDONLY (0x00000001) 20 | #define _O_WRONLY (0x00000002) 21 | #define _O_RDWR (0x00000003) 22 | #define _O_NBLOCK (0x00000010) 23 | #define _O_APPEND (0x00000100) 24 | #define _O_CREAT (0x00000200) 25 | #define _O_TRUNC (0x00000400) 26 | #define _O_EXCL (0x00000800) 27 | #define _O_TEMPORARY (0x00001000) 28 | #define _O_TEXT (0x00004000) 29 | #define _O_BINARY (0x00008000) 30 | 31 | #define O_RDONLY _O_RDONLY 32 | #define O_WRONLY _O_WRONLY 33 | #define O_RDWR _O_RDWR 34 | #define O_NBLOCK _O_NBLOCK 35 | #define O_APPEND _O_APPEND 36 | #define O_CREAT _O_CREAT 37 | #define O_EXCL _O_EXCL 38 | #define O_TRUNC _O_TRUNC 39 | #define O_TEMPORARY _O_TEMPORARY 40 | #define O_TEXT _O_TEXT 41 | #define O_BINARY _O_BINARY 42 | 43 | 44 | #define SEEK_SET 0 45 | #define SEEK_CUR 1 46 | #define SEEK_END 2 47 | 48 | extern u32 LastErrorCode; 49 | 50 | int _open( char *filename, int oflag, int permission ); 51 | int _read( int handle, void *buffer, unsigned int count ); 52 | int _write( int handle, void* buffer, unsigned int count ); 53 | int _close( int handle ); 54 | int _lseek( int handle, u32 offset, int base ); 55 | 56 | int nprintf(const char *format, ...); 57 | int printf(const char *format, ...); 58 | //int sprintf(char*, const char *format, ...); 59 | 60 | 61 | # ifdef __cplusplus 62 | } 63 | # endif 64 | 65 | #endif // __STDIO_H__ 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/core/hle/DSOUND/DirectSound/DirectSoundLogging.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2019 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #ifndef DIRECTSOUNDLOGGING_H 26 | #define DIRECTSOUNDLOGGING_H 27 | 28 | #include 29 | #include 30 | #include "Logging.h" 31 | 32 | enum DS_BCAPS : int; 33 | enum DS_RESULT : int; 34 | enum WAVEFORMAT_CHANNEL : int; 35 | enum WAVEFORMAT_TAG : int; 36 | FLAGS2STR_HEADER(DS_BCAPS) 37 | ENUM2STR_HEADER(DS_RESULT) 38 | ENUM2STR_HEADER(WAVEFORMAT_CHANNEL) 39 | ENUM2STR_HEADER(WAVEFORMAT_TAG) 40 | 41 | LOGRENDER_HEADER(GUID) 42 | LOGRENDER_HEADER(WAVEFORMATEX) 43 | LOGRENDER_HEADER(WAVEFORMATEXTENSIBLE) 44 | LOGRENDER_HEADER(DSBUFFERDESC) 45 | LOGRENDER_HEADER(D3DVECTOR) 46 | 47 | std::string DirectSoundErrorString(HRESULT hResult); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/emulator/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of Cxbx-Reloaded. 6 | // * 7 | // * Cxbx-Reloaded is free software; you can redistribute it 8 | // * and/or modify it under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2017-2019 Patrick van Logchem 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #include "EmuShared.h" // For hActiveModule 29 | 30 | // The entry point for the DLL application. 31 | BOOL APIENTRY DllMain(HMODULE hModule, 32 | DWORD ul_reason_for_call, 33 | LPVOID lpReserved 34 | ) 35 | { 36 | switch (ul_reason_for_call) 37 | { 38 | case DLL_PROCESS_ATTACH: 39 | hActiveModule = hModule; // For shared code 40 | break; 41 | case DLL_THREAD_ATTACH: 42 | case DLL_THREAD_DETACH: 43 | case DLL_PROCESS_DETACH: 44 | break; 45 | } 46 | 47 | return TRUE; 48 | } 49 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/math.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : openLIBC 4 | // * 5 | // * desc : Totally Free LIC replacement 6 | // * 7 | // * file : math.h 8 | // * 9 | // * note : This LIBC is TOTALLY free - do what you like with it!! 10 | // * 11 | // ****************************************************************** 12 | 13 | #ifndef __OPENXDK_MATH__ 14 | #define __OPENXDK_MATH__ 15 | 16 | //here for now 17 | #define OPENXDK_UNIMPLEMENTEDC(x) // x are not implemented in C! 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | //Double-precision functions 24 | 25 | //trig 26 | double sin(double); 27 | double cos(double); 28 | double tan(double); 29 | double asin(double); 30 | double acos(double); 31 | double atan(double); 32 | double atan2(double, double); 33 | 34 | //power 35 | double sqrt(double); 36 | double pow(double, double); //approx. 37 | double exp(double); //approx. 38 | double log(double); //approx. 39 | double log10(double); //approx 40 | double hypot(double, double); 41 | 42 | //rounding 43 | double ceil(double); 44 | double floor(double); 45 | double fmod(double, double); 46 | double fabs(double); 47 | 48 | //Single-precision functions 49 | 50 | //trig 51 | float sinf(float); 52 | float cosf(float); 53 | float tanf(float); 54 | float asinf(float); 55 | float acosf(float); 56 | float atanf(float); 57 | float atan2f(float, float); 58 | 59 | //power 60 | float sqrtf(float); 61 | float powf(float, float);//approx. 62 | float expf(float);//approx. 63 | float logf(float);//approx. 64 | float log10f(float);//approx 65 | float hypotf(float, float); 66 | 67 | //rounding 68 | float ceilf(float); 69 | float floorf(float); 70 | float fmodf(float, float); 71 | float fabsf(float); 72 | 73 | #ifdef __cplusplus 74 | }; 75 | #endif 76 | 77 | #endif //__OPENXDK_MATH__ 78 | -------------------------------------------------------------------------------- /src/core/hle/DSOUND/DirectSound/DSStream_PacketManager.hpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2017-2020 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | #include 28 | 29 | #include "DirectSound.hpp" 30 | 31 | #define vector_hvp_iterator std::vector::iterator 32 | 33 | extern void DSStream_Packet_Clear( 34 | vector_hvp_iterator &buffer, 35 | DWORD status, 36 | xbox::LPFNXMOCALLBACK Xb_lpfnCallback, 37 | LPVOID Xb_lpvContext, 38 | xbox::X_CDirectSoundStream* pThis); 39 | 40 | extern bool DSStream_Packet_Process(xbox::X_CDirectSoundStream* pThis); 41 | 42 | extern void DSStream_Packet_FlushEx_Reset(xbox::X_CDirectSoundStream* pThis); 43 | 44 | extern bool DSStream_Packet_Flush(xbox::X_CDirectSoundStream* pThis); 45 | -------------------------------------------------------------------------------- /import/OpenXDK/include/glibc/attic/stdio.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #ifndef __STDIO_H__ 6 | #define __STDIO_H__ 7 | 8 | 9 | # ifdef __cplusplus 10 | extern "C" { 11 | # endif 12 | 13 | #include 14 | 15 | /* 16 | 17 | //int sprintf(char*, const char *format, ...); 18 | int __cdecl sprintf(char *, const char *, ...); 19 | 20 | //#include 21 | #include 22 | #include 23 | 24 | 25 | #define _O_RDONLY (0x00000001) 26 | #define _O_WRONLY (0x00000002) 27 | #define _O_RDWR (0x00000003) 28 | #define _O_NBLOCK (0x00000010) 29 | #define _O_APPEND (0x00000100) 30 | #define _O_CREAT (0x00000200) 31 | #define _O_TRUNC (0x00000400) 32 | #define _O_EXCL (0x00000800) 33 | #define _O_TEMPORARY (0x00001000) 34 | #define _O_TEXT (0x00004000) 35 | #define _O_BINARY (0x00008000) 36 | 37 | #define O_RDONLY _O_RDONLY 38 | #define O_WRONLY _O_WRONLY 39 | #define O_RDWR _O_RDWR 40 | #define O_NBLOCK _O_NBLOCK 41 | #define O_APPEND _O_APPEND 42 | #define O_CREAT _O_CREAT 43 | #define O_EXCL _O_EXCL 44 | #define O_TRUNC _O_TRUNC 45 | #define O_TEMPORARY _O_TEMPORARY 46 | #define O_TEXT _O_TEXT 47 | #define O_BINARY _O_BINARY 48 | 49 | 50 | #define SEEK_SET 0 51 | #define SEEK_CUR 1 52 | #define SEEK_END 2 53 | 54 | extern u32 LastErrorCode; 55 | 56 | int _open( char *filename, int oflag, int permission ); 57 | int _read( int handle, void *buffer, unsigned int count ); 58 | int _write( int handle, void* buffer, unsigned int count ); 59 | int _close( int handle ); 60 | int _lseek( int handle, u32 offset, int base ); 61 | 62 | int nprintf(const char *format, ...); 63 | int printf(const char *format, ...); 64 | //int sprintf(char*, const char *format, ...); 65 | */ 66 | 67 | # ifdef __cplusplus 68 | } 69 | # endif 70 | 71 | #endif // __STDIO_H__ 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/common/win32/WineEnv.cpp: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2002-2003 Aaron Robinson 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | 26 | #include 27 | 28 | typedef const char* (CDECL* LPFN_WINEGETVERSION)(void); 29 | LPFN_WINEGETVERSION wine_get_version; 30 | 31 | static bool CheckForWine() { 32 | HMODULE hNtDll = GetModuleHandle("ntdll.dll"); 33 | if (hNtDll != nullptr) { 34 | wine_get_version = (LPFN_WINEGETVERSION)GetProcAddress(hNtDll, "wine_get_version"); 35 | // If wine is found, store pointer to the function for later call. 36 | if (wine_get_version) { 37 | return true; 38 | } 39 | } 40 | return false; 41 | } 42 | 43 | bool isWineEnv() 44 | { 45 | static bool bIsWine = CheckForWine(); 46 | return bIsWine; 47 | } 48 | 49 | const char* getWineVersion() 50 | { 51 | return wine_get_version(); 52 | } 53 | -------------------------------------------------------------------------------- /src/common/util/gloffscreen/glextensions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU OpenGL extensions 3 | * 4 | * Copyright (c) 2015 espes 5 | * 6 | * This program is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU General Public License as 8 | * published by the Free Software Foundation; either version 2 or 9 | * (at your option) version 3 of the License. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, see . 18 | */ 19 | #include "gloffscreen.h" 20 | #include "glextensions.h" 21 | 22 | #ifdef __APPLE__ 23 | void (*glFrameTerminatorGREMEDY)(void); 24 | 25 | void (*glDebugMessageInsert) (GLenum source, GLenum type, GLuint id, 26 | GLenum severity, GLsizei length, 27 | const GLchar *buf); 28 | void (*glPushDebugGroup)(GLenum source, GLuint id, GLsizei length, 29 | const GLchar *message); 30 | void (*glPopDebugGroup)(void); 31 | void (*glObjectLabel)(GLenum identifier, GLuint name, GLsizei length, 32 | const GLchar *label); 33 | 34 | #endif 35 | 36 | void glextensions_init(void) 37 | { 38 | #ifdef __APPLE__ 39 | glFrameTerminatorGREMEDY = 40 | glo_get_extension_proc("glFrameTerminatorGREMEDY"); 41 | glDebugMessageInsert = glo_get_extension_proc("glDebugMessageInsert"); 42 | glPushDebugGroup = glo_get_extension_proc("glPushDebugGroup"); 43 | glPopDebugGroup = glo_get_extension_proc("glPopDebugGroup"); 44 | glObjectLabel = glo_get_extension_proc("glObjectLabel"); 45 | #endif 46 | } 47 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xusb/linux/bitops.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_BITOPS_H 2 | #define _LINUX_BITOPS_H 3 | 4 | 5 | /* 6 | * ffs: find first bit set. This is defined the same way as 7 | * the libc and compiler builtin ffs routines, therefore 8 | * differs in spirit from the above ffz (man ffs). 9 | */ 10 | 11 | static __inline int generic_ffs(int x) 12 | { 13 | int r = 1; 14 | 15 | if (!x) 16 | return 0; 17 | if (!(x & 0xffff)) { 18 | x >>= 16; 19 | r += 16; 20 | } 21 | if (!(x & 0xff)) { 22 | x >>= 8; 23 | r += 8; 24 | } 25 | if (!(x & 0xf)) { 26 | x >>= 4; 27 | r += 4; 28 | } 29 | if (!(x & 3)) { 30 | x >>= 2; 31 | r += 2; 32 | } 33 | if (!(x & 1)) { 34 | x >>= 1; 35 | r += 1; 36 | } 37 | return r; 38 | } 39 | 40 | /* 41 | * hweightN: returns the hamming weight (i.e. the number 42 | * of bits set) of a N-bit word 43 | */ 44 | 45 | static __inline unsigned int generic_hweight32(unsigned int w) 46 | { 47 | unsigned int res = (w & 0x55555555) + ((w >> 1) & 0x55555555); 48 | res = (res & 0x33333333) + ((res >> 2) & 0x33333333); 49 | res = (res & 0x0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F); 50 | res = (res & 0x00FF00FF) + ((res >> 8) & 0x00FF00FF); 51 | return (res & 0x0000FFFF) + ((res >> 16) & 0x0000FFFF); 52 | } 53 | 54 | static __inline unsigned int generic_hweight16(unsigned int w) 55 | { 56 | unsigned int res = (w & 0x5555) + ((w >> 1) & 0x5555); 57 | res = (res & 0x3333) + ((res >> 2) & 0x3333); 58 | res = (res & 0x0F0F) + ((res >> 4) & 0x0F0F); 59 | return (res & 0x00FF) + ((res >> 8) & 0x00FF); 60 | } 61 | 62 | static __inline unsigned int generic_hweight8(unsigned int w) 63 | { 64 | unsigned int res = (w & 0x55) + ((w >> 1) & 0x55); 65 | res = (res & 0x33) + ((res >> 2) & 0x33); 66 | return (res & 0x0F) + ((res >> 4) & 0x0F); 67 | } 68 | 69 | #include "asm/bitops.h" 70 | 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /src/CxbxDebugger/README.md: -------------------------------------------------------------------------------- 1 | # CxbxDebugger 2 | 3 | CxbxDebugger is an experimental tool to aid debugging Xbox executables from within Cxbx. 4 | 5 | ![Cxbx-Debugger screenshot at breakpoint](https://i.imgur.com/DaNEbBC.png) 6 | 7 | ![Cxbx-Debugger screenshot at memory editor](https://i.imgur.com/zd076l7.png) 8 | 9 | The goal is to resolve XBE symbols using the function signatures identified by Cxbx-Reloaded. 10 | 11 | This is a workaround for patching or creating PDB files at runtime for Cxbx-Reloaded (where the memory region is pre-allocated - see `virtual_memory_placeholder`). However, in future it may be viable to supporting loading symbols from matching PDB files. 12 | 13 | ## Methods 14 | 15 | The debugger is a standalone C# application which wraps the child instance of Cxbx-Reloaded used to launch the XBE file. 16 | 17 | It uses the debugger API provided by Windows, primarily **WaitForDebugEvent** and **ContinueDebugEvent**. The C# implementation is taken from the VsChromium project. 18 | 19 | ## Roadmap 20 | 21 | ### Primary 22 | 23 | * ~~Create wrapper for the Cxbx-Reloaded child process~~ 24 | * ~~Support new threads~~ 25 | * ~~Support displaying of interrupts and exceptions~~ 26 | * Support resolving relevant XBE symbols from a callstack 27 | 28 | ### Secondary 29 | 30 | * ~~Suspending threads and checking memory~~ 31 | * ~~Breakpoints - inserting and handling interrupts~~ 32 | 33 | ## Thanks 34 | 35 | * The Chromium Project for [@VsChromium](https://github.com/chromium/vs-chromium), specifically [these Win32 sources](https://github.com/chromium/vs-chromium/tree/master/src/Core/Win32) 36 | 37 | * Sebastian Solnica ([@lowleveldesign](https://github.com/lowleveldesign)) for [Process Governor](https://github.com/lowleveldesign/process-governor) and [MinDBG](https://github.com/lowleveldesign/mindbg) 38 | 39 | * Alexander Bothe ([@aBothe](https://github.com/aBothe)) for [DDebugger](https://github.com/aBothe/DDebugger) 40 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xgfx2d/blitters.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : OpenXDK 4 | // * 5 | // * desc : Open Source XBox Development Kit 6 | // * 7 | // * file : blitters.h 8 | // * 9 | // * note : A bunch of fast MMX blitters of various kinds 10 | // * Alpha blending, additive blending, you name it 11 | // * Many non-ASM substitutes needs writing if we're gonna 12 | // * support GNU C 13 | // * 14 | // ****************************************************************** 15 | 16 | #ifndef XBLITTERS_H 17 | #define XBLITTERS_H 18 | 19 | #include 20 | #include "xgfx2d/bitmap.h" 21 | 22 | #if defined(__cplusplus) 23 | extern "C" 24 | { 25 | #endif 26 | 27 | #define DECLARE_BLITTER(name,parameter) \ 28 | void name (uint32 *s, uint32 *d, int len, int parameter) 29 | 30 | 31 | //you're supposed to pass these ones into blit, check blit.h 32 | 33 | DECLARE_BLITTER(normal_blit,none); //just a straight blit 34 | DECLARE_BLITTER(sprite_blit,none); //ignores 0xFF00FF 35 | DECLARE_BLITTER(additive_blit,none); //adds images together 36 | DECLARE_BLITTER(additive_alpha_blit,alpha); //adds image multiplied with alpha to the other one 37 | DECLARE_BLITTER(alpha_blit,none); //alpha from image! yes, a true alpha blender 38 | DECLARE_BLITTER(alphavalue_blit,alpha); //1 alpha value for the entire image 39 | DECLARE_BLITTER(alphavalue_sprite_blit,none); //1 alpha value for the entire image, ignores black 40 | DECLARE_BLITTER(alphavalue50_blit,none); //50% alpha value for the entire image (faster?) 41 | DECLARE_BLITTER(multiply_blit,none); //like multiply in photoshop 42 | DECLARE_BLITTER(invert_blit,none); //odd :) 43 | DECLARE_BLITTER(subtractive_blit,none); //subtracts one image from the other 44 | DECLARE_BLITTER(colorize_sprite_blit,color); //uhm, for drawing colored fonts 45 | 46 | #if defined(__cplusplus) 47 | } 48 | #endif 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /import/OpenXDK/include/xlibc/stdlib.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * proj : openLIBC 4 | // * 5 | // * desc : Totally Free LIC replacement 6 | // * 7 | // * file : stdlib.h 8 | // * 9 | // * note : This LIBC is TOTALLY free - do what you like with it!! 10 | // * 11 | // ****************************************************************** 12 | 13 | #ifndef __OPENXDK_STDLIB__ 14 | #define __OPENXDK_STDLIB__ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include 21 | 22 | 23 | // ***************************************************************************** 24 | // 25 | // Defines etc. 26 | // 27 | // ***************************************************************************** 28 | // we could just as well use any other randmax 2^x-1 but this seems to be the standard 29 | #define RAND_MAX 32767 30 | 31 | // ***************************************************************************** 32 | // 33 | // Structures 34 | // 35 | // ***************************************************************************** 36 | 37 | 38 | typedef struct Sdiv_t{ // div structure 39 | int quot; 40 | int rem; 41 | } div_t; 42 | 43 | 44 | typedef struct Sldiv_t{ // ldiv structure 45 | long int quot; 46 | long int rem; 47 | } ldiv_t; 48 | 49 | 50 | 51 | // ***************************************************************************** 52 | // 53 | // Functions 54 | // 55 | // ***************************************************************************** 56 | int abs( int i ); 57 | void abort( void ); 58 | div_t div( int number, int divisor ); 59 | ldiv_t ldiv( long int number, long int divisor ); 60 | char* itoa( int value, char *string, int radix ); 61 | char* ltoa( long value, char *string, int radix ); 62 | int rand( void ); 63 | void srand( unsigned int ); 64 | 65 | 66 | #ifdef __cplusplus 67 | }; 68 | #endif 69 | 70 | #endif //__OPENXDK_STDLIB__ 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/common/util/std_extend.hpp: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This is free and unencumbered software released into the public domain. 6 | // * 7 | // * Anyone is free to copy, modify, publish, use, compile, sell, or 8 | // * distribute this software, either in source code form or as a compiled 9 | // * binary, for any purpose, commercial or non-commercial, and by any 10 | // * means. 11 | // * 12 | // * In jurisdictions that recognize copyright laws, the author or authors 13 | // * of this software dedicate any and all copyright interest in the 14 | // * software to the public domain. We make this dedication for the benefit 15 | // * of the public at large and to the detriment of our heirs and 16 | // * successors. We intend this dedication to be an overt act of 17 | // * relinquishment in perpetuity of all present and future rights to this 18 | // * software under copyright law. 19 | // * 20 | // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21 | // * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22 | // * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23 | // * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 24 | // * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 25 | // * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | // * OTHER DEALINGS IN THE SOFTWARE. 27 | // * 28 | // * For more information, please refer to 29 | // * 30 | // ****************************************************************** 31 | #pragma once 32 | 33 | #include 34 | 35 | template 36 | constexpr size_t ARRAY_SIZE(T(&)[N]) 37 | { 38 | return N; 39 | } 40 | -------------------------------------------------------------------------------- /src/core/common/imgui/settings.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx-Reloaded project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2021 RadWolfie 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | // Intended to store as permanent settings 28 | 29 | typedef struct { 30 | bool build_hash; 31 | bool fps; 32 | bool hle_lle_stats; 33 | bool title_name; 34 | bool file_name; 35 | } overlay_settings; 36 | 37 | // Intended for EmuShared only below 38 | 39 | const int IMGUI_INI_SIZE_MAX = 1024; 40 | 41 | typedef struct { 42 | bool is_focus; 43 | bool Reserved[3]; 44 | int ini_size; // Cannot be touch anywhere except EmuShared's constructor. 45 | char ini_settings[IMGUI_INI_SIZE_MAX]; 46 | } imgui_general; 47 | 48 | typedef struct { 49 | bool cache_stats_general; 50 | bool cache_visualization; 51 | bool Reserved[3]; 52 | } imgui_audio_windows; 53 | 54 | typedef struct { 55 | bool cache_stats_vertex; 56 | bool Reserved[3]; 57 | } imgui_video_windows; 58 | -------------------------------------------------------------------------------- /src/devices/MCPXDevice.h: -------------------------------------------------------------------------------- 1 | // ****************************************************************** 2 | // * 3 | // * This file is part of the Cxbx project. 4 | // * 5 | // * Cxbx and Cxbe are free software; you can redistribute them 6 | // * and/or modify them under the terms of the GNU General Public 7 | // * License as published by the Free Software Foundation; either 8 | // * version 2 of the license, or (at your option) any later version. 9 | // * 10 | // * This program is distributed in the hope that it will be useful, 11 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // * GNU General Public License for more details. 14 | // * 15 | // * You should have recieved a copy of the GNU General Public License 16 | // * along with this program; see the file COPYING. 17 | // * If not, write to the Free Software Foundation, Inc., 18 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 19 | // * 20 | // * (c) 2018 Patrick van Logchem 21 | // * 22 | // * All rights reserved 23 | // * 24 | // ****************************************************************** 25 | #pragma once 26 | 27 | #include "devices\PCIDevice.h" // For PCIDevice 28 | 29 | typedef enum { 30 | MCPX_1_0, 31 | MCPX_1_1, 32 | } MCPXROMVersion; 33 | 34 | typedef enum { 35 | MCPX_X2, 36 | MCPX_X3, 37 | } MCPXRevision; 38 | 39 | class MCPXDevice : public PCIDevice { 40 | public: 41 | // constructor 42 | MCPXDevice(MCPXRevision revision); 43 | 44 | // PCI Device functions 45 | void Init(); 46 | void Reset(); 47 | 48 | uint32_t IORead(int barIndex, uint32_t port, unsigned size); 49 | void IOWrite(int barIndex, uint32_t port, uint32_t value, unsigned size); 50 | uint32_t MMIORead(int barIndex, uint32_t addr, unsigned size); 51 | void MMIOWrite(int barIndex, uint32_t addr, uint32_t value, unsigned size); 52 | private: 53 | MCPXRevision m_revision; 54 | }; 55 | -------------------------------------------------------------------------------- /src/devices/audio/AC97Device.h: -------------------------------------------------------------------------------- 1 | // This is an open source non-commercial project. Dear PVS-Studio, please check it. 2 | // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com 3 | // ****************************************************************** 4 | // * 5 | // * This file is part of the Cxbx project. 6 | // * 7 | // * Cxbx and Cxbe are free software; you can redistribute them 8 | // * and/or modify them under the terms of the GNU General Public 9 | // * License as published by the Free Software Foundation; either 10 | // * version 2 of the license, or (at your option) any later version. 11 | // * 12 | // * This program is distributed in the hope that it will be useful, 13 | // * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // * GNU General Public License for more details. 16 | // * 17 | // * You should have recieved a copy of the GNU General Public License 18 | // * along with this program; see the file COPYING. 19 | // * If not, write to the Free Software Foundation, Inc., 20 | // * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. 21 | // * 22 | // * (c) 2018 Luke Usher 23 | // * 24 | // * All rights reserved 25 | // * 26 | // ****************************************************************** 27 | 28 | #ifndef _AC97_H_ 29 | #define _AC97_H_ 30 | 31 | #include "../PCIDevice.h" 32 | class AC97Device : public PCIDevice { 33 | public: 34 | using PCIDevice::PCIDevice; 35 | 36 | // PCI Functions 37 | void Init(); 38 | void Reset(); 39 | 40 | uint32_t IORead(int barIndex, uint32_t addr, unsigned size = sizeof(uint8_t)); 41 | void IOWrite(int barIndex, uint32_t addr, uint32_t data, unsigned size = sizeof(uint8_t)); 42 | 43 | uint32_t MMIORead(int barIndex, uint32_t addr, unsigned size); 44 | void MMIOWrite(int barIndex, uint32_t addr, uint32_t value, unsigned size); 45 | private: 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/devices/video/nv2a_psh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QEMU Geforce NV2A pixel shader translation 3 | * 4 | * Copyright (c) 2013 espes 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License version 2 as published by the Free Software Foundation. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, see 17 | * 18 | * Contributions after 2012-01-13 are licensed under the terms of the 19 | * GNU GPL, version 2 or (at your option) any later version. 20 | */ 21 | 22 | #ifndef HW_NV2A_PSH_H 23 | #define HW_NV2A_PSH_H 24 | 25 | #include "qstring.h" 26 | 27 | enum PshAlphaFunc { 28 | ALPHA_FUNC_NEVER, 29 | ALPHA_FUNC_LESS, 30 | ALPHA_FUNC_EQUAL, 31 | ALPHA_FUNC_LEQUAL, 32 | ALPHA_FUNC_GREATER, 33 | ALPHA_FUNC_NOTEQUAL, 34 | ALPHA_FUNC_GEQUAL, 35 | ALPHA_FUNC_ALWAYS, 36 | }; 37 | 38 | typedef struct PshState { 39 | /* fragment shader - register combiner stuff */ 40 | uint32_t combiner_control; 41 | uint32_t shader_stage_program; 42 | uint32_t other_stage_input; 43 | uint32_t final_inputs_0; 44 | uint32_t final_inputs_1; 45 | 46 | uint32_t rgb_inputs[8], rgb_outputs[8]; 47 | uint32_t alpha_inputs[8], alpha_outputs[8]; 48 | 49 | bool rect_tex[4]; 50 | bool compare_mode[4][4]; 51 | bool alphakill[4]; 52 | 53 | bool alpha_test; 54 | enum PshAlphaFunc alpha_func; 55 | 56 | bool window_clip_exclusive; 57 | unsigned int window_clip_count; 58 | } PshState; 59 | 60 | QString *psh_translate(const PshState state); 61 | 62 | #endif 63 | --------------------------------------------------------------------------------