Commit Graph

88 Commits

Author SHA1 Message Date
Gleb Mazovetskiy
499ac0e47a Do not expose public macros with common names
The prevents compatibility issues with other libraries, such as the one seen in #530

Fixes #530
2023-09-11 09:29:08 +01:00
TuxSH
b18f04d887 apt: add deliver arg support to chainloader + minor fixes 2023-02-25 20:39:04 +00:00
TuxSH
08b76e2e17 apt: fix dirty homebrew chainload
Fix chainload method used when HM is not launched.

We now wait for custom PM to change our launch flag and ask us to
terminate. We previously had a few issues:
- a potential race condition where we exit before PM changes our
  runflags (not observed)
- a kernel deadlock between ExitProcess and TerminateProcess (observed,
  this is due to Nintendo's lack of barrier in many of their atomics
  code)
- debuggers reporting that we were terminated, instead of exiting
  gracefully (not desirable)
2023-01-09 23:58:32 +00:00
fincs
b93e7f19bf
Refactor DSP<->APT interaction, see details:
- DSP wrapper is now in charge of handling sleep/awake/cancel events
  - Added DSP hook mechanism (similar to APT hook)
  - The DSP component now gets automatically unloaded/reloaded as needed
- NDSP now uses DSP hook instead of APT hook to manage lifetime
  - Moved sleep/wakeup component management logic into NDSP
- APT now calls into DSP wrapper in order to arbitrate access to the DSP
  - Launching libapplets no longer relinquishes DSP rights - this means
    music can now be played in the background during libapplet activity
2020-06-22 00:34:38 +02:00
fincs
528f8feb0b
Add gspGetBytesPerPixel (replaces internal function)
Also fixes GSPGPU_FramebufferFormat's name
2020-06-12 19:24:15 +02:00
fincs
ea57fb8821
apt: Revamp chainload handling, see details:
- Added aptClearChainloader (clears pending chainloads)
- Added aptSetChainloaderToSelf (reboots to self, i.e. "soft-reset")
- Internal refactoring
2020-06-11 16:28:57 +02:00
fincs
5986713066
apt: Refactor sleep/home state handling to be more intuitive, see details:
- Added functions for checking APT state:
  - aptIsActive
  - aptShouldClose
  - aptShouldJumpToHome
  - aptCheckHomePressRejected (replaces aptIsHomePressed)
- Added functions for handling incoming requests:
  - aptHandleSleep
  - aptHandleJumpToHome
- Added aptJumpToHomeMenu (callable anytime) because why not
- aptMainLoop is now aptHandleSleep/JumpToHome + return !aptShouldClose
- APTHOOK_ONEXIT is now called during aptExit
- Internal refactoring
2020-06-11 03:02:24 +02:00
fincs
b48b5da211
apt: Add APT_LockTransition, use it in aptWaitForWakeUp 2020-06-10 21:46:48 +02:00
fincs
6ce690828c
apt: Remove aptLaunchLibraryApplet's return value/hidden aptMainLoop call 2020-06-10 20:14:01 +02:00
fincs
ac8656f8b2
apt: Implement screen capture for libapplet transitions (+ related cleanup) 2020-06-10 19:47:17 +02:00
fincs
7171a87d53
Miscellaneous APT fixes and cleanup, see details:
- APT parameter handling now follows official sw a bit more closely
  (with the APT thread acting as a filter which then relays the
   status to the main thread using a LightEvent)
- RUNFLAG_APTREINIT (hax 2.x) handling code has been simplified and
  made (hopefully) more robust
- Fixed sleep handling when the app is inactive (i.e. app is suspended)
- APT debug callback now guarded by an #ifdef (LIBCTRU_APT_DEBUG)
- Removed old Citra response cmdheader workaround
- Other miscellaneous fixes I probably forgot to talk about
2020-06-10 02:08:01 +02:00
fincs
59b8fd8283
apt: Simplify event thread exit handling code 2020-06-09 18:01:11 +02:00
TuxSH
e3be4b8678 Add sleep state FSM handling service commands 2020-05-17 17:45:52 +02:00
TuxSH
9d27eb80de APT workaround when Home Menu is not launched, etc. 2020-05-10 00:06:50 +02:00
Oreo639
59b71196ac Fix blocking and add aptIsHomePressed 2019-04-25 02:52:00 +02:00
Alex Taber
f919af3182 Rename home_allowed to aptHomeAllowed 2019-04-25 02:52:00 +02:00
LiquidFenrir
9b4ac1118d Allow blocking HOME button
Signed-off-by: Alex Taber <alexftaber@gmail.com>
2019-04-25 02:52:00 +02:00
TuxSH
0ed1f2beb2 IPC_Desc_CurProcessHandle => IPC_Desc_CurProcessId 2019-03-28 00:44:32 +01:00
fincs
1ed97e8ba2 Implement RUNFLAG_APTCHAINLOAD 2017-04-14 22:01:13 +02:00
Jeffrey Pfau
635d3e6640 Add APT:ReceiveDeliverArg 2016-12-29 19:28:59 +01:00
Dave Murphy
3501efd7e5 whitespace fixes 2016-12-04 17:21:44 +00:00
Matthias Lutter
5e568d78b1 Fixed home menu display of suspended 2D mode app 2016-10-26 15:45:24 +02:00
Lectem
c741d7d5cc fix incorrect values for bool outputs in services 2016-07-28 00:40:50 +02:00
fincs
ae6be1cf97 Minor fix in APT_CheckNew3DS_System 2016-07-27 19:06:16 +02:00
fincs
24b9341c99 Fix lingering parameter bug with APTREINIT (aka hax 2.x) 2016-07-18 00:26:52 +02:00
fincs
15e24d19a5 Major APT rewrite, see details:
- Internal logic changes in order to follow official behavior
  more closely - the APT state machine has been removed.
- The following functions were removed:
  * aptSetStatus/aptGetStatus along with the APT_AppStatus enum
  * aptGetStatusPower/aptSetStatusPower
  * aptReturnToMenu
  * aptWaitStatusEvent, aptSignalReadyForSleep
- Library applet launching is now fully supported on both official
  environments (ncch/cia) and homebrew environments (3dsx).
  APT_LaunchLibraryApplet has been replaced with aptLaunchLibraryApplet.
- Added aptSetMessageCallback (intended for use with libapplet code)
- Added APT_CancelParameter
- Some other misc changes
2016-07-02 00:57:06 +02:00
fincs
14cdb5a9d3 Begin refactoring APT code, many changes to make code a bit more manageable 2016-06-11 19:48:05 +02:00
fincs
56a11197c7 () -> (void) 2016-06-10 18:14:30 +02:00
Steven Smith
c81239a407 Allow toggling sleep mode. 2016-05-08 12:45:18 -07:00
fincs
8b5e753235 Add shared system font parsing code. 2016-01-19 19:23:58 +01:00
Lectem
e05f841a58 fix thread static buffers usage (save+restore) 2016-01-10 13:41:28 -05:00
fincs
12555d77a4 Revise APT/GSP/NDSP to use the new thread API 2015-12-07 11:44:36 +01:00
Steven Smith
13a5a225b3 Reference count srv, cleanup launcher code. 2015-11-15 13:02:06 -08:00
Steven Smith
375fbce98a Service cleanup. 2015-11-11 08:57:54 -08:00
fincs
24a84a874f Fix some mistakes in 2797540a 2015-11-07 01:52:35 +01:00
fincs
2797540a3d Revise most services to follow these guidelines:
- Each service must have xyzInit/xyzExit (with that name)
- xyzInit/xyzExit use reference counting
- xyzExit returns void
- The utilities in <3ds/result.h> are used instead of manual error checking
- The intrinsics in <3ds/synchronization.h> are used instead of inline asm
- Other miscellaneous changes
  - APT now uses a lightweight lock instead of a mutex
  - Initial handle parameters in PTMU were killed
  - Explicit init'ion to 0 or NULL has been removed for global variables
    since they end up on .bss anyway
  - MIC hasn't been touched because it must be rewritten first
  - CFGNOR needs a slight touch before converting
  - SOC is still to be cleaned up
2015-11-07 01:25:31 +01:00
fincs
6bdfa1a005 aptInit(): Wait for APT_RUNNING (solves certain timing problems) 2015-10-26 21:19:00 +01:00
fincs
a35abcb901 APT: fix status event issue that breaks things under certain circumstances 2015-10-24 13:48:15 +02:00
fincs
942ec4af9b Add code to manage New 3DS CPU speedup 2015-10-11 23:44:10 +02:00
Lectem
bc3ef580b2 Use IPC helpers for apt, and update some commands 2015-10-03 06:56:11 -04:00
fincs
8912773f21 Merge branch 'master' into great-refactor
Conflicts:
	libctru/include/3ds/services/apt.h
	libctru/include/3ds/services/fs.h
	libctru/source/services/apt.c
2015-10-03 12:39:09 +02:00
suloku
b6817008ac Update apt.c 2015-10-01 19:01:31 +02:00
suloku
76e3cb0721 Implement APT_GetProgramID 2015-10-01 17:19:13 +02:00
fincs
4603b972fa Merge branch 'master' into great-refactor
Conflicts:
	libctru/include/3ds/services/apt.h
	libctru/source/services/apt.c
2015-09-29 23:21:45 +02:00
megazig
27b5a49c59 implement APT_GetAppletInfo 2015-09-27 23:30:16 -05:00
fincs
649e95cd39 Merge branch 'master' into great-refactor
Conflicts:
	libctru/include/3ds/services/apt.h
	libctru/source/services/apt.c
2015-09-25 16:16:10 +02:00
yellows8
31b724a431 Added APT_GetAppletProgramInfo. 2015-09-24 04:26:48 -04:00
fincs
1817f90c6d Remove service handle parameter from GSPGPU IPC wrappers 2015-09-06 18:04:03 +02:00
fincs
9b1e6bfc39 Remove service handle parameter from APT IPC wrappers 2015-09-06 17:41:47 +02:00
fincs
68fbd06375 Do not signal APTHOOK_ONRESTORE when the app is being closed 2015-06-28 11:30:57 +02:00