Changes

Jump to navigation Jump to search
9,274 bytes added ,  00:05, 18 November 2020
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. See [[#EmuSystemJITPlugin]]
+
*** "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 70: Line 88:  
* 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.
 
* 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: 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:
 
* 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.
+
** +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.
+
** +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).
+
** 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 161: Line 262:  
** "/<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.
    
= Savedata =
 
= Savedata =

Navigation menu