Difference between revisions of "Super Mario 3D All-Stars"
Line 6: | Line 6: | ||
Each game uses different methods of emulation. | Each game uses different methods of emulation. | ||
+ | |||
+ | The pause-menu when pressing the '-' button in each game uses the Offline web-applet with [[Internet_Browser#WebSession|WebSession]]. | ||
+ | |||
+ | = NPDM = | ||
+ | This section documents the [[NPDM]] for the launcher and each game. | ||
+ | * Launcher: Roughly the same as most Switch games' NPDM. | ||
+ | * SuperMario64: Locked down since this uses [[JIT_services|JIT]]. Compared to the Launcher NPDM (besides ProgramId): | ||
+ | ** ProgramIdMin/ProgramIdMax is 010049900F546001-010049900F546001, with other NPDMs it's the normal full Application-range. | ||
+ | ** Access to [[SVC|svcMapPhysicalMemory]]/[[SVC|svcUnmapPhysicalMemory]] was removed, and access to [[SVC|svcCreateCodeMemory]] was added. | ||
+ | ** The only other difference is service-access-control: this was locked down, and only has the following services: [[Account_services|acc:u0]], [[NS_Services|aoc:u]], [[PPC_services#apm|apm]], [[Applet_Manager_services|appletOE]], [[Audio_services|audren:u]], [[Filesystem_services|fsp-srv]], [[HID_services|hid]], [[JIT_services|jit:u]], [[RO_services|ldr:ro]], [[Log_services|lm]], [[NV_services|nvdrv]], [[Parental_Control_services|pctl]], [[BCAT_services|prepo:u]], [[Settings_services|set]], [[PCV_services|time:u]], [[Display_services|vi:u]]. | ||
+ | ** Note that aoc:u, pctl, and lm are only accessible since sdknso automatically initializes these during startup, the main-codebin itself doesn't use these. | ||
+ | * SuperMarioSunshine: Same as Launcher (besides ProgramId), except [[NPDM#Flags|flag]] OptimizeMemoryAllocation is set. | ||
+ | * SuperMarioGalaxy: Same as Launcher (besides ProgramId), except [[NPDM#Flags|flags]] is 0x4: Is64BitInstruction=0(AArch32) and ProcessAddressSpace=0x2. | ||
= SuperMario64 = | = SuperMario64 = |
Revision as of 19:26, 3 October 2020
This page documents the Super Mario 3D All-Stars (SM3DAS) game.
The initial menu is the Stardust launcher, which has the base ProgramId 010049900F546000. Each game launched from here has a different ProgramIndex, therefore each ProgramId differs: 0x1 (010049900F546001) SuperMario64, 0x2 (010049900F546002) SuperMarioSunshine, 0x3 (010049900F546003) SuperMarioGalaxy.
The launcher launches each game by using ExecuteProgram with ProgramIndex={above values}, with 0x10-byte parameter-data: {+0x0 = LanguageCode selected in the launcher for this game, +0x8/+0xC = floats loaded from a fixed-data array specific for each game, which games can use with SetAudioDeviceOutputVolume}. Each game returns to the launcher by using ExecuteProgram with ProgramIndex=0, no parameter-data is passed to the launcher.
Each game uses different methods of emulation.
The pause-menu when pressing the '-' button in each game uses the Offline web-applet with WebSession.
NPDM
This section documents the NPDM for the launcher and each game.
- Launcher: Roughly the same as most Switch games' NPDM.
- SuperMario64: Locked down since this uses JIT. Compared to the Launcher NPDM (besides ProgramId):
- ProgramIdMin/ProgramIdMax is 010049900F546001-010049900F546001, with other NPDMs it's the normal full Application-range.
- Access to svcMapPhysicalMemory/svcUnmapPhysicalMemory was removed, and access to svcCreateCodeMemory was added.
- The only other difference is service-access-control: this was locked down, and only has the following services: acc:u0, aoc:u, apm, appletOE, audren:u, fsp-srv, hid, jit:u, ldr:ro, lm, nvdrv, pctl, prepo:u, set, time:u, vi:u.
- Note that aoc:u, pctl, and lm are only accessible since sdknso automatically initializes these during startup, the main-codebin itself doesn't use these.
- SuperMarioSunshine: Same as Launcher (besides ProgramId), except flag OptimizeMemoryAllocation is set.
- SuperMarioGalaxy: Same as Launcher (besides ProgramId), except flags is 0x4: Is64BitInstruction=0(AArch32) and ProcessAddressSpace=0x2.
SuperMario64
This is a Nintendo 64 emulator. This uses JIT for running the emulated executable. RomFs also contains an AOT NRO, but it's unused.
The ROMIMAGE .bin in RomFs is identical to the Shindou region N64 ROM. Patches are applied at runtime with the config/lua files.
The LanguageCode is loaded from the launch-parameter passed by the launcher, if not available it will fallback to the output from GetDesiredLanguage. This is used to select the <language> to load from RomFs "/Message/", the data from there is then used for patching the ROM. Note that the .lua file runs n64InitMessageData();
from the GameBegin() function.
RomFs contains the following:
- "/Pipeline.cache", "/shader_p1_frag.spv", "/shader_p1_vert.spv", "/shader_vulkan_frag.spv", "/shader_vulkan_vert.spv"
- "/Message/<language>/" contains:
- "Messages.bin", "UI_Font8.bin", "UI_Font16.bin", "UI_Font16_code2.bin", "UI_FontS88.bin".
- "/.nrr/" contains:
- "/nro/" contains:
- "EmuSystemJITPlugin.nro": The NRO for the JitPlugin.
- "NROBuilder.nro": Unused AOT NRO.
- "05_UNSMJ3.002.nro": Same as "NROBuilder.nro".
- "/rom/": This contains the ROM sub-directory, in this case that dir-name is "Stardust_JP" which contains the following:
- "Textures/texture_pack.cpio": Standard (?) .cpio archive containing textures.
- "00_UNSMJ3.002.meta": Contains json metadata for the other files in this directory, etc.
- "01_UNSMJ3.002.bin": This is the ROMIMAGE.
- "02_UNSMJ3.002.cfg": Configuration json file, ROMCONFIG.
- "03_UNSMJ3.002.pcb": This is the "PRECMP" file referenced by the .meta.
- "04_UNSMJ3.002.nrr": Unused NRR which is the same as "/.nrr/04_UNSMJ3.002.nrr", except the Certification and ApplicationId are all-zero.
- "05_UNSMJ3.002.nro": Unused, identical to "/nro/05_UNSMJ3.002.nro".
- "06_UNSMJ3.002.lua": This is the "ROMPATCH" Lua file referenced by the .meta.
- "07_UNSMJ3.002.ppl": This is the "PIPELINE" file referenced by the .meta.
SuperMarioSunshine
This is a Nintendo Gamecube emulator. The emulator (which is the main-codebin) name is "Hagi". This uses an AOT NRO for running the emulated executable.
This emulator supports arguments with argc/argv, when launched officially zero arguments are passed for this (unless SetProgramArgument is used manually prior to launching). The emulator will also load arguments from RomFs "/default_cmd.txt" when argc==1, otherwise it loads arguments from a filepath loaded elsewhere. Hence, when not launched with arguments with an official launch, "/default_cmd.txt" is not used. Some of the supported arguments are:
- "--card-uncompressed": See #Savedata.
- ...
SuperMarioGalaxy
Savedata
The savedata contains the following:
- "/PlayReport/account.prsav"
- "/StardustLauncher/game_data.sav"
- "/Mario64/Mario64.sav": The raw N64 savedata.
- "/MarioSunshine/": This contains the following data, for MarioSunshine:
- "gekko/log/", "gekko/trace/", and "hanafuda/": Empty directories.
- "A.sav": The memory card image. The first 4-bytes are the big-endian decompressed size, followed by the LZ4 compressed data.
- "B.raw": Uncompressed raw version of the memory card image. All-zeros, since it doesn't seem to be used after creation? This normally doesn't exist: this only exists if the application had argv parameter "--card-uncompressed" passed.
- "B1317A6632265CF763766CF6339AC8D1.cache": This is probably graphics pipeline related?(RomFs has an identical file)
- "/MarioGalaxy/GameData.bin": The savedata for SuperMarioGalaxy.