Commit Graph

90 Commits

Author SHA1 Message Date
The-Little-Wolf
dc4db67f9c [Kernel] - Change OddObj to X_DISPATCH_HEADER
- Change OddObj to X_DISPATCH_HEADER
- Add unknown X_KWAIT_REASON flag
- Fixed InitializeGuestObject mistake
- Replaces unknowns in kthread using nukernel as reference
2026-05-16 23:57:19 +02:00
Herman S.
c17a3b19fb [Kernel] Implement per-process TLS allocation
Previous global TLS bitmap was shared across all processes. Now
per-process TLS bitmaps stored X_KPROCESS structures which should
better match Xbox360 architecture.
2026-04-13 12:42:42 +09:00
Herman S.
65b74819aa [Threading] Implement priority boost on wake
When a thread wakes from a kernel wait, the Xenon scheduler boosts its
effective priority by the increment passed to the signaling call
(KeSetEvent, KeReleaseSemaphore, KeReleaseMutant). The boost is clamped
to the per-thread max_dynamic_priority cap, respects the guest
boost_disabled flag, and is drained on the next quantum expiry.
Guest KTHREAD priority fields are now initialized from parent process
defaults, and the previously unknown fields involved have been renamed
to match their identified purpose.
2026-04-11 17:05:05 +09:00
Herman S.
b3d8a21b72 [Threading] Add thread priority mapping with timer-driven quantum decay
And default ignore_thread_priorities to false.

Map Xenon's 0-31 priority range across all 5 host priority levels
instead of collapsing 0-17 into kNormal.

Use timer-driven quantum decay (~20ms period) matching Xenon's
60-quantum / 3-per-tick cycle to prevent starvation by gradually lowering
effective priority for non-real-time threads (< 18), piggybacking on the
existing 1ms timestamp timer.
2026-04-10 08:21:42 +09:00
Herman S.
02fccd9113 [Kernel/XMP] Add title-specific file I/O hooks for XMP volume sync
Some games persist BGM volume through their own save files but never
call XMPSetVolume. Add a TitlePatch system that intercepts NtReadFile/
NtWriteFile to apply game-specific logic as well as logic to identify
the memory location that the volume data is read into and monitor that
memory location for changes, updating XMP player volume if it changes
during gameplay.

Includes patches for known games with this issue:
Dead or Alive Xtreme 2 (544307D2), PGR4 (4D5307F9) and PGR3 (4D5307D1)
2026-03-09 08:59:15 +09:00
Gliniak
efa0a8bb39 [XBDM] Added sketchy implementation of DmPMCGetCounterName and DmPMCInstallAndStart 2025-11-03 22:42:43 +01:00
The-Little-Wolf
64b7695f52 [Kernel] - restrict kXNotificationLiveConnectionChanged to startup
- allow for dashboard to show achievements and themes again.
2025-08-08 22:44:28 +02:00
Gliniak
2969a04145 [Kernel] Added support for loading modules before main 2025-08-03 20:40:30 +02:00
Adrian
4702bfb94c [XBDM] Cleanup Stubs 2025-07-27 18:57:19 +02:00
The-Little-Wolf
39621ddec8 [KERNEL] - Replacing Unk
- Changes here are from Chrispy's Nukernel
2025-07-26 22:27:21 +02:00
Gliniak
4182852a4b [Base] Split of xbox.h file
- Splitted into: kernel.h and xam.h
- Removed UpdateSpaData from KernelState into ContentManager
2025-07-26 21:25:32 +02:00
Gliniak
b864149575 [Misc] Cleanup in Kernel 2025-05-31 12:00:47 +02:00
Adrian
6b055f1f74 [XAM] Assert struct sizes and misc struct adjustments 2025-05-05 19:26:34 +02:00
The-Little-Wolf
8cf15a8d54 [XAM/INFO] - Implement XamSetActiveDashAppInfo and XamGetActiveDashAppInfo
- Implement XamGetActiveDashAppInfo and XamSetActiveDashAppInfo
2025-05-05 12:12:20 +02:00
The-Little-Wolf
be44b9ba33 [XAM/INFO] - Implement multiple functions
- Implement XamIsSystemExperienceTitleId, XamIsSystemTitleId, XamIsXbox1TitleId
- Replaced is_title_system_type
- Changed XamIsCurrentTitleDash
- Reduced magic numbers
2025-04-25 11:06:06 +02:00
The-Little-Wolf
0771938db6 [Kernel] - Implemented SystemManagementController Class
- Added handling (partial or dummy) for SMC actions:
 - QUERY_TEMP_SENSOR, QUERY_TRAY, QUERY_AV_PACK, QUERY_SMC_VERSION, QUERY_IR_ADDRESS, QUERY_TILT_SENSOR
 - SET_FAN_SPEED_CPU, SET_FAN_SPEED_GPU, SET_DVD_TRAY, SET_IR_ADDRESS, SET_POWER_LED, SET_LEDS

- Stub HalOpenCloseODDTray, XamLoaderGetMediaInfo, XamLoaderGetMediaInfoEx
- Partially Implement HalSendSMCMessage
- Implement XamLoaderGetDvdTrayState
- HalOpenCloseODDTray is used by dash and HalSendSMCMessage can be used by custom dashboards
2025-04-06 17:30:56 +02:00
Gliniak
1110cdd372 [Kernel] Added support for writing/reading GPD files
This breaks settings in games that are using them and savefiles in games that use settings to store progress
2025-03-07 11:59:48 +01:00
Gliniak
e409a384ec [Kernel] Removed XAM specific entities from KernelState 2024-09-28 10:14:59 +02:00
Gliniak
71de56416d [Kernel] Cleanup in TU applying code.
Externally it is still applied via: ApplyTitleUpdate
But internally it is splitted into:
 - FindTitleUpdate
 - LoadTitleUpdate
 - IsPatchSignatureProper
 - ApplyTitleUpdate

Added host window with warning about TU incompatibility
2024-09-07 18:26:00 +02:00
Hyper
a867320a87 [Kernel] Implemented XexLoadImageFromMemory 2024-08-27 22:14:21 +02:00
Gliniak
ce990e2828 [HID] Added support for joystick deadzones
- Simplified logic for connected controllers
2024-06-01 14:54:01 +02:00
Gliniak
5ca173cd4f [Kernel] Fixed issue with unsupported deployment type by games.
Thanks Emoose for code for checking title_id type
2024-04-26 20:21:40 +02:00
Gliniak
1ff3dc4d10 [Kernel] Added support for custom kernel version 2024-03-05 11:33:14 +01:00
Gliniak
5ade4a1288 [XAM] Added Message: XTitleGetDeploymentType 2024-02-12 22:09:19 +01:00
Gliniak
18b5a6706a [Kernel] Revert Guest->Host Object Mapping 2024-01-20 10:15:54 +01:00
disjtqz
9b3601c6fa [Kernel] add object type stub functions, export object types 2023-10-14 22:35:49 +02:00
disjtqz
a7b047b2a2 Implement kernel processes 2023-10-12 22:13:40 +02:00
disjtqz
b5ddd30572 moved xsemaphore to xthread.d
add typed guest pointer template
add X_KSPINLOCK, rework spinlock functions.
rework irql related code, use irql on pcr instead of on XThread
add guest linked list helper functions
renamed ProcessInfoBlock to X_KPROCESS
assigned names to many kernel structure fields
2023-10-11 17:43:59 +02:00
chss95cs@gmail.com
2fa2f1a78c Add more wrapper functions to ppc_context_t in kernel, want to switch…
… over to referencing state through ppc_context as much as possible, it'll make implementing things like kernel processes much easier in the future

Move forward definitions of kernel types into kernel_fwd.h

Stub implementation of  XamLoaderGetMediaInfoEx
Partially implement XamSetDashContext
implement XamGetDashContext
Stub implementation of XamUserIsUnsafeProgrammingAllowed
Stub implementation of XamUserGetSubscriptionType
Expanded the supported object types for ObReferenceObjectByHandle and wrapped the logic for encoding the type in a constexpr function
ObReferenceObjectByName was taking lpstring_t for first param, but the function actually takes X_ANSI_STRING ptr

NtReleaseMutant actually does not return anything from KeReleaseMutant, it just checks the handle and returns whether it was invalid.

Changed the raise/lower irql functions to just set the irql on the pcr instead of setting it on field of Processor, processor is a shared object and irql is per-thread

Semi-stub implementation of KeGetImagePageTableEntry. I locked at it in the HV and got it so the values are in the same range the HV returns + actually reflect the page & memory range, but i doubt its equal to the values the hv returns on real hw. Used by modern dashboards, don't know for what.
Log error message for ObDereferenceObject w/ null ptr.

Allocate a special fixed page that dashboards reference, currently don't know what the data on that page is supposed to be.
Add current_irql field to X_KPCR
Added Device object member of XObject::Type enum
Added some notes about other gpu registers, found a table of register names and indices in xam
2023-04-23 10:39:52 -04:00
chss95cs@gmail.com
ab21e1e0f0 Several changes for timestamp bundle:
Fully defined the structure.
Single copy of it + single timer across all modules, managing it is now the responsibility of KernelState.

add global_critical_region::PrepareToAcquire, which uses Prefetchw on the global crit. We now know we can use Prefetchw on all cpus that have AVX.
add  KeQueryInterruptTime, which is used by some dashboards.

add threading::NanoSleep
2023-04-16 10:08:01 -04:00
Gliniak
202ab76300 [Kernel] Changed default notification position 2023-03-08 10:59:08 +01:00
Gliniak
0ec65be5ff [UI] Notification & Custom Font Support 2023-03-08 09:36:49 +01:00
Gliniak
9f0d3d4c5b [Kernel] Simple support for loading achievement data 2022-12-25 16:11:59 +01:00
Gliniak
dde8adc140 Allow XamUserReadProfileSettings to use xuid to define profile 2022-05-22 13:11:29 +02:00
Gliniak
db50db3215 Merge remote-tracking branch 'GliniakRepo/TU_APPLY' into canary_experimental 2022-05-19 11:00:34 +02:00
Gliniak
c65f240c0b [Kernel] Improved TUs Support
- Changed name of config option to apply_title_update to better reflect what that option does
- Mount TU package to UPDATE: partition
- Simplified UserModule::title_id()
- Splitted loading module into two parts to allow applying TUs and custom patches
2022-05-06 08:04:47 +02:00
Gliniak
17b30be56a Added support for local multiplayer 2022-02-02 13:44:28 +01:00
Joel Linn
a86d7173e1 Refactor FourCC magic uses
- Use new fourcc_t type
- Improves compiler compatibility by removing multi chars
2021-06-02 22:28:43 -05:00
gibbed
f8e6ac4108 Defer XAM UI functions & other improvements.
- [Kernel] Fix global locking in kernel dispatch thread.
- [Kernel] Improve CompleteOverlappedDeferred/CompleteOverlappedDeferredEx.
- [XAM] Identify unknowns in XamNotifyCreateListener/XNotifyListener.
- [XAM] Defer XamShowMessageBoxUI.
- [XAM] Defer XamShowKeyboardUI.
- [XAM] Fix cancel handling in XamShowKeyboardUI.
- [XAM] Defer XamShowDeviceSelectorUI.
- [XAM] Defer XamShowDirtyDiscErrorUI.
2020-11-27 05:15:17 -06:00
gibbed
5bf0b34445 C++17ification.
C++17ification!

- Filesystem interaction now uses std::filesystem::path.
- Usage of const char*, std::string have been changed to
  std::string_view where appropriate.
- Usage of printf-style functions changed to use fmt.
2020-04-07 16:09:41 -05:00
Silent
38bf6c8822 [Kernel] Make XexUnloadImage fully release the image
Previously XexUnloadImage did not cleanup the image fully,
and if XexLoadImage was to be called again on the same module,
it was not initialized fully, leading to a crash when using it.
2020-01-27 06:35:10 -06:00
Jonathan Goyvaerts
c1af632562 Replace all gflag implementations with cvar implementations 2019-08-03 02:34:07 +02:00
gibbed
0d6bfc1a6b [Kernel] Rename NotifyListener to XNotifyListener to bring it in line with the naming scheme of kernel objects. 2019-07-29 13:43:13 -05:00
gibbed
4cc2aaf5b9 Remove unnecessary usage of xe::be. 2018-05-27 16:35:01 -05:00
Dr. Chat
a148b965f1 KernelState should handle module launching 2016-10-24 11:01:10 -05:00
Dr. Chat
eee0bb070c Store thread TLS in guest memory rather than using host APIs 2015-12-29 13:09:58 -08:00
Dr. Chat
bb5fd73b9e Register user-modules with the kernel in UserModule::Restore 2015-12-29 13:09:57 -08:00
Dr. Chat
f5237d486a KernelState::TerminateTitle - Release the global lock in smaller regions / No need for an argument specifying if called from guest 2015-12-29 13:09:51 -08:00
Dr. Chat
24f8295daa Make KernelState::TerminateTitle try to terminate XThreads safely. 2015-12-29 13:09:39 -08:00
Dr. Chat
712a5da64b KernelState::Save/Restore (and misc. changes) 2015-12-29 12:35:58 -08:00