Changes

Jump to navigation Jump to search
14,423 bytes added ,  16:06, 17 April 2022
m
fix wiki syntax
Line 51: Line 51:  
*** "01_UNSMJ3.002.bin": This is the ROMIMAGE.
 
*** "01_UNSMJ3.002.bin": This is the ROMIMAGE.
 
*** "02_UNSMJ3.002.cfg": Configuration json file, ROMCONFIG.
 
*** "02_UNSMJ3.002.cfg": Configuration json file, ROMCONFIG.
*** "03_UNSMJ3.002.pcb": This is the "PRECMP" file referenced by the .meta.
+
*** "03_UNSMJ3.002.pcb": This is the "PRECMP" file referenced by the .meta. See [[#EmuSystemJITPlugin]]. Using this can be disabled by changing the "PRECMP" string in the .meta to an invalid string, etc.
 
*** "04_UNSMJ3.002.nrr": Unused [[NRR]] which is the same as "/.nrr/04_UNSMJ3.002.nrr", except the [[NRR#Certification|Certification]] and ApplicationId are all-zero.
 
*** "04_UNSMJ3.002.nrr": Unused [[NRR]] which is the same as "/.nrr/04_UNSMJ3.002.nrr", except the [[NRR#Certification|Certification]] and ApplicationId are all-zero.
 
*** "05_UNSMJ3.002.nro": Identical to "/nro/05_UNSMJ3.002.nro".
 
*** "05_UNSMJ3.002.nro": Identical to "/nro/05_UNSMJ3.002.nro".
 
*** "06_UNSMJ3.002.lua": This is the "ROMPATCH" Lua file referenced by the .meta.
 
*** "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.
 
*** "07_UNSMJ3.002.ppl": This is the "PIPELINE" file referenced by the .meta.
 +
 +
== Emulation Notes ==
 +
The generated-code runs from the main-thread. The following 4 threads are created:
 +
* Audio thread.
 +
* "g_trlRenderTaskThread". Calls funcptr/object-vfunc from a list of tasks (funcptr/object only used if set), where the tasks are sent by the main-thread. These tasks can be triggered by accessing various IO regs with Write32 (see below), etc.
 +
* A thread which basically does nothing, just uses a Semaphore and sleeps, while checking state.
 +
* An unknown thread.
 +
 +
 +
* <code>n64MemDefault{Read/Write}{bitsize}(...)</code>, where bitsize is {8, 16, 32, 64}: implements memory read/write, all read/written data is byte-swapped. First param is the u32 vaddr. For Write, the second param is the value. For Read, the returned u32 is the read value.
 +
* <code>n64MemDefaultReadSpecial{bitsize}(...)</code>, where bitsize is {8, 16, 32, 64}: same as <code>n64MemDefaultRead{bitsize}</code>, except this runs the additional Special functionality when accessing RAM.
 +
* <code>n64MemDefault{Read/Write}{bitsize}WithDestLog(...)</code>, where bitsize is {8, 16, 32, 64}: same as <code>n64MemDefault{Read/Write}{bitsize}</code>, except this calls an additional logging func when accessing RAM.
 +
 +
 +
* Read8/Write8 only implements access for RAM and SP_DMEM/SP_IMEM. 0 is returned for Read when the address is unrecognized.
 +
* Read16/Write16 only implements access for RAM. Read16WithDestLog/Write16WithDestLog will additionally call the logging func if the address is in the IO region (high byte is 0x04). 0 is returned for Read when the address is unrecognized.
 +
* Read32/Write32 implements RAM access and all supported non-RAM IO/memory access. 0 is returned for Read when the address is unrecognized.
 +
* Read64/Write64 are implemented the same as *16 above, except this is for 64bit.
    
== EmuSystemJITPlugin ==
 
== EmuSystemJITPlugin ==
Line 62: Line 80:  
First, [[JIT_services#Control|Control]] is used with a 0xEB0-byte struct for the InBuffer, and cmd in_u64=0. The OutBuffer is unused. This does initialization, and copies the input struct to workmem+0x0.
 
First, [[JIT_services#Control|Control]] is used with a 0xEB0-byte struct for the InBuffer, and cmd in_u64=0. The OutBuffer is unused. This does initialization, and copies the input struct to workmem+0x0.
   −
The u64 for [[JIT_services#GenerateCode|GenerateCode]] is the type: 1-4 are valid. Type1 is used first, then type2.
+
The u64 for [[JIT_services#GenerateCode|GenerateCode]] is the type: 1-4 are valid. Type1 is used first, then type2. Then type3 is used with data loaded from the "PRECMP" file (the passed array data will be empty if the PRECMP file is not available). Type4 is only used when executing an emu_pc_addr which was not previously compiled, with a matching emu_pc_addr.
 +
 
 +
The u32 for the input Struct32 size is ignored by the plugin.
    
* Type1: Struct32 and InBuffer are unused. Generates the entry code which can be called for running the rest of the code in the CodeMemory. After the generated code finishes setup, it jumps to x0.
 
* Type1: Struct32 and InBuffer are unused. Generates the entry code which can be called for running the rest of the code in the CodeMemory. After the generated code finishes setup, it jumps to x0.
 
* Type2: Struct32 and InBuffer are unused. Generates the code for returning from CodeMemory, which is used by the rest of the generated code.
 
* Type2: Struct32 and InBuffer are unused. Generates the code for returning from CodeMemory, which is used by the rest of the generated code.
* Type3: ...
+
* Type3: The emulator passes the 0x8-bytes from InBuffer+0 as the input Struct32, however the plugin doesn't use the Struct32. The emulator passes InBuffer_size=0x8C00048 and OutBuffer_size=0x2900008. This generates code for the MIPS code specified in the InBuffer. The InBuffer contains array data etc. The InBuffer can contain multiple blocks of code, which are generally individual MIPS functions. The MIPS instructions are big-endian.
* Type4: ...
+
* Type4: 0x20-bytes are passed for the input Struct32: u32 +0 = emu_pc_addr, u32 +4 = set by emulator but unused by the plugin, u32 +0x18 = instruction_count (which determines the InBuffer size), the rest is unused / overwritten by the plugin. This generates code for the MIPS code specified in the InBuffer. InBuffer+0 is the u32s for the big-endian MIPS instructions. The OutBuffer is 0x2000C-bytes:
 +
** +0x0 is an array of u32s with the count from u32 +0x20004. Each entry is the generated-code offset for each compiled MIPS instruction, relative to the CodeRange offset.
 +
** +0x10000 is an array of u32s with the count from u32 +0x20004. Each entry is flags for each compiled MIPS instruction.
 +
** The 3 u32s at +0x20000 are the same as OutBuffer+0x0 with type1/type2 (except the last two fields can be non-zero). +0x20004 is the total compiled MIPS instructions. +0x20008 is emu_pc_addr for the first compiled instruction.
    
0xC-bytes are copied to the OutBuffer with type1/type2, these come from workmem. These 3 u32s are left at all-zero, except for +0 which is the generated_code_size (which is then copied to the output CodeRange size).
 
0xC-bytes are copied to the OutBuffer with type1/type2, these come from workmem. These 3 u32s are left at all-zero, except for +0 which is the generated_code_size (which is then copied to the output CodeRange size).
 +
 +
The 0xEB0-byte controldata struct has the following structure (all addrs/data are from the emulator user-process):
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
! Offset
 +
! Size
 +
! Description
 +
|-
 +
| 0x0 || 0x8 || Data addr: g_pGPR
 +
|-
 +
| 0x8 || 0x8 || Data addr: g_pFPR
 +
|-
 +
| 0x10 || 0x8 || Data addr: g_pCP0
 +
|-
 +
| 0x18 || 0x8 || Data addr: g_nRegHi
 +
|-
 +
| 0x20 || 0x8 || Data addr: g_nRegLo
 +
|-
 +
| 0x28 || 0x8 || Data addr.
 +
|-
 +
| 0x30 || 0x8 || Data addr: g_nFCSR
 +
|-
 +
| 0x38 || 0x8 || Data addr: g_bN64CpuCmpEndCheck
 +
|-
 +
| 0x40 || 0x8 || Data addr: g_nN64CpuPC
 +
|-
 +
| 0x48 || 0x8 || Data addr: g_nN64CpuJmpPC. s32, normally -1. When not -1 this is a value which can be copied into g_nN64CpuJmpPC by the generated code, with g_nN64CpuJmpPC being reset to -1 afterwards regardless of the original value.
 +
|-
 +
| 0x50 || 0x8 || Data addr.
 +
|-
 +
| 0x58 || 0x8 || Data addr: g_nN64CpuHaveExp
 +
|-
 +
| 0x60 || 0x658 || Array of funcptrs. Called with w0=instruction_value from generated code for handling instructions' implementation, when the plugin itself doesn't handle it.
 +
|-
 +
| 0x6B8 || 0x8 || Funcptr: <code>n64CPUProcInstCOP1Check()</code>
 +
|-
 +
| 0x6C0 || 0x8 || Funcptr.
 +
|-
 +
| 0x6C8 || 0x8 || Funcptr.
 +
|-
 +
| 0x6D0 || 0x8 || Funcptr: <code>n64CPUSetRegisterCP0(int, unsigned int)</code>
 +
|-
 +
| 0x6D8 || 0x8 || Funcptr: <code>n64CPUGetRegisterCP0(int)</code>
 +
|-
 +
| 0x6E0 || 0x20 || Funcptrs for reading data: <code>n64MemDefaultRead{bitsize}(unsigned int)</code>, where bitsize is {8, 16, 32, 64} (32 uses <code>n64MemDefaultRead32WithDestLog</code>). Unused by the plugin.
 +
|-
 +
| 0x700 || 0x20 || Funcptrs for reading Special data: <code>n64MemDefaultReadSpecial{bitsize}(unsigned int)</code>, where bitsize is {8, 16, 32, 64}.
 +
|-
 +
| 0x720 || 0x20 || Funcptrs for writing data: <code>n64MemDefaultWrite{bitsize}(unsigned int, ...)</code>, where bitsize is {8, 16, 32, 64} (32 uses <code>n64MemDefaultWrite32WithDestLog</code>). Unused by the plugin.
 +
|-
 +
| 0x740 || 0x20 || Funcptrs for reading data via the WithDestLog version: <code>n64MemDefaultRead{bitsize}WithDestLog(unsigned int)</code>, where bitsize is {8, 16, 32, 64}.
 +
|-
 +
| 0x760 || 0x20 || Funcptrs for writing data via the WithDestLog version: <code>n64MemDefaultWrite{bitsize}WithDestLog(unsigned int, ...)</code>, where bitsize is {8, 16, 32, 64}.
 +
|-
 +
| 0x780 || 0x8 || Funcptr: <code>n64CPU_CallLuaAfterInst(unsigned int, unsigned int)</code>
 +
|-
 +
| 0x788 || 0x8 || Funcptr: <code>n64CPU_CallLuaBeforeInst(unsigned int, unsigned int)</code>
 +
|-
 +
| 0x790 || 0x8 || Funcptr.
 +
|-
 +
| 0x798 || 0x4 || Array count for the the following array.
 +
|-
 +
| 0x79C || 0x180 (0x20*0xC) || Array data with the above count, each entry is 0xC-bytes. The emulator loads this from config array "Idle". +0 = u32 emu_pc_addr (config "JmpAddr"), +4 = u32 instruction_value (config "JmpInst"), +8 = u32 is_idle (config "IsIdle", 0x1 = enabled).
 +
|-
 +
| 0x91C || 0x4 || Array count for the the following array.
 +
|-
 +
| 0x920 || 0x500 (0x40*0x14) || Array data with the above count, each entry is 0x14-bytes. The emulator loads this from config array "SpecialInst". +0 = u32 emu_pc_addr (config "Addr"), +4 = u32 instruction_value (config "Inst"), +8 = u32 flags. The emulator sets the flags to 0 by default, then compares config "Type" with various strings to determine the value. Flags: bit0 = Type "BreakLoop", bit5 = Type "LoadFrameBuffer", bit6 = Type "Lua_BeforeInst", bit7 = Type "Lua_AfterInst".
 +
 +
When the config for {any of the previously mentioned Type strings} is set to value 1, the emulator will also enable the corresponding flags bit mentioned above. Likewise with config "Return", which sets flags bit8.
 +
 +
When the plugin loads a funcptr from +0x740, it will load a funcptr from +0x700 instead if there's a matching entry here which has bit5 set.
 +
|-
 +
| 0xE20 || 0x4 || Array count for the the following array. The plugin doesn't use this.
 +
|-
 +
| 0xE24 || 0x80 (0x10*0x8) || Array data with the above count, each entry is 0x8-bytes. The emulator loads this from config array "FrameBuffer". +0 = u32 (config "Addr"), +4 = u32 (config "Length"). The plugin doesn't use this.
 +
|-
 +
| 0xEA4 || 0x4 || Set to 0 by default, then if available the emulator sets bit flags here depending on the content of the config for <code>"Cmp", "g_nN64CpuCmpTLBCheckLevel"</code>.
 +
|-
 +
| 0xEA8 || 0x4 || Set to 0 by default by the emulator. With config <code>"Cmp", "CodeMultiAddr"</code> this is set to 1, and with config <code>"Cmp", "BlockDynamicPC"</code> this is set to 2. The plugin only checks whether this ==2 or !=2, so values 0-1 are basically the same.
 +
|-
 +
| 0xEAC || 0x4 || Padding
 +
|}
    
= SuperMarioSunshine =
 
= SuperMarioSunshine =
Line 77: Line 183:     
This emulator supports arguments with argc/argv, when launched officially zero [[Loader_services#SetProgramArgument|arguments]] are passed for this (unless [[Loader_services#SetProgramArgument|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:
 
This emulator supports arguments with argc/argv, when launched officially zero [[Loader_services#SetProgramArgument|arguments]] are passed for this (unless [[Loader_services#SetProgramArgument|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]].
+
 
* ...
+
{| class="wikitable"
 +
|-
 +
! Argument !! Description
 +
|-
 +
| --volume=&lt;0..100&gt; || Set sound volume (default: 100).
 +
|-
 +
| --disable-file-cache || Disable file cache if supported by the platform.
 +
|-
 +
| --no-dol-hash || Do not calculate DOL hash (unsafe)
 +
|-
 +
| --screenshot-period=&lt;value&gt;, -sp || Takes screenshots every n frame
 +
|-
 +
| --screenshot-write-queue-thread-count=&lt;0..n&gt; || Change the number of threads allocated to the screenshot write queue, 0 to disable (default: 1).
 +
|-
 +
| --delete-after-load || Delete save state after a successful load.
 +
|-
 +
| --listen-port=&lt;port&gt; || Specify the service port to listen to (default: 1234).
 +
|-
 +
| --card-uncompressed || Do not compress card.
 +
|-
 +
| --sync-guest-none || Don't synchronize emulation, run as fast as possible.
 +
|-
 +
| --gecko-patch=&lt;name&gt; || Apply Gecko patch &lt;name&gt;
 +
|-
 +
| --log=&lt;file&gt; || Log to file instead of stdout. Defaults to stdout
 +
|-
 +
| --rootdir=&lt;path&gt;, -r&lt;path&gt; || Set the root directory
 +
|-
 +
| --no-patch || Do not apply standard patch
 +
|-
 +
| --stop-failed-test[=&lt;number&gt;] || Stop subtests after &lt;number&gt; differences (default 10).
 +
|-
 +
| --exit=&lt;value&gt;, -e || Exit after n frames
 +
|-
 +
| --help, -h || Print usage and exit.
 +
|-
 +
| --mute || Start ROM with mute sound.
 +
|-
 +
| --sync-guest-with-wall || Synchronize emulation with wall time.
 +
|-
 +
| --sync-guest-with-host || Synchronize emulation with host.
 +
|-
 +
| --test=&lt;filename&gt;, -t || Starts emulator in unit test mode.
 +
|-
 +
| --no-pip || Don't use pipeline database.
 +
|-
 +
| --play-input || Play previously recorded input
 +
|-
 +
| --command=&lt;file&gt; || Use file as the contents of the command line (one arg per line).
 +
|-
 +
| --dim-screen-after=&lt;s&gt; || Dim screen after &lt;s&gt; seconds of inactivity.
 +
|-
 +
| --random-inputs-period=&lt;0..n&gt; || Change the random inputs period in number of frames (default: 10).
 +
|-
 +
| --config=&lt;filename&gt;, -cfg || Gives path to the config file
 +
|-
 +
| --ask, -a || Ask for a rom and execute it.
 +
|-
 +
| --load-state-slot=&lt;index&gt;, -lss&lt;index&gt; || Load save state by index.
 +
|-
 +
| --load-state-file=&lt;filename&gt;, -lsf&lt;filename&gt; || Load save state by filename.
 +
|-
 +
| --generatetest=&lt;directory&gt;, -gt || Starts emulator in unit test mode and generate output files inside the given directory.
 +
|-
 +
| --waitcontroller, -wc || Stop CPU until controller 0 has been detected
 +
|-
 +
| --card-format=&lt;size_in_Mbits&gt; || Format card using given size in MBits (default 4, possible 8, 16, 32, 64, 128).
 +
|-
 +
| --card-force-copy || Force card copy from read-only support to read-write support (on supported platforms).
 +
|-
 +
| --screenshot-output-format=[png&#x7C;ppm] || Change the format of the screenshots when using the generic screenshot capture code (default: png).
 +
|-
 +
| --config-override || Use a specific config override filename.
 +
|-
 +
| --random-inputs || Use random inputs instead of values from physical controllers.
 +
|-
 +
| --log-unit-test || Enable log in unit test mode.
 +
|-
 +
| --break-on-start, -bos || Break at the start of the rom.
 +
|-
 +
| --record-input || Record input
 +
|-
 +
| --screenshot-write-queue-capacity=&lt;1..n&gt; || Change the capacity of the screenshot queue (default: thread-count * 2 + 1).
 +
|-
 +
| --random-inputs-seed=&lt;0..n&gt; || Change the random inputs seed value (default: 0).
 +
|-
 +
| --listen-address=&lt;address&gt; || Specify the service address to listen to (default: 0.0.0.0).
 +
|-
 +
| --gui, -gui || Use the GUI mode
 +
|-
 +
| --break-on-start-dsp, -bosd || Break at the start of the dsp program.
 +
|-
 +
| --no-db-config || Do not use the ROM DB config override.
 +
|-
 +
| --features || Print features and exit.
 +
|-
 +
|}
    
This emulator uses various hashes, SHA-1 is used for this.
 
This emulator uses various hashes, SHA-1 is used for this.
Line 156: Line 358:  
** "/<language>/LayoutData/Font.arc": Updated.
 
** "/<language>/LayoutData/Font.arc": Updated.
 
** "/LayoutData/CameraInfo.arc", "/LayoutData/IconAButton.arc", "/StationedData/GDDR3.arc", "/StationedData/GDDR3.zst": Updated.
 
** "/LayoutData/CameraInfo.arc", "/LayoutData/IconAButton.arc", "/StationedData/GDDR3.arc", "/StationedData/GDDR3.zst": Updated.
 +
 +
== v1.1.0 ==
 +
ExeFs:
 +
* Updated for using SDK 10.8.1.0, except for SuperMarioSunshine/SuperMarioGalaxy.
 +
* NPDMs for all Programs only had the usual update (see [[#v1.0.1]]).
 +
** Launcher: All files in ExeFs were updated.
 +
** SuperMario64: All files in ExeFs were updated, except subsdk*.
 +
** SuperMarioSunshine/SuperMarioGalaxy: Only main-codebin and the NPDM were updated.
 +
 +
RomFs:
 +
* Launcher: The following was updated:
 +
** /Layout/CursorArrow.Nin_NX_NVN.blarc.zs
 +
** /Layout/DialogKeyButton.Nin_NX_NVN.blarc.zs
 +
** /Layout/DialogTwoButton.Nin_NX_NVN.blarc.zs
 +
** /Message/Msg_CNzh.d.sarc.zs
 +
** /Message/Msg_JPja.d.sarc.zs
 +
* SuperMario64: The following was updated:
 +
** /nro/05_UNSMJ3.002.nro
 +
** /nro/EmuSystemJITPlugin.nro
 +
*** This appears to be just a rebuild. A func called by _fini/etc was updated, nothing else specific to the plugin was changed in .text. The .nrs build filepath was also changed.
 +
** /nro/NROBuilder.nro
 +
** /.nrr/04_UNSMJ3.002.nrr
 +
** /.nrr/EmuAppNX64.nrr
 +
** /Pipeline.cache
 +
** "/rom/Stardust_JP/00_UNSMJ3.002.meta" Newlines now use LF instead of CRLF.
 +
** "/rom/Stardust_JP/02_UNSMJ3.002.cfg" Newlines now use LF instead of CRLF. The content of the "Comment" entries under "SpecialInst" had the string characters replaced with '*' (for redacting the string). The Lua hook entries were updated under "SpecialInst". The "Comment" entries under "VertexHack" were redacted the same way, nothing else changed under "VertexHack".
 +
** /rom/Stardust_JP/04_UNSMJ3.002.nrr
 +
** /rom/Stardust_JP/05_UNSMJ3.002.nro
 +
** "/rom/Stardust_JP/06_UNSMJ3.002.lua" Newlines now use LF instead of CRLF. Comments were redacted, see above. HookFunc_AfterInst was updated for handling the updated hooks mentioned above.
 +
* SuperMarioSunshine:
 +
** "/data/database/config/MarioSunshine.config" The config entries for "KeyPadAxisTriggerLeft"/"KeyPadAxisTriggerRight" were updated.
 +
** "/data/gekko/MarioSunshine/nx/MarioSunshine.nrolz" updated
 +
** The following files were added under "/data/lazy_texture_replace/MarioSunshine/":
 +
*** 5323227429978722713_lod1.png
 +
*** 5323227429978722713_lod2.png
 +
*** 5323227429978722713_lod3.png
 +
*** 5323227429978722713.png
 +
** "/hagi-override.config" Formatting was adjusted.
 +
** "/MarioSunshine/Super_Mario_Sunshine_Stardust-trimmed.gcm" updated
 +
** "/.nrr/Hagi.nrr" updated
 +
** "/rom.json" The DolHash was updated.
 +
* SuperMarioGalaxy: The only change was removing the following files from "/StationedData/":
 +
** DEBUG.arc
 +
** DEBUG.zst
 +
** GDDR3.arc
 +
** NAPA.zst
 +
 +
The Manual RomFs for each game was also updated.
 +
 +
DeltaFragment NCAs were also added.
 +
 +
== v1.1.1 ==
 +
ExeFs:
 +
* NPDMs for all Programs only had the usual update (see [[#v1.0.1]]).
 +
* The only other change was updating the main-codebin for SuperMario64.
 +
 +
RomFs: ...
    
= Savedata =
 
= Savedata =
9

edits

Navigation menu