MediaWiki API result

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "SD_Filesystem",
        "continue": "gapcontinue||"
    },
    "warnings": {
        "main": {
            "*": "Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
        },
        "revisions": {
            "*": "Because \"rvslots\" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used."
        }
    },
    "query": {
        "pages": {
            "402": {
                "pageid": 402,
                "ns": 0,
                "title": "Ring-Con",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "This page documents how the Ring Fit Adventure game uses [[HID_services#hidbus|hidbus]] for using the Ring-Con [[HID_services#ExternalDevices|ExternalDevice]], which attaches to Joy-Cons.\n\nAfter EnableExternalDevice is used successfully during initialization, EnableJoyPollingReceiveMode(flag=true) is used with command [[#0x00020101]]. For cleanup, DisableJoyPollingReceiveMode is used then on success EnableExternalDevice(flag=false) is used.\n\nCommands (input data for EnableJoyPollingReceiveMode / SendAndReceive) start with the u32 cmd. Data in the replies are at least 0x4-bytes, with fields being 4-byte aligned. Reply+0 is the u8 status. When the output size doesn't match the expected size, or status is non-zero, error 0xEDA is returned. When status is non-zero, a func is called with the status value which updates global state.\n\nThe status field is not listed below since all replies have it.\n\nNote that the app saves various PlayReports, this includes various Ring-Con data (which includes field-name strings).\n\n= CRC =\nSome commands/replies use CRC(s) for validating the previous N-bytes prior to the CRC. When the CRC is invalid, the app sets an output flag indicating invalid CRC and skips writing output-data to the output-param.\n\nThis CRC doesn't use Xor(In/Out)/Reflect(In/Out). The polynomial is 0x8D. This is CRC8.\n\n= Commands =\n{| class=\"wikitable\" border=\"1\"\n|-\n! Input cmd u32 || Input cmd size || Reply size\n|-\n| [[#0x00020000]] || 0x4 || 0x8\n|-\n| [[#0x00020100]] || 0x4 || 0x10\n|-\n| [[#0x00020101]] || 0x4 || 0x8\n|-\n| [[#0x00020104]] || 0x4 || 0x8\n|-\n| [[#0x00020105]] || 0x4 || 0x8\n|-\n| [[#0x00020204]] || 0x4 || 0x8\n|-\n| [[#0x00020304]] || 0x4 || 0x8\n|-\n| [[#0x00020404]] || 0x4 || 0x8\n|-\n| [[#0x00020504]] || 0x4 || 0x8\n|-\n| [[#0x00020A04]] || 0x4 || 0x14\n|-\n| [[#0x00021104]] || 0x4 || 0x8\n|-\n| [[#0x00021204]] || 0x4 || 0x8\n|-\n| [[#0x00021304]] || 0x4 || 0x8\n|-\n| [[#0x00021A04]] || 0x4 || 0x14\n|-\n| [[#0x00023104]] || 0x4 || 0x8\n|-\n| [[#0x00023204]] || 0x4 || 0x8\n|-\n| [[#0x04013104]] || 0x8 || 0x8\n|-\n| [[#0x04011104]] || 0x8 || 0x4\n|-\n| [[#0x04011204]] || 0x8 || 0x4\n|-\n| [[#0x04011304]] || 0x8 || 0x4\n|-\n| [[#0x10011A04]] || 0x14 || 0x4\n|}\n\n== 0x00020000 ==\nThe two u8s at reply+0x4 are copied to an output struct, with the order swapped in the output struct. This is also used directly by various funcs, without the struct.\n\nReply u8 +0x4 is \"fw_sub_ver\", +0x5 is \"fw_main_ver\".\n\nThis gets the firmware version. Funcs using this do: <code>if (fw_main_ver >= 0x20) {} else {}</code>\n\n== 0x00020100 ==\nThis gets the ID. The first 0x6-bytes from the below output is \"id_l\", the remaining 0x6-bytes are \"id_h\". During PlayReport saving the cached ID is copied to u64s, which are then used with the PlayReport.\n\nReply:\n\n{| class=\"wikitable\" border=\"1\"\n|-\n! Offset || Size || Description\n|-\n| 0x4 || 0xC || This is copied to an output buffer.\n|}\n\n== 0x00020101 ==\nThis is used with EnableJoyPollingReceiveMode/GetJoyPollingReceivedData. Reply+0x4 is an u16 which is copied to an output struct, the [[HID_services#JoyPollingReceivedData|timestamp]] is also copied. This seems to be the current sensor state.\n\n== 0x00020104 ==\nReply+0x4 is the output 16bit value.\n\nSee [[#0x00020A04]].\n\n== 0x00020105 ==\nReply+0x4 is the output u8, which copied to an output u32.\n\n== 0x00020204 ==\nReply+0x4 is the output 16bit value.\n\nSee [[#0x00020A04]].\n\n== 0x00020304 ==\nReply+0x4 is the output 16bit value.\n\nSee [[#0x00020A04]].\n\n== 0x00020404 ==\nReply+0x4 is the output 16bit value.\n\nSee [[#0x00020A04]].\n\n== 0x00020504 ==\nReply+0x4 is a s16. After successfully using this cmd, this calls the func for [[#0x00020A04]]. When that's successful, this does the following with the output from that func and the earlier reply data: <code>s16 tmp = s16 manu_hk_max - s16 manu_os_max; if (tmp < 0) tmp++; *16bit_outparam = replydata + (tmp>>1);</code> Then this returns 0, regardless of whether [[#0x00020A04]] was successful.\n\n== 0x00020A04 ==\nThe app uses cmd [[#0x00020000]] first. When fw_main_ver from that cmd is >=0x20, it proceeds to use cmd 0x00020A04 then returns. Otherwise, the following cmds are used with the output being copied to the output struct, then returns: [[#0x00020104]] (output_struct+0x0), [[#0x00020204]] (output_struct+0x2), [[#0x00020404]] (output_struct+0x6), [[#0x00020304]] (output_struct+0x4).\n\nReply:\n\n{| class=\"wikitable\" border=\"1\"\n|-\n! Offset || Size || Description\n|-\n| 0x4 || 0x2 || \"manu_os_max\". s16 value copied to output_struct+0x0.\n|-\n| 0x8 || 0x2 || \"manu_hk_max\". s16 value copied to output_struct+0x2.\n|-\n| 0xC || 0x2 || \"manu_zero_min\". s16 value copied to output_struct+0x4.\n|-\n| 0x10 || 0x2 || \"manu_zero_max\". s16 value copied to output_struct+0x6.\n|}\n\n== 0x00021104 ==\nThis is implemented in the app with the cmd to use being specified via an input param.\n\nSee [[#0x00021A04]].\n\nReply:\n\n{| class=\"wikitable\" border=\"1\"\n|-\n! Offset || Size || Description\n|-\n| 0x4 || 0x2 || Data, copied to an output struct as an 16bit value.\n|-\n| 0x6 || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|}\n\n== 0x00021204 ==\nSee [[#0x00021104]].\n\n== 0x00021304 ==\nSee [[#0x00021104]].\n\n== 0x00021A04 ==\nThe app uses cmd [[#0x00020000]] first. When fw_main_ver from that cmd is >=0x20, it proceeds to use cmd 0x00021A04. Otherwise, the following cmds are used, with the output being written to the output_struct: [[#0x00021104]] (output_struct+0x0), [[#0x00021204]] (output_struct+0x2), [[#0x00021304]] (output_struct+0x4).\n\nThen, if any of the 16bit output fields in output_struct are set to 0xCAFE, a flag is set to 0x2 (same field used for invalid-CRC, which uses value 0x1 for that). Then this returns 0. This field is \"user_state\".\n\nThis reads the user calibration. This is normally (?) not calibrated (fields are set to 0xCAFE).\n\nReply:\n\n{| class=\"wikitable\" border=\"1\"\n|-\n! Offset || Size || Description\n|-\n| 0x4 || 0x2 || \"user_os_max\"/\"os_max\". s16 value copied to output_struct+0x0.\n|-\n| 0x6 || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|-\n| 0x7 || 0x1 || Padding.\n|-\n| 0x8 || 0x2 || \"user_hk_max\"/\"hk_max\". s16 value copied to output_struct+0x2.\n|-\n| 0xA || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|-\n| 0xB || 0x1 || Padding.\n|-\n| 0xC || 0x2 || \"user_zero\"/\"zero\". s16 value copied to output_struct+0x4.\n|-\n| 0xE || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|-\n| 0xF || 0x1 || Padding.\n|}\n\n== 0x00023104 ==\nThe code which calls the func implementing this clamps the output value to range 0-500, then copies it elsewhere.\n\nThis gets the rep-count for Multitask-Mode.\n\nReply:\n\n{| class=\"wikitable\" border=\"1\"\n|-\n! Offset || Size || Description\n|-\n| 0x4 || 0x3 || Data, copied to an output struct as a s32.\n|-\n| 0x7 || 0x1 || [[#CRC]] over the previous 0x3-bytes, followed a value-0 byte.\n|}\n\n== 0x00023204 ==\nThe func implementing this in the app is identical to [[#0x00023104]] except for the cmd u32. The output field is \"total_push_count\". This is only updated in Multitask Mode.\n\nThe code calling this func copies the output into a global field, when it's valid.\n\n== 0x04013104 ==\nThe data at cmd+0x4 is all-zero. The app doesn't use reply data here besides the status.\n\nUnlike the other cmds, this checks for output_size==0x4, instead of {output buffer size} (it's unknown whether this is intended).\n\nThis resets the value returned by [[#0x00023104]] to 0.\n\n== 0x04011104 ==\nCmd+0x4 is the 4-byte input. The output_size is not checked.\n\nSee [[#0x10011A04]].\n\n== 0x04011204 ==\nCmd+0x4 is the 4-byte input. The output_size is not checked.\n\nSee [[#0x10011A04]].\n\n== 0x04011304 ==\nCmd+0x4 is the 4-byte input. The output_size is not checked.\n\nSee [[#0x10011A04]].\n\n== 0x10011A04 ==\nThe app uses cmd [[#0x00020000]] first. When fw_main_ver from that cmd is >=0x20, it proceeds to use cmd 0x10011A04 then returns. Otherwise, the following cmds are used, with the same 4-byte input listed in the below table: [[#0x04011104]] (below cmd+0x4), [[#0x04011204]] (below cmd+0x8), [[#0x04011304]] (below cmd+0xC).\n\nThe app doesn't use reply data here besides the status, and the output_size is not checked.\n\nThe code calling this func saves PlayReports with EventId \"write_user_cal\". This is the Write version of [[#0x00021A04]], the s16s here are the same as [[#0x00021A04]].\n\nThe code calling this func will first call this func, then on success a PlayReport is saved. Then [[#0x00021A04]] is used, on success if the output matches the data used for 0x10011A04 and the is_valid flag is 0, this returns 0. Otherwise: the func for 0x10011A04 is used again, handling error on failure. Then a PlayReport is saved again. [[#0x00021A04]] is used, with error handling on failure. Then the same validation checks run again. If it didn't return at this point, error handling runs.\n\nCmd:\n{| class=\"wikitable\" border=\"1\"\n|-\n! Offset || Size || Description\n|-\n| 0x4 || 0x2 || Func input param & 0xFFFF\n|-\n| 0x6 || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|-\n| 0x7 || 0x1 || Padding.\n|-\n| 0x8 || 0x2 || (Func input param >> 16) & 0xFFFF\n|-\n| 0xA || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|-\n| 0xB || 0x1 || Padding.\n|-\n| 0xC || 0x2 || (Func input param >> 32) & 0xFFFF\n|-\n| 0xE || 0x1 || [[#CRC]] over the previous 0x2-bytes.\n|-\n| 0xF || 0x1 || Padding.\n|-\n| 0x10 || 0x4 || Zeros\n|}"
                    }
                ]
            },
            "363": {
                "pageid": 363,
                "ns": 0,
                "title": "Rtld",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "rtld, short for \u201cruntime link-editor\u201d, is the first executable code belonging to the program that the system launches. This serves as the program entry point and crt0. rtld's entry point is defined to be the start of its .text section.\n\nrtld is tasked with relocating the [[NSO|NSOs]] that were loaded in to memory by the system loader, at a random base address. To do this, it requires that binaries include a [[NSO#MOD|module header]], and a pointer to it at offset +0x04 in the .text section.\n\nrtld receives two parameters from the system, in X0 and X1. The first parameter should be null. The second parameter is the handle of the main thread. See the [[Homebrew_ABI#Entrypoint_Arguments|entrypoint arguments]] section.\n\nrtld initially derives absolute pointers by using the BL instruction to skip over an offset value, and then accessing and adding X30.\n\n== Functionality ==\n\nAn outline of rtld's functions is below.\n\n* Check the first parameter. Hangs if set.\n* Clear rtld .bss.\n\nThe main function for loading all of the modules now executes.\n\n* Iterate over the rtld .dynamic section to establish REL, RELA, RELENT, RELAENT, RELCOUNT and RELACOUNT.\n* With the above information, process relative relocations (R_AARCH64_RELATIVE) on rtld.\n* rtld initializes load lists and a module object for itself, which formalizes loading of the rtld .dynamic section.\n* Prepare to iterate over all modules. rtld does this by scanning memory using [[SVC#svcQueryMemory|svcQueryMemory]]. The memory must be R-X and STATIC. If the address matches the rtld base address, the module is skipped here.\n* Each valid memory region is read, and must contain 'MOD0' magic at offset +0x04. If this check fails, rtld hangs.\n* Read the .dynamic and .bss pointers from the module header. If the .bss pointers are unequal, rtld clears the .bss for this module.\n* Initialize a module object for this module, using the same function that was used to initialize an object for rtld itself. This object is typically stored in the module's .bss, via another pointer in the module header.\n* Process relative relocations for this module.\n* Update list pointers for the rtld lists and the module object.\n* Prepare for next iteration - the next memory query address is calculated by adding the size of the current memory region to the current address.\n* Once all modules are loaded, rtld resolves symbols. The full list of supported relocation types is available below. This uses the .dynsym, .dynstr and .hash sections.\n\nOnce the above function returns, rtld serves as a general initialization routine for the program.\n\n* Initializes the standard library \u201cmusl\u201d.\n* Initializes the SDK. The second parameter (thread handle) passed to rtld is passed to this function.\n* Calls program-defined initialization routine.\n* Calls each module's initialization function.\n* Calls program main().\n* Finalizes the SDK.\n* Jumps to [[SVC#svcExitProcess|svcExitProcess]].\n\n== Relocation types ==\n\n{| class=wikitable\n! Value || Name\n|-\n| 257   || R_AARCH64_ABS64\n|-\n| 258   || R_AARCH64_ABS32\n|-\n| 1025  || R_AARCH64_GLOB_DAT\n|-\n| 1026  || R_AARCH64_JUMP_SLOT\n|-\n| 1027  || R_AARCH64_RELATIVE \n|}"
                    }
                ]
            }
        }
    }
}