Skip to content

emulate suspend and close (and save the game progress) without home menu #1128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

john-peterson
Copy link

@john-peterson john-peterson commented Jun 8, 2025

apps get a smooth start but a rough end akin to pulling the plug. there is no graceful exit. luckily most games save occasionally during gameplay but not all

I found a game that only save on exit called shifting worlds by Anthony Lavelle . despite a message about in game saves he never implement it. I almost solved it but need some help with the last step

0xc trigger the save but only when suspended by the home menu. no combination of signals works with out the home menu so far so it's time to ask you for help

build everything and test

run my sig branch john-peterson/azahar@sig from the terminal it listens to getchar

get home menu and shifting worlds product code CTR-N-HMMP and CTR-P-ASZP

cmake -B out -DCMAKE_BUILD_TYPE=Debug  -DENABLE_QT_TRANSLATION=OFF -DENABLE_ROOM=OFF -DUSE_DISCORD_PRESENCE=OFF -DENABLE_QT=OFF -DENABLE_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_SCRIPTING=OFF -DENABLE_CUBEB=OFF -DENABLE_LIBUSB=OFF -DENABLE_OPENGL=OFF -DENABLE_VULKAN=ON -DENABLE_SDL2_FRONTEND=ON -DUSE_SYSTEM_SDL2=ON -DUSE_SYSTEM_BOOST=ON
make -j8 -C out && out/bin/Release/azahar -n home.app

remove all other games

press a when the music start to launch the game

press b when you see the save file shift_3ds.bin and the game music start

press C to simulate close or z to let the home menu close

you should observe this game logic from start to finish

signal 1
music start read save file
fs_user/savedata_archive

b home button
SaveData.dat Service.FS OpenFile

press c in test build
order to close id=101 pos=2
sending C from 101 to 300
signal
glance id=300
SendDeliverArg
 ReceiveParameter from 101 to 300

*** saving *** <- the goal is to reach this function

 prepare to close target=2
sending A from 101 to 300

this is the best log filter to show save file access and the app manager

log_filter = *:Critical Service:Trace Service.APT:Trace Service.SRV:Trace Service.FS:Trace Common.Filesystem:Trace

test app

instead of the game you can use my signal demo john-peterson/3ds-examples@sig

git remote add jsp https://github.com/john-peterson/3ds-examples
git fetch jsp sig

I essentially get the events 0xc and 0x10 but I want all events and more complete example

tail -f ~/.local/share/azahar-emu/sdmc/log
_aptDebug(2,c)
_aptDebug(22,0)

this is from libctru

APTCMD_WAKEUP_CANCEL      = 12, ///< Applet wakes up due to being cancelled.
APTCMD_SYSAPPLET_REQUEST  = 16, ///< Request for sysapplet (?).

message me on Google chat if you are interested in this and made some progress

other projects restore fast file access in android

I am also going to restore the normal Linux file access in android with

  <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
it is ten times faster than android file access. it is so slow it reminds me of my 24 meg Pentium 90 from 1995. loading a save in Zelda takes over a minute.  it should take ten seconds

@john-peterson john-peterson changed the title sig emulate suspend and close (and save the game progress) without home menu Jun 8, 2025
@PabloMK7 PabloMK7 self-assigned this Jun 8, 2025
apps get a smooth start but a rough end akin to pulling the plug. there is no graceful exit. luckily most games save occasionally during gameplay but not all

I found a game that only save on exit called shifting worlds by Anthony Lavelle . despite a message about in game saves he never implement it. I almost solved it but need some help with the last step

0xc trigger the save but only when suspended by the home menu. no combination of signals works with out the home menu so far so it's time to ask you for help

 # build everything and test

run my sig branch john-peterson/azahar@sig from the terminal it listens to getchar

get home menu and shifting worlds product code CTR-N-HMMP and CTR-P-ASZP

~~~
cmake -B out -DCMAKE_BUILD_TYPE=Debug  -DENABLE_QT_TRANSLATION=OFF -DENABLE_ROOM=OFF -DUSE_DISCORD_PRESENCE=OFF -DENABLE_QT=OFF -DENABLE_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_SCRIPTING=OFF -DENABLE_CUBEB=OFF -DENABLE_LIBUSB=OFF -DENABLE_OPENGL=OFF -DENABLE_VULKAN=ON -DENABLE_SDL2_FRONTEND=ON -DUSE_SYSTEM_SDL2=ON -DUSE_SYSTEM_BOOST=ON
make -j8 -C out && out/bin/Release/azahar -n home.app
~~~

remove all other games

press a when the music start to launch the game

press b when you see the save file shift_3ds.bin and the game music start

press C to simulate close or z to let the home menu close

you should observe this game logic from start to finish

~~~
signal 1
music start read save file
fs_user/savedata_archive

b home button
SaveData.dat Service.FS OpenFile

press c in test build
order to close id=101 pos=2
sending C from 101 to 300
signal
glance id=300
SendDeliverArg
 ReceiveParameter from 101 to 300

*** saving *** <- the goal is to reach this function

 prepare to close target=2
sending A from 101 to 300
~~~

this is the best log filter to show save file access and the app manager

~~~
log_filter = *:Critical Service:Trace Service.APT:Trace Service.SRV:Trace Service.FS:Trace Common.Filesystem:Trace
~~~

 # test app

instead of the game you can use my signal demo john-peterson/3ds-examples@sig

~~~
git remote add jsp https://github.com/john-peterson/3ds-examples
git fetch jsp sig
~~~

I essentially get the events 0xc and 0x10 but I want all events and more complete example

~~~
tail -f ~/.local/share/azahar-emu/sdmc/log
_aptDebug(2,c)
_aptDebug(22,0)
~~~

this is from libctru

~~~
APTCMD_WAKEUP_CANCEL      = 12, ///< Applet wakes up due to being cancelled.
APTCMD_SYSAPPLET_REQUEST  = 16, ///< Request for sysapplet (?).
~~~

message me on Google chat if you are interested in this and made some progress

  # other projects  restore fast file access in android

  I am also going to restore the normal Linux file access in android with

  ~~~
	<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
  ~~~

	it is ten times faster than android file access. it is so slow it reminds me of my 24 meg Pentium 90 from 1995. loading a save in Zelda takes over a minute.  it should take ten seconds
@OpenSauce04 OpenSauce04 added squash This pull request should be squashed if approved enhancement New feature or request labels Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/L squash This pull request should be squashed if approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants