322 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			322 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#include <samplefiles.hpp>
 | 
						|
 | 
						|
const char *default_title = "Sample";
 | 
						|
const char *default_code = "NPI7";
 | 
						|
const char *default_unique_id = "0xff3ff";
 | 
						|
const char *default_romfs_path = "romfs";
 | 
						|
const char *sample_header =
 | 
						|
    "// Sample Header File\n"
 | 
						|
    "#pragma once\n"
 | 
						|
    "#include <3ds.h>\n"
 | 
						|
    "#include <stdio.h>";
 | 
						|
const char *sample_code =
 | 
						|
    "// Sample Source Code for Hello World\n\n"
 | 
						|
    "#include <common.hpp>\n\n"
 | 
						|
    "int main() {\n"
 | 
						|
    "   gfxInitDefault();\n"
 | 
						|
    "   consoleInit(GFX_TOP, NULL);\n"
 | 
						|
    "   printf(\"Hello World!\\n\");\n"
 | 
						|
    "   printf(\"Press START to exit!\\n\");\n"
 | 
						|
    "   while(aptMainLoop()) {\n"
 | 
						|
    "       hidScanInput();\n"
 | 
						|
    "       if(hidKeysDown() & KEY_START) break;\n"
 | 
						|
    "       gfxSwapBuffers();\n"
 | 
						|
    "   }\n"
 | 
						|
    "   gfxExit();\n"
 | 
						|
    "}";
 | 
						|
const char *ciaRSF =
 | 
						|
    "#This File is generated by npi-build!\n"
 | 
						|
    "#Every Changes made will get overwritten\n"
 | 
						|
    "#if the name of this file is <build-cia.rsf>\n"
 | 
						|
    "#To use custom rsf files change the path in build.json\n"
 | 
						|
    "BasicInfo:\n"
 | 
						|
    "  Title                   : \"%s\"\n"
 | 
						|
    "  ProductCode             : \"CTR-H-%s\"\n"
 | 
						|
    "  Logo                    : Homebrew # Nintendo / Licensed / Distributed "
 | 
						|
    "/ iQue / iQueForSystem\n"
 | 
						|
    "\n"
 | 
						|
    "RomFs:\n"
 | 
						|
    "  RootPath: \"%s\"\n"
 | 
						|
    "\n"
 | 
						|
    "TitleInfo:\n"
 | 
						|
    "  Category                : Application\n"
 | 
						|
    "  UniqueId                : %s\n"
 | 
						|
    "\n"
 | 
						|
    "Option:\n"
 | 
						|
    "  UseOnSD                 : true # true if App is to be installed to SD\n"
 | 
						|
    "  FreeProductCode         : true # Removes limitations on ProductCode\n"
 | 
						|
    "  MediaFootPadding        : false # If true CCI files are created with "
 | 
						|
    "padding\n"
 | 
						|
    "  EnableCrypt             : false # Enables encryption for NCCH and CIA\n"
 | 
						|
    "  EnableCompress          : true # Compresses where applicable (currently "
 | 
						|
    "only exefs:/.code)\n"
 | 
						|
    "  \n"
 | 
						|
    "AccessControlInfo:\n"
 | 
						|
    "  CoreVersion                   : 2\n"
 | 
						|
    "\n"
 | 
						|
    "  # Exheader Format Version\n"
 | 
						|
    "  DescVersion                   : 2\n"
 | 
						|
    "  \n"
 | 
						|
    "  # Minimum Required Kernel Version (below is for 4.5.0)\n"
 | 
						|
    "  ReleaseKernelMajor            : \"02\"\n"
 | 
						|
    "  ReleaseKernelMinor            : \"33\"\n"
 | 
						|
    "\n"
 | 
						|
    "  # ExtData\n"
 | 
						|
    "  UseExtSaveData                : false # enables ExtData       \n"
 | 
						|
    "  #ExtSaveDataId                : 0x300 # only set this when the ID is "
 | 
						|
    "different to the UniqueId\n"
 | 
						|
    "\n"
 | 
						|
    "  # FS:USER Archive Access Permissions\n"
 | 
						|
    "  # Uncomment as required\n"
 | 
						|
    "  FileSystemAccess:\n"
 | 
						|
    "   - CategorySystemApplication\n"
 | 
						|
    "   - CategoryHardwareCheck\n"
 | 
						|
    "   - CategoryFileSystemTool\n"
 | 
						|
    "   - Debug\n"
 | 
						|
    "   - TwlCardBackup\n"
 | 
						|
    "   - TwlNandData\n"
 | 
						|
    "   #- Boss\n"
 | 
						|
    "   - DirectSdmc\n"
 | 
						|
    "   - Core\n"
 | 
						|
    "   #- CtrNandRo\n"
 | 
						|
    "   #- CtrNandRw\n"
 | 
						|
    "   #- CtrNandRoWrite\n"
 | 
						|
    "   - CategorySystemSettings\n"
 | 
						|
    "   #- CardBoard\n"
 | 
						|
    "   #- ExportImportIvs\n"
 | 
						|
    "   - DirectSdmcWrite\n"
 | 
						|
    "   #- SwitchCleanup\n"
 | 
						|
    "   #- SaveDataMove\n"
 | 
						|
    "   #- Shop\n"
 | 
						|
    "   #- Shell\n"
 | 
						|
    "   #- CategoryHomeMenu\n"
 | 
						|
    "   #- SeedDB\n"
 | 
						|
    "  IoAccessControl:\n"
 | 
						|
    "   #- FsMountNand\n"
 | 
						|
    "   #- FsMountNandRoWrite\n"
 | 
						|
    "   - FsMountTwln\n"
 | 
						|
    "   #- FsMountWnand\n"
 | 
						|
    "   - FsMountCardSpi\n"
 | 
						|
    "   - UseSdif3\n"
 | 
						|
    "   #- CreateSeed\n"
 | 
						|
    "   - UseCardSpi\n"
 | 
						|
    "\n"
 | 
						|
    "  # Process Settings\n"
 | 
						|
    "  MemoryType                    : Application # Application/System/Base\n"
 | 
						|
    "  SystemMode                    : 64MB # "
 | 
						|
    "64MB(Default)/96MB/80MB/72MB/32MB\n"
 | 
						|
    "  IdealProcessor                : 0\n"
 | 
						|
    "  AffinityMask                  : 1\n"
 | 
						|
    "  Priority                      : 16\n"
 | 
						|
    "  MaxCpu                        : 0x9E # Default\n"
 | 
						|
    "  HandleTableSize               : 0x200\n"
 | 
						|
    "  DisableDebug                  : false\n"
 | 
						|
    "  EnableForceDebug              : false\n"
 | 
						|
    "  CanWriteSharedPage            : true\n"
 | 
						|
    "  CanUsePrivilegedPriority      : false\n"
 | 
						|
    "  CanUseNonAlphabetAndNumber    : true\n"
 | 
						|
    "  PermitMainFunctionArgument    : true\n"
 | 
						|
    "  CanShareDeviceMemory          : true\n"
 | 
						|
    "  RunnableOnSleep               : false\n"
 | 
						|
    "  SpecialMemoryArrange          : true\n"
 | 
						|
    "\n"
 | 
						|
    "  # New3DS Exclusive Process Settings\n"
 | 
						|
    "  SystemModeExt                 : Legacy # Legacy(Default)/124MB/178MB  "
 | 
						|
    "Legacy:Use Old3DS SystemMode\n"
 | 
						|
    "  CpuSpeed                      : 804MHz # 268MHz(Default)/804MHz\n"
 | 
						|
    "  EnableL2Cache                 : true # false(default)/true\n"
 | 
						|
    "  CanAccessCore2                : true \n"
 | 
						|
    "\n"
 | 
						|
    "  # Virtual Address Mappings\n"
 | 
						|
    "  IORegisterMapping:\n"
 | 
						|
    "   - 1ff00000-1ff7ffff   # DSP memory\n"
 | 
						|
    "  MemoryMapping: \n"
 | 
						|
    "   - 1f000000-1f5fffff:r # VRAM\n"
 | 
						|
    "\n"
 | 
						|
    "  # Accessible SVCs, <Name>:<ID>\n"
 | 
						|
    "  SystemCallAccess: \n"
 | 
						|
    "    ControlMemory: 1\n"
 | 
						|
    "    QueryMemory: 2\n"
 | 
						|
    "    ExitProcess: 3\n"
 | 
						|
    "    GetProcessAffinityMask: 4\n"
 | 
						|
    "    SetProcessAffinityMask: 5\n"
 | 
						|
    "    GetProcessIdealProcessor: 6\n"
 | 
						|
    "    SetProcessIdealProcessor: 7\n"
 | 
						|
    "    CreateThread: 8\n"
 | 
						|
    "    ExitThread: 9\n"
 | 
						|
    "    SleepThread: 10\n"
 | 
						|
    "    GetThreadPriority: 11\n"
 | 
						|
    "    SetThreadPriority: 12\n"
 | 
						|
    "    GetThreadAffinityMask: 13\n"
 | 
						|
    "    SetThreadAffinityMask: 14\n"
 | 
						|
    "    GetThreadIdealProcessor: 15\n"
 | 
						|
    "    SetThreadIdealProcessor: 16\n"
 | 
						|
    "    GetCurrentProcessorNumber: 17\n"
 | 
						|
    "    Run: 18\n"
 | 
						|
    "    CreateMutex: 19\n"
 | 
						|
    "    ReleaseMutex: 20\n"
 | 
						|
    "    CreateSemaphore: 21\n"
 | 
						|
    "    ReleaseSemaphore: 22\n"
 | 
						|
    "    CreateEvent: 23\n"
 | 
						|
    "    SignalEvent: 24\n"
 | 
						|
    "    ClearEvent: 25\n"
 | 
						|
    "    CreateTimer: 26\n"
 | 
						|
    "    SetTimer: 27\n"
 | 
						|
    "    CancelTimer: 28\n"
 | 
						|
    "    ClearTimer: 29\n"
 | 
						|
    "    CreateMemoryBlock: 30\n"
 | 
						|
    "    MapMemoryBlock: 31\n"
 | 
						|
    "    UnmapMemoryBlock: 32\n"
 | 
						|
    "    CreateAddressArbiter: 33\n"
 | 
						|
    "    ArbitrateAddress: 34\n"
 | 
						|
    "    CloseHandle: 35\n"
 | 
						|
    "    WaitSynchronization1: 36\n"
 | 
						|
    "    WaitSynchronizationN: 37\n"
 | 
						|
    "    SignalAndWait: 38\n"
 | 
						|
    "    DuplicateHandle: 39\n"
 | 
						|
    "    GetSystemTick: 40\n"
 | 
						|
    "    GetHandleInfo: 41\n"
 | 
						|
    "    GetSystemInfo: 42\n"
 | 
						|
    "    GetProcessInfo: 43\n"
 | 
						|
    "    GetThreadInfo: 44\n"
 | 
						|
    "    ConnectToPort: 45\n"
 | 
						|
    "    SendSyncRequest1: 46\n"
 | 
						|
    "    SendSyncRequest2: 47\n"
 | 
						|
    "    SendSyncRequest3: 48\n"
 | 
						|
    "    SendSyncRequest4: 49\n"
 | 
						|
    "    SendSyncRequest: 50\n"
 | 
						|
    "    OpenProcess: 51\n"
 | 
						|
    "    OpenThread: 52\n"
 | 
						|
    "    GetProcessId: 53\n"
 | 
						|
    "    GetProcessIdOfThread: 54\n"
 | 
						|
    "    GetThreadId: 55\n"
 | 
						|
    "    GetResourceLimit: 56\n"
 | 
						|
    "    GetResourceLimitLimitValues: 57\n"
 | 
						|
    "    GetResourceLimitCurrentValues: 58\n"
 | 
						|
    "    GetThreadContext: 59\n"
 | 
						|
    "    Break: 60\n"
 | 
						|
    "    OutputDebugString: 61\n"
 | 
						|
    "    ControlPerformanceCounter: 62\n"
 | 
						|
    "    CreatePort: 71\n"
 | 
						|
    "    CreateSessionToPort: 72\n"
 | 
						|
    "    CreateSession: 73\n"
 | 
						|
    "    AcceptSession: 74\n"
 | 
						|
    "    ReplyAndReceive1: 75\n"
 | 
						|
    "    ReplyAndReceive2: 76\n"
 | 
						|
    "    ReplyAndReceive3: 77\n"
 | 
						|
    "    ReplyAndReceive4: 78\n"
 | 
						|
    "    ReplyAndReceive: 79\n"
 | 
						|
    "    BindInterrupt: 80\n"
 | 
						|
    "    UnbindInterrupt: 81\n"
 | 
						|
    "    InvalidateProcessDataCache: 82\n"
 | 
						|
    "    StoreProcessDataCache: 83\n"
 | 
						|
    "    FlushProcessDataCache: 84\n"
 | 
						|
    "    StartInterProcessDma: 85\n"
 | 
						|
    "    StopDma: 86\n"
 | 
						|
    "    GetDmaState: 87\n"
 | 
						|
    "    RestartDma: 88\n"
 | 
						|
    "    DebugActiveProcess: 96\n"
 | 
						|
    "    BreakDebugProcess: 97\n"
 | 
						|
    "    TerminateDebugProcess: 98\n"
 | 
						|
    "    GetProcessDebugEvent: 99\n"
 | 
						|
    "    ContinueDebugEvent: 100\n"
 | 
						|
    "    GetProcessList: 101\n"
 | 
						|
    "    GetThreadList: 102\n"
 | 
						|
    "    GetDebugThreadContext: 103\n"
 | 
						|
    "    SetDebugThreadContext: 104\n"
 | 
						|
    "    QueryDebugProcessMemory: 105\n"
 | 
						|
    "    ReadProcessMemory: 106\n"
 | 
						|
    "    WriteProcessMemory: 107\n"
 | 
						|
    "    SetHardwareBreakPoint: 108\n"
 | 
						|
    "    GetDebugThreadParam: 109\n"
 | 
						|
    "    ControlProcessMemory: 112\n"
 | 
						|
    "    MapProcessMemory: 113\n"
 | 
						|
    "    UnmapProcessMemory: 114\n"
 | 
						|
    "    CreateCodeSet: 115\n"
 | 
						|
    "    CreateProcess: 117\n"
 | 
						|
    "    TerminateProcess: 118\n"
 | 
						|
    "    SetProcessResourceLimits: 119\n"
 | 
						|
    "    CreateResourceLimit: 120\n"
 | 
						|
    "    SetResourceLimitValues: 121\n"
 | 
						|
    "    AddCodeSegment: 122\n"
 | 
						|
    "    Backdoor: 123\n"
 | 
						|
    "    KernelSetState: 124\n"
 | 
						|
    "    QueryProcessMemory: 125\n"
 | 
						|
    "\n"
 | 
						|
    "  # Service List\n"
 | 
						|
    "  # Maximum 34 services (32 if firmware is prior to 9.6.0)\n"
 | 
						|
    "  ServiceAccessControl:\n"
 | 
						|
    "   - APT:U\n"
 | 
						|
    "   - ac:u\n"
 | 
						|
    "   - am:net\n"
 | 
						|
    "   #- boss:U\n"
 | 
						|
    "   #- cam:u\n"
 | 
						|
    "   #- cecd:u\n"
 | 
						|
    "   #- cfg:nor\n"
 | 
						|
    "   - cfg:u\n"
 | 
						|
    "   #- csnd:SND\n"
 | 
						|
    "   - dsp::DSP\n"
 | 
						|
    "   #- frd:u\n"
 | 
						|
    "   - fs:USER\n"
 | 
						|
    "   - gsp::Gpu\n"
 | 
						|
    "   - gsp::Lcd\n"
 | 
						|
    "   - hid:USER\n"
 | 
						|
    "   - http:C\n"
 | 
						|
    "   #- ir:rst\n"
 | 
						|
    "   #- ir:u\n"
 | 
						|
    "   #- ir:USER\n"
 | 
						|
    "   #- mic:u\n"
 | 
						|
    "   #- ndm:u\n"
 | 
						|
    "   #- news:s\n"
 | 
						|
    "   - nwm::EXT\n"
 | 
						|
    "   - nwm::UDS\n"
 | 
						|
    "   - ptm:sysm\n"
 | 
						|
    "   - ptm:u\n"
 | 
						|
    "   - pxi:dev\n"
 | 
						|
    "   - soc:U\n"
 | 
						|
    "   - ssl:C\n"
 | 
						|
    "   #- y2r:u\n"
 | 
						|
    "\n"
 | 
						|
    "\n"
 | 
						|
    "SystemControlInfo:\n"
 | 
						|
    "  SaveDataSize: 0KB # Change if the app uses savedata\n"
 | 
						|
    "  RemasterVersion: $(APP_VERSION_MAJOR)\n"
 | 
						|
    "  StackSize: 0x40000\n"
 | 
						|
    "\n"
 | 
						|
    "  # Modules that run services listed above should be included below\n"
 | 
						|
    "  # Maximum 48 dependencies\n"
 | 
						|
    "  # <module name>:<module titleid>\n"
 | 
						|
    "  Dependency:\n"
 | 
						|
    "    ac: 0x0004013000002402\n"
 | 
						|
    "    #act: 0x0004013000003802\n"
 | 
						|
    "    am: 0x0004013000001502\n"
 | 
						|
    "    boss: 0x0004013000003402\n"
 | 
						|
    "   camera: 0x0004013000001602\n"
 | 
						|
    "    cecd: 0x0004013000002602\n"
 | 
						|
    "   cfg: 0x0004013000001702\n"
 | 
						|
    "    codec: 0x0004013000001802\n"
 | 
						|
    "    csnd: 0x0004013000002702\n"
 | 
						|
    "    dlp: 0x0004013000002802\n"
 | 
						|
    "    dsp: 0x0004013000001a02\n"
 | 
						|
    "    friends: 0x0004013000003202\n"
 | 
						|
    "    gpio: 0x0004013000001b02\n"
 | 
						|
    "    gsp: 0x0004013000001c02\n"
 | 
						|
    "    hid: 0x0004013000001d02\n"
 | 
						|
    "    http: 0x0004013000002902\n"
 | 
						|
    "    i2c: 0x0004013000001e02\n"
 | 
						|
    "    ir: 0x0004013000003302\n"
 | 
						|
    "    mcu: 0x0004013000001f02\n"
 | 
						|
    "    mic: 0x0004013000002002\n"
 | 
						|
    "    ndm: 0x0004013000002b02\n"
 | 
						|
    "    news: 0x0004013000003502\n"
 | 
						|
    "    #nfc: 0x0004013000004002\n"
 | 
						|
    "    nim: 0x0004013000002c02\n"
 | 
						|
    "    nwm: 0x0004013000002d02\n"
 | 
						|
    "    pdn: 0x0004013000002102\n"
 | 
						|
    "    ps: 0x0004013000003102\n"
 | 
						|
    "    ptm: 0x0004013000002202\n"
 | 
						|
    "    #qtm: 0x0004013020004202\n"
 | 
						|
    "    ro: 0x0004013000003702\n"
 | 
						|
    "    socket: 0x0004013000002e02\n"
 | 
						|
    "    spi: 0x0004013000002302\n"
 | 
						|
    "    ssl: 0x0004013000002f02\n"; |