# DRAGON QUEST VII Reimagined: Square Enix / HEXA DRIVE, Unreal Engine 4.27 (IoStore containers beside one pak, PhysX 3.4, MallocBinned3), SDK 19.3.1, NVN, CRIWARE sound and Sofdec movies
# (VP9 through the SDK's movie decoder); update 1.2.0 (v131072).
# Started from the NSP script's provisional profile (dm/games/profile_guess.py) and brought up on the Mac (docs/agents)
# Format: see dm/games/README.md

# ---- Identity ----
title_id	0100A9D01C446000
program_id	0100A9D01C446000

# ---- App ----
# Game name: only a label for profile listings and the Mac window title; the iOS app name is the game name in the base NSP, and the bundle ID comes from the base game title ID (build_ipa.sh / NSP script)
name	DRAGON QUEST VII Reimagined
ipa	DragonQuestViiReimagined.ipa
app_category	public.app-category.games

# ---- Versions ----
build	v131072	1.2.0	main=f7ec03e4cb9de3bd8319d4e899d2e9cc	subsdk0=92ef43cb1f9917ab206ac5c9e36240bc	sdk=145dde94fb574acc9e09780a11995bd3
package	v131072
shader_versions	v131072

# ---- Files ----
# load order as on Horizon: main, subsdk*, sdk (subsdk0 = NintendoSDK_movie, which Sofdec feeds its VP9 video to)
modules	main subsdk0 sdk
romfs_marker	DOLL/Content/Paks/pakchunk0-Switch.ucas
zip_store	.pak:.ttf:.ucas:.usm:.utoc:.metallib

# ---- Graphics ----
# 60 fps (30 on the Switch): the game's config caps Unreal at 30 (FrameRateLimit=30 in DefaultGameUserSettings.ini and SwitchGameUserSettings.ini, which UEngine::SetMaxFPS, main+0x134d2c0, puts
# in t.MaxFPS; rhi.syncinterval=2 in SwitchDeviceProfiles.ini, the present interval 2 it asks for while BaseSwitchEngine.ini's r.VSync=1 locks presents to vsync); the host writes t.MaxFPS 60 and
# rhi.SyncInterval 1 into its console variables (hle_fpslock.c), so the game asks for present interval 1 itself. Unreal steps the game by the time that really passed.
# DM_FPS_TARGET=30 (Documents/env.txt on the iPhone) keeps the game's 30 and saves power
fps_target	60
# Texture streaming pool: the Switch device profile sets r.Streaming.PoolSize=200 (SwitchDeviceProfiles.ini [Switch], docked and handheld; [WindowsNoEditor] in DefaultDeviceProfiles.ini
# sets 1000), and past it the streamer drops the top mips of what is in view: textures and lightmaps blurry a second after an area loads (GitHub issue #589). The host raises it to the
# game's own Windows value on the Mac (hle_uecvar.c); on iOS only DM_UE_TEXTURE_POOL turns it on
ue_texture_pool	1000

# ---- Memory ----
# Unreal Engine 4.27: nninitStartup (main+0xe89fa4) needs virtual address memory, sets a 6 MB heap for the C library's malloc and reserves one address region for the engine
# (62 GB by default; the rewriter's engine-wide gate on the store of its size (dm/tools/ue_region.py; hle_svc.c) gives it what the alias region has room for, 2.81 GB; until 2026-10-31 -SwitchVirtualAddressSpaceSize=2048 in game_args). Its allocator, an FMallocBinned3 made on the first allocation, cuts 37 GB of pools out of that region; the
# constructor call is cut and the host runs Unreal's heap on a malloc zone outside the guest block (the rewriter's engine-wide cut, dm/tools/ue_malloc.py; hle_uemalloc.c), and the SDK's node area is cut to 62 MB, as for
# Octopath Traveler 0 on the same SDK. The region then holds what the engine maps itself: on the Mac up to +0.75 GB of the alias region with 0.5 GB mapped through the opening and
# the new-game menus, beside an Unreal heap of 1 GB and 0.9 GB of Metal allocations (about 2.3 GB resident; a 2 GB region then). Alias region = node area + the region (this SDK build
# aligns regions to 2 MB only) + 256 MB for regions made later; 256 MB stacks, 384 MB heap region
mem_reserve	0xF0000000
mem_alias	0xC8000000
mem_stack	0x10000000
app_pool	0xCD500000
# the NPDM declares 80 MB of system resource
sys_resource	0x5000000

# ---- Input ----
# A 3D game with a free camera on the right stick: the 3D pad layout. It reads the controller only, so it stays docked (1920x1080)
pad_layout	full

# ---- Shader split ----
# The shader code archives of pakchunk0-Switch.pak (ShaderArchive-*.ushaderbytecode), each shader LZ4-compressed (uepak.py lz4_shaders): the engine's global shaders and the game's
# material shaders. Unreal combines vertex and pixel shaders per draw from its pipeline state, so every vertex shader is made to link with any pixel shader (shader_split.py separable_pairs)
shader_groups	ShaderArchive-Global-=global ShaderArchive-=game
shader_note	DRAGON QUEST VII Reimagined shaders
