<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://switchbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Torphedo</id>
	<title>Nintendo Switch Brew - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://switchbrew.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Torphedo"/>
	<link rel="alternate" type="text/html" href="https://switchbrew.org/wiki/Special:Contributions/Torphedo"/>
	<updated>2026-05-05T13:07:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=PGL_services&amp;diff=12818</id>
		<title>PGL services</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=PGL_services&amp;diff=12818"/>
		<updated>2024-06-11T13:21:01Z</updated>

		<summary type="html">&lt;p&gt;Torphedo: Add to Services category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;PGL (Program Launcher) is a sysmodule designed for encapsulating all program launching / management logic.&lt;br /&gt;
&lt;br /&gt;
The core logic of this sysmodule was previously encapsulated by the ns:dev interface (and the nn.nssrv.ProcessLaunchControlTask thread in particular).&lt;br /&gt;
&lt;br /&gt;
= pgl =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#LaunchProgram]]&lt;br /&gt;
|-&lt;br /&gt;
| 1 || [[#TerminateProcess]]&lt;br /&gt;
|-&lt;br /&gt;
| 2 || [[#LaunchProgramFromHost]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 || [[#GetHostContentMetaInfo]]&lt;br /&gt;
|-&lt;br /&gt;
| 5 || [[#GetApplicationProcessId]]&lt;br /&gt;
|-&lt;br /&gt;
| 6 || [[#BoostSystemMemoryResourceLimit]]&lt;br /&gt;
|-&lt;br /&gt;
| 7 || [[#IsProcessTracked]]&lt;br /&gt;
|-&lt;br /&gt;
| 8 || [[#EnableApplicationCrashReport]]&lt;br /&gt;
|-&lt;br /&gt;
| 9 || [[#IsApplicationCrashReportEnabled]]&lt;br /&gt;
|-&lt;br /&gt;
| 10 || [[#EnableApplicationAllThreadDumpOnCrash]]&lt;br /&gt;
|-&lt;br /&gt;
| 12 || [[#TriggerSnapShotDumper]]&lt;br /&gt;
|-&lt;br /&gt;
| 20 || [[#GetShellEventObserver]]&lt;br /&gt;
|-&lt;br /&gt;
| 21 || [11.0.0-11.0.1]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LaunchProgram ==&lt;br /&gt;
Takes a [[NCM_services#ProgramLocation|ProgramLocation]], a u32 [[Process_Manager_services#LaunchFlags]] pm launch_flags, and a u8 [[#LaunchFlags|LaunchFlags]] pgl launch_flags.&lt;br /&gt;
&lt;br /&gt;
This calls pm:shell-&amp;gt;LaunchProgram with the program location and the input launch flags. If jit_debug!enable_jit_debug is true, LaunchFlags_SignalOnCrash is ORRd into the flags sent to PM.&lt;br /&gt;
&lt;br /&gt;
This then creates a new process tracking structure for the new process id and with the pgl launch flags. If an empty process struct is not allocated from the 0x20 slab heap, pgl aborts.&lt;br /&gt;
&lt;br /&gt;
If settings::GetDebugModeFlag() returns 1, then LaunchFlags_EnableCrashReportScreenShotForDevelop is used to enable crash report screenshot, otherwise LaunchFlags_EnableCrashReportScreenShotForProduction is used.&lt;br /&gt;
&lt;br /&gt;
It returns a u64 process id.&lt;br /&gt;
&lt;br /&gt;
== TerminateProcess ==&lt;br /&gt;
This just calls pm:shell-&amp;gt;TerminateProcess with the input process id.&lt;br /&gt;
&lt;br /&gt;
== GetShellEventObserver ==&lt;br /&gt;
No input. Returns an [[#IEventObserver]].&lt;br /&gt;
&lt;br /&gt;
== LaunchProgramFromHost ==&lt;br /&gt;
This takes an input u32 [[Process_Manager_services#LaunchFlags]] pm launch_flags and a MapAlias input buffer &amp;quot;content path&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The content path must be to an &amp;quot;.nsp&amp;quot; file or a &amp;quot;.nspd&amp;quot; folder. &amp;quot;*.nspd/program0.ncd/&amp;quot; is also allowed.&lt;br /&gt;
&lt;br /&gt;
This calls fs::MountApplicationPackage on the input content path, and reads content meta from &amp;quot;meta0.ncd&amp;quot; or &amp;quot;.cnmt.nca&amp;quot; extension folder/file depending on whether it is a .nspd or .nsp content path.&lt;br /&gt;
&lt;br /&gt;
A location resolver for the Host storage is opened, and EraseProgramRedirection is called for the parsed program id.&lt;br /&gt;
&lt;br /&gt;
RedierectProgramPath is then called for the program ID to set it to the input content path.&lt;br /&gt;
&lt;br /&gt;
This then calls the implementation function for [[#LaunchProgram]] with the input pm launch flags and pgl launch flags = 0.&lt;br /&gt;
&lt;br /&gt;
== GetHostContentMetaInfo ==&lt;br /&gt;
This takes an input MapAlias buffer &amp;quot;content path&amp;quot;, and does the same parsing as [[#LaunchProgramFromHost]].&lt;br /&gt;
&lt;br /&gt;
Instead of launching the program, it instead returns an 0x10 output [[#ContentMetaInfo]] from the parsed info.&lt;br /&gt;
&lt;br /&gt;
== GetApplicationProcessId ==&lt;br /&gt;
This calls pm:shell-&amp;gt;GetApplicationProcessIdForShell, and returns the output process id.&lt;br /&gt;
&lt;br /&gt;
Error 0x6E4 is returned when there is no application process.&lt;br /&gt;
&lt;br /&gt;
== BoostSystemMemoryResourceLimit ==&lt;br /&gt;
This takes in a u64 mem_size, and uses it as input to pm:shell-&amp;gt;BoostSystemMemoryResourceLimit&lt;br /&gt;
&lt;br /&gt;
== EnableApplicationCrashReport ==&lt;br /&gt;
Takes an input boolean &amp;quot;enable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This calls pm:shell-&amp;gt;GetApplicationProcessId. If the returned process ID is tracked, this sets or clears bit 1 (value 0x2) in the tracked process&#039;s flags.&lt;br /&gt;
&lt;br /&gt;
When a process crash event occurs and pgl launches crash report, the second argument is &amp;quot;%d&amp;quot; formatted with the bitwise AND of this bit and bit 0 (value 0x1).&lt;br /&gt;
&lt;br /&gt;
LaunchFlags_EnableDetailedCrashReport causes the process to have both of these flags set, otherwise they are both zero.&lt;br /&gt;
&lt;br /&gt;
Thus this command is only useful for disabling/toggling detailed crash reports for applications launched with LaunchFlags_EnableDetailedCrashReport, as processes without the launch flag will always send &amp;quot;0&amp;quot; for the creport argument.&lt;br /&gt;
&lt;br /&gt;
== IsApplicationCrashReportEnabled ==&lt;br /&gt;
This returns the value of the bit set or cleared by [[#EnableApplicationCrashReport]]&lt;br /&gt;
&lt;br /&gt;
== EnableApplicationAllThreadDumpOnCrash ==&lt;br /&gt;
Takes an input boolean &amp;quot;enable&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This calls pm:shell-&amp;gt;GetApplicationProcessId. If the returned process ID is tracked, this sets or clears bit 3 (value 0x8) in the tracked process&#039;s flags.&lt;br /&gt;
&lt;br /&gt;
Using this command unconditionally sets bit 2 (value 0x4) in the tracked process&#039;s flags.&lt;br /&gt;
&lt;br /&gt;
When the SnapShotDumper is launched, argument &amp;quot;-log %d&amp;quot; is set to the value of bit 3 if bit 2 is 1. Otherwise, argument &amp;quot;-log %d&amp;quot; is set to the value of the system setting &amp;quot;snap_shot_dump!output_all_log&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Thus, this overrides the log option for the current application process from snap_shot_dump!output_all_log with the input value.&lt;br /&gt;
&lt;br /&gt;
Previously this functionality was controlled by ns:am2-&amp;gt;EnableApplicationAllThreadDumpOnCrash, which is now a wrapper for this function.&lt;br /&gt;
&lt;br /&gt;
== TriggerSnapShotDumper ==&lt;br /&gt;
This takes an input 32 &amp;quot;SnapShotDumpType&amp;quot; and an input MapAliasBuffer &amp;quot;argument&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This manually invokes the same function to launch the SnapShotDumper program (0100000000002071) as is called automatically when a process crashes and jit_debug!enable_jit_debug is 1.&lt;br /&gt;
&lt;br /&gt;
If the argument is NULL, then the snap shot dumper is launched with argument Format(&amp;quot;D %010llu -log %d -dump %d&amp;quot;, process_id, log_option, snap_shot_dump_type - 1).&lt;br /&gt;
If the argument is not NULL, the snap shot dumper is launched with argument Format(&amp;quot;D %010llu \&amp;quot;%s\&amp;quot; -log %d -dump %d&amp;quot;, process_id, argument, log_option, snap_shot_dump_type - 1).&lt;br /&gt;
&lt;br /&gt;
When invoked automatically, the SnapShotDumpType is SnapShotDumpType_Full if both &amp;quot;snap_shot_dump!full_dump&amp;quot; and &amp;quot;snap_shot_dump!auto_dump&amp;quot; are true, SnapShotDumpType_Auto if only &amp;quot;snap_shot_dump!auto_dump&amp;quot; is 1, and SnapShotDumpType_None otherwise.&lt;br /&gt;
&lt;br /&gt;
== IEventObserver ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Cmd || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || [[#GetProcessEventHandle]]&lt;br /&gt;
|-&lt;br /&gt;
| 1 || [[#GetProcessEventInfo]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== GetProcessEventHandle ==&lt;br /&gt;
This takes no input and returns an output copy event handle.&lt;br /&gt;
&lt;br /&gt;
== GetProcessEventInfo ==&lt;br /&gt;
This takes no input and attempts to receive a [[Process_Manager_services#ProcessEventInfo]] from the observer&#039;s message queue.&lt;br /&gt;
&lt;br /&gt;
Every time a process event occurs, pgl receives the event from PM (it does pm:shell-&amp;gt;GetProcessEventHandle() during startup and has a thread looping pm:shell-&amp;gt;GetProcessEventInfo() to track process events.&lt;br /&gt;
&lt;br /&gt;
PGL sends to all observers&#039; message queues a [[Process_Manager_services#ProcessEventInfo]] for each event it receives, thus allowing for multiple subscribers to process events.&lt;br /&gt;
&lt;br /&gt;
= LaunchFlags =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Bit || Mask || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || EnableDetailedCrashReport&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 2 || EnableCrashReportScreenShotForProduction&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 4 || EnableCrashReportScreenShotForDevelop&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= SnapShotDumpType =&lt;br /&gt;
{| class=wikitable&lt;br /&gt;
! Value || Name&lt;br /&gt;
|-&lt;br /&gt;
| 0 || None&lt;br /&gt;
|-&lt;br /&gt;
| 1 || Auto&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Full&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= ContentMetaInfo =&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Offset&lt;br /&gt;
! Size&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0x0 &lt;br /&gt;
| 0x8 &lt;br /&gt;
| [[NCM_services#ProgramId|ProgramId]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x8 &lt;br /&gt;
| 0x4 &lt;br /&gt;
| Version&lt;br /&gt;
|-&lt;br /&gt;
| 0xC &lt;br /&gt;
| 0x1 &lt;br /&gt;
| ContentType&lt;br /&gt;
|-&lt;br /&gt;
| 0xD &lt;br /&gt;
| 0x1 &lt;br /&gt;
| ID Offset&lt;br /&gt;
|-&lt;br /&gt;
| 0xE &lt;br /&gt;
| 0x2 &lt;br /&gt;
| Padding&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Services]]&lt;/div&gt;</summary>
		<author><name>Torphedo</name></author>
	</entry>
	<entry>
		<id>https://switchbrew.org/w/index.php?title=Tegra_X1&amp;diff=12652</id>
		<title>Tegra X1</title>
		<link rel="alternate" type="text/html" href="https://switchbrew.org/w/index.php?title=Tegra_X1&amp;diff=12652"/>
		<updated>2024-03-05T23:01:19Z</updated>

		<summary type="html">&lt;p&gt;Torphedo: The google drive link denies access. This was surprisingly annoying to track down&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NVIDIA Tegra X1 SoC Specifications&lt;br /&gt;
&lt;br /&gt;
CPU&lt;br /&gt;
* Quad 64-bit A57 cores + Quad 64-bit A53 cores&lt;br /&gt;
&lt;br /&gt;
Cache&lt;br /&gt;
* Cortex A57 cluster: 2 MB Shared L2 Cache, 48KB /32KB (I/D) L1 Cache per core&lt;br /&gt;
* Cortex A53 cluster: 512KB shared L2 Cache, 32KB/32KB (I/D) L1 Cache per core&lt;br /&gt;
&lt;br /&gt;
Memory Frequency&lt;br /&gt;
* LPDDR3, LPDDR4-1600, 64-bit (25.6 GB/s)&lt;br /&gt;
&lt;br /&gt;
Memory Size &lt;br /&gt;
* Up to 4 GB&lt;br /&gt;
&lt;br /&gt;
GPU&lt;br /&gt;
* Cores 256-core Maxwell GPU with support for FP16&lt;br /&gt;
* API Support OpenGL ES 3.1, OpenGL4.5, DirectX 12.0, AEP, CUDA 6.0&lt;br /&gt;
&lt;br /&gt;
Video&lt;br /&gt;
* Decode VP9, H.265, H.264 4K 60 fps; H.265 4K 60fps 10-bit color; VP8 1080p 60fps;&lt;br /&gt;
* Encode H.264, H.265 4K 30 fps; VP8 1080p 60 fps;&lt;br /&gt;
&lt;br /&gt;
Imaging&lt;br /&gt;
* Image Processing Dual ISP, 1.3 GigaPixels/s, 4096 focus points, 100 MP Sensor support, up to 6 camera inputs&lt;br /&gt;
* JPEG Decode/Encode 600 MPixels/s&lt;br /&gt;
&lt;br /&gt;
Display&lt;br /&gt;
* Display Controllers 2 Simultaneous&lt;br /&gt;
* HDMI HDMI 2.0, HDCP 2.2, 4K 60 fps&lt;br /&gt;
* Local Display 4K 60 fps VESA DSC compression&lt;br /&gt;
&lt;br /&gt;
Storage&lt;br /&gt;
* Storage interface e-MMC 5.1 (HS533), CMD Queuing&lt;br /&gt;
&lt;br /&gt;
Tegra X1 TRM datasheet&lt;br /&gt;
* https://developer.nvidia.com/embedded/downloads#?search=X1 (2977 pages, requires free Nvidia developer account)&lt;br /&gt;
* https://drive.google.com/file/d/0B5cebp2-yLm5YURqeFROb2hwOUk/view&lt;/div&gt;</summary>
		<author><name>Torphedo</name></author>
	</entry>
</feed>