diff --git a/Makefile b/Makefile index 2040b822..394f4b56 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,12 @@ GLOBAL_ASM_C_FILES := $(shell $(GREP) GLOBAL_ASM $(SRC_DIR) /dev/nu GLOBAL_ASM_O_FILES := $(foreach file,$(GLOBAL_ASM_C_FILES:.c=.o),$(BUILD_DIR)/$(file)) DEFINES := -D_LANGUAGE_C -D_FINALROM -DWIN32 -DNDEBUG -DTARGET_N64 -DCOMPILING_LIBULTRA -DEFINES += -DVERSION_US +ifeq ($(VERSION),us) + DEFINES += -DVERSION_US +else ifeq ($(VERSION),jp) + DEFINES += -DVERSION_JP +endif + DEFINES += -DBUILD_VERSION=VERSION_D ifneq ($(RECOMP_BUILD),0) diff --git a/config/jp/pilotwings64.jp.sha1 b/config/jp/pilotwings64.jp.sha1 new file mode 100644 index 00000000..40f73f0c --- /dev/null +++ b/config/jp/pilotwings64.jp.sha1 @@ -0,0 +1 @@ +892a5472d9a6811b881d093020de81f72baeeec9 build/pilotwings64.jp.z64 diff --git a/config/jp/pilotwings64.jp.yaml b/config/jp/pilotwings64.jp.yaml new file mode 100644 index 00000000..3f7b564c --- /dev/null +++ b/config/jp/pilotwings64.jp.yaml @@ -0,0 +1,412 @@ +name: Pilot Wings64 (Japanese) +sha1: 892a5472d9a6811b881d093020de81f72baeeec9 +options: + basename: pilotwings64 + target_path: baserom.jp.z64 + elf_path: build/pilotwings64.jp.elf + base_path: ../.. + platform: n64 + compiler: IDO + + asm_path: asm + src_path: src + asset_path: bin + build_path: build + create_asm_dependencies: True + + ld_script_path: build/pilotwings64.jp.ld + ld_dependencies: True + ld_sections_allowlist: + - .shstrtab + - .mdebug + - .mdebug.abi32 + + find_file_boundaries: True + header_encoding: ASCII + + o_as_suffix: True + use_legacy_include_asm: False + mips_abi_float_regs: o32 + + # section_order: [".text", ".data", ".rodata", ".bss"] + # auto_link_sections: [".data", ".rodata", ".bss"] + + symbol_addrs_path: + - config/jp/sym/symbol_addrs.txt + reloc_addrs_path: + - config/jp/sym/reloc_addrs.txt + + undefined_funcs_auto_path: build/splat_out/jp/undefined_funcs_auto.txt + undefined_syms_auto_path: build/splat_out/jp/undefined_syms_auto.txt + + extensions_path: tools/splat_ext + + # string_encoding: ASCII + # data_string_encoding: ASCII + rodata_string_guesser_level: 2 + data_string_guesser_level: 2 + libultra_symbols: True + # hardware_regs: True + gfx_ucode: f3d + migrate_rodata_to_functions: True + +segments: + - name: header + type: header + start: 0x0 + + - name: ipl3 + type: bin + start: 0x40 + + - name: entry + type: code + start: 0x1000 + vram: 0x80200050 + subsegments: + - [0x1000, hasm, entrypoint] + + - name: kernel + type: code + start: 0x1050 + vram: 0x802000A0 + follows_vram: entry + bss_size: 0x6BF60 + subsegments: + - [0x01050, c, kernel/code_1050] + - [0x01300, c, kernel/anim] + - [0x02130, c, kernel/audio_emitter] + - [0x03D50, c, kernel/audio_event] + - [0x04850, c, kernel/audio_manager] + - [0x05690, c, kernel/audio_seq] + - [0x058E0, c, kernel/chan] + - [0x06F80, c, kernel/clocks] + - [0x07150, c, kernel/code_7150] + - [0x08170, c, kernel/code_8170] + - [0x177A0, c, kernel/dobj] + - [0x19170, c, kernel/env] + - [0x19B50, c, kernel/fx_seq] + - [0x1A220, c, kernel/font] + - [0x1AF00, c, kernel/fx] + - [0x20030, c, kernel/geometry] + - [0x21890, c, kernel/graphics] + - [0x24D60, c, kernel/filesystem] + - [0x25180, c, kernel/controller] + - [0x25580, c, kernel/texture] + - [0x28E10, c, kernel/matrix] + - [0x2AD80, c, kernel/math] + - [0x2B2A0, c, kernel/memory] + - [0x2BF80, c, kernel/sched] + - [0x2D3C0, c, kernel/sobj] + - [0x2E190, c, kernel/string] + - [0x2EDD0, c, kernel/system] + - [0x2FD10, c, kernel/terrain] + - [0x30CC0, c, kernel/code_30DF0] + - [0x30D70, c, kernel/code_30EA0] + - [0x30FB0, c, kernel/sprite] + - [0x32350, c, kernel/user_file] + - [0x32460, c, kernel/utils] + - [0x32630, c, kernel/vector] + - [0x32890, hasm, kernel/decompress_mio0] + - [0x32940, c, kernel/debug] + - [0x35320, c, libultra/audio/sndpsetsound] + - [0x35340, c, libultra/audio/sndpgetstate] + - [0x35360, c, libultra/audio/sndpstop] + - [0x353B0, c, libultra/audio/sndpdeallocate] + - [0x35400, c, libultra/audio/sndpallocate] + - [0x354A0, c, libultra/audio/sndpplay] + - [0x35510, c, libultra/audio/sndpsetvol] + - [0x35570, c, libultra/audio/sndpsetpitch] + - [0x355D0, c, libultra/audio/sndpsetfxmix] + - [0x35630, c, libultra/audio/sndpsetpan] + - [0x35690, c, libultra/audio/heapinit] + - [0x356D0, c, libultra/audio/sndplayer] + - [0x35DE0, c, libultra/audio/csplayer] + - [0x37010, c, libultra/os/sendmesg] + - [0x37160, c, libultra/audio/heapalloc] + - [0x371C0, c, libultra/audio/bnkf] + - [0x37410, c, libultra/io/aisetfreq] + - [0x37570, c, libultra/audio/sl] + - [0x37630, c, libultra/os/createmesgqueue] + - [0x37660, c, libultra/os/createthread] + - [0x377B0, c, libultra/os/startthread] + - [0x37900, c, libultra/os/recvmesg] + - [0x37A40, c, libultra/os/virtualtophysical] + - [0x37AC0, c, libultra/io/aisetnextbuf] + - [0x37B70, c, libultra/io/aigetlen] + - [0x37B80, c, libultra/audio/synthesizer] + - [0x38250, c, libultra/io/pidma] + - [0x38360, c, libultra/audio/seqpsetbank] + - [0x383A0, c, libultra/audio/seqpgetstate] + - [0x383B0, c, libultra/audio/cseq] + - [0x38E70, c, libultra/audio/seqpsetseq] + - [0x38EB0, c, libultra/audio/seqpplay] + - [0x38EE0, c, libultra/audio/seqpsettempo] + - [0x38F50, c, libultra/audio/seqpsetvol] + - [0x38F90, c, libultra/audio/seqpstop] + - [0x38FC0, hasm, libultra/os/getcount] + - [0x38FD0, c, libultra/sp/sprite] + - [0x3B600, c, libultra/sp/color] + - [0x3B630, c, libultra/sp/spscale] + - [0x3B6A0, hasm, libultra/gu/sqrtf] + - [0x3B6B0, c, libultra/io/viblack] + - [0x3B720, hasm, libultra/os/writebackdcache] + - [0x3B7A0, c, libultra/io/visetspecial] + - [0x3B960, c, libultra/libc/ll] + - [0x3BC20, c, libultra/io/piread] + - [0x3BC60, pad] + - [0x3BCA0, c, libultra/io/viswapbuf] + - [0x3BCF0, hasm, libultra/os/writebackdcacheall] + - [0x3BD20, c, libultra/io/sptask] + - [0x3BFE0, c, libultra/io/vigetcurrframebuf] + - [0x3C020, c, libultra/io/vigetnextframebuf] + - [0x3C060, c, libultra/io/vimgr] + - [0x3C3C0, c, libultra/io/visetmode] + - [0x3C430, c, libultra/os/seteventmesg] + - [0x3C4A0, c, libultra/io/visetevent] + - [0x3C510, c, libultra/io/sptaskyield] + - [0x3C530, c, libultra/io/sptaskyielded] + - [0x3C5B0, c, libultra/io/conteeplongwrite] + - [0x3C6F0, c, libultra/io/conteeplongread] + - [0x3C830, c, libultra/io/conteepprobe] + - [0x3C8A0, c, libultra/os/initialize] + - [0x3CAD0, c, libultra/io/pirawread] + - [0x3CB30, c, libultra/os/getcurrfaultthread] + - [0x3CB40, c, libultra/io/pimgr] + - [0x3CCC0, c, libultra/os/setthreadpri] + - [0x3CDA0, c, libultra/os/settimer] + - [0x3CE80, c, libultra/io/controller] + - [0x3D240, c, libultra/io/contreaddata] + - [0x3D4A0, hasm, libultra/os/invaldcache] + - [0x3D550, c, libultra/libc/ldiv] + - [0x3D6E0, c, libultra/audio/event] + - [0x3DA20, c, libultra/audio/synaddplayer] + - [0x3DA70, c, libultra/audio/synallocvoice] + - [0x3DCA0, c, libultra/audio/synstartvoice] + - [0x3DD30, c, libultra/audio/synsetpan] + - [0x3DDC0, c, libultra/audio/synsetvol] + - [0x3DE60, c, libultra/audio/synsetpitch] + - [0x3DEF0, c, libultra/audio/synsetfxmix] + - [0x3DF90, c, libultra/audio/synstopvoice] + - [0x3E010, c, libultra/audio/synfreevoice] + - [0x3E0C0, hasm, libultra/os/setintmask] + - [0x3E120, c, libultra/audio/seqplayer] + - [0x3FA60, c, libultra/audio/cents2ratio] + - [0x3FAB0, c, libultra/audio/synstartvoiceparam] + - [0x3FBA0, hasm, libultra/os/interrupt] + - [0x3FBE0, c, libultra/os/thread] + - [0x3FC20, hasm, libultra/os/exceptasm] + - [0x40490, c, libultra/io/vi] + - [0x405A0, c, libultra/audio/syndelete] + - [0x405B0, hasm, libultra/os/probetlb] + - [0x40670, c, libultra/io/ai] + - [0x406A0, c, libultra/audio/drvrnew] + - [0x40E20, c, libultra/audio/synallocfx] + - [0x40EC0, c, libultra/audio/mainbus] + - [0x41010, c, libultra/audio/load] + - [0x41B60, c, libultra/audio/resample] + - [0x41E60, c, libultra/audio/env] + - [0x42AC0, c, libultra/audio/auxbus] + - [0x42BD0, c, libultra/audio/save] + - [0x42C90, c, libultra/os/jammesg] + - [0x42DE0, c, libultra/io/pigetcmdq] + - [0x42E10, c, libultra/sp/clearattribute] + - [0x42E30, c, libultra/sp/setattribute] + - [0x42E40, c, libultra/io/piacs] + - [0x42F00, hasm, libultra/libc/bcopy] + - [0x43210, c, libultra/io/spsetstat] + - [0x43220, c, libultra/io/spsetpc] + - [0x43260, c, libultra/io/sprawdma] + - [0x432F0, c, libultra/io/sp] + - [0x43320, c, libultra/os/timerintr] + - [0x43720, c, libultra/os/getthreadpri] + - [0x43740, c, libultra/io/vigetcurrcontext] + - [0x43750, c, libultra/io/viswapcontext] + - [0x43AB0, c, libultra/io/spgetstat] + - [0x43AC0, c, libultra/io/conteepwrite] + - [0x43FA0, c, libultra/io/conteepread] + - [0x442A0, c, libultra/io/siacs] + - [0x44360, hasm, libultra/os/setsr] + - [0x44370, hasm, libultra/os/getsr] + - [0x44380, hasm, libultra/os/setfpccsr] + - [0x44390, c, libultra/io/sirawread] + - [0x443E0, c, libultra/io/sirawwrite] + - [0x44430, hasm, libultra/os/invalicache] + - [0x444B0, hasm, libultra/os/maptlbrdb] + - [0x44510, hasm, libultra/libc/bzero] + - [0x445B0, c, libultra/io/pirawdma] + - [0x44690, c, libultra/io/devmgr] + - [0x44810, c, libultra/os/gettime] + - [0x448A0, c, libultra/io/sirawdma] + - [0x44950, c, libultra/audio/copy] + - [0x449D0, c, libultra/audio/seq] + - [0x44FF0, c, libultra/audio/synsetpriority] + - [0x45000, c, libultra/debug/kdebugserver] + - [0x45480, c, libultra/os/syncputchars] + - [0x455B0, c, libultra/os/destroythread] + - [0x456B0, c, libultra/audio/filter] + - [0x456D0, c, libultra/audio/reverb] + - [0x462E0, hasm, libultra/os/setcompare] + - [0x462F0, c, libultra/io/si] + - [0x46320, hasm, libultra/os/getcause] + - [0x46330, c, libultra/os/atomic] + + - { start: 0x46390, type: textbin, use_src_path: True, name: rsp/rspboot } + - { start: 0x46460, type: textbin, use_src_path: True, name: rsp/f3dex } + - { start: 0x47890, type: textbin, use_src_path: True, name: rsp/fast3d } + - { start: 0x48CC0, type: textbin, use_src_path: True, name: rsp/aspMain } + + - [0x49AE0, .data, kernel/audio_manager] + - [0x49C10, .data, kernel/code_7150] + - [0x49C30, .data, kernel/code_8170] + - [0x49C40, .data, kernel/env] + - [0x49C80, .data, kernel/font] + - [0x49D00, .data, kernel/fx] + - [0x49FA0, .data, kernel/graphics] + - [0x4A0B0, .data, kernel/terrain] + - [0x4C0B0, .data, kernel/matrix] + - [0x4C0C0, .data, kernel/sched] + - [0x4C0D0, .data, kernel/sprite] + - [0x4C120, .data, kernel/utils] + - [0x4C130, .data, kernel/debug] + - [0x4C5E0, .data, libultra/audio/sl] + - [0x4C5F0, .data, libultra/io/aisetnextbuf] + - [0x4C600, .data, libultra/sp/sprite] + - [0x4C610, .data, libultra/io/vimgr] + - [0x4C630, .data, libultra/io/vitbl] + - [0x4CEF0, .data, libultra/os/initialize] + - [0x4CF00, .data, libultra/io/pimgr] + - [0x4CF20, .data, libultra/io/controller] + - [0x4CF30, .data, libultra/os/thread] + - [0x4CF50, data, libultra/os/exceptasm] + - [0x4CF70, .data, libultra/io/vi] + - [0x4CFE0, .data, libultra/audio/drvrnew] + - [0x4D170, .data, libultra/audio/env] + - [0x4D2B0, .data, libultra/io/piacs] + - [0x4D2C0, .data, libultra/os/timerintr] + - [0x4D2D0, .data, libultra/io/siacs] + - [0x4D2E0, .data, libultra/debug/kdebugserver] + - [0x4D2F0, .data, libultra/os/syncputchars] + - [0x4D300, .data, libultra/vimodes/vimodentsclan1] + - [0x4D350, data, libultra/vimodes/vimodepallan1] # TODO: doesn't match any PAL vimode + - [0x4D3A0, data] # TODO: what are these 0x10 bytes? + + - [0x4D3B0, .rodata, kernel/code_1050] + - [0x4D3F0, .rodata, kernel/anim] + - [0x4D490, .rodata, kernel/audio_emitter] + - [0x4DAA0, .rodata, kernel/audio_event] + - [0x4DB40, .rodata, kernel/audio_manager] + - [0x4DB90, .rodata, kernel/audio_seq] + - [0x4DBC0, .rodata, kernel/chan] + - [0x4DC70, .rodata, kernel/clocks] + - [0x4DCA0, .rodata, kernel/code_7150] + - [0x4DCC0, .rodata, kernel/code_8170] + - [0x4E220, .rodata, kernel/dobj] + - [0x4E4D0, .rodata, kernel/env] + - [0x4E630, .rodata, kernel/fx_seq] + - [0x4E6E0, .rodata, kernel/font] + - [0x4E720, .rodata, kernel/fx] + - [0x4E9E0, .rodata, kernel/geometry] + - [0x4EA80, .rodata, kernel/graphics] + - [0x4EDA0, .rodata, kernel/filesystem] + - [0x4EDD0, .rodata, kernel/controller] + - [0x4EE20, .rodata, kernel/texture] + - [0x4F130, .rodata, kernel/matrix] + - [0x4F200, .rodata, kernel/math] + - [0x4F260, .rodata, kernel/memory] + - [0x4F4E0, .rodata, kernel/sched] + - [0x4F980, .rodata, kernel/sobj] + - [0x4FB00, .rodata, kernel/system] + - [0x4FF20, .rodata, kernel/terrain] + - [0x4FF50, .rodata, kernel/code_30EA0] + - [0x4FF60, .rodata, kernel/sprite] + - [0x50140, .rodata, kernel/user_file] + - [0x50160, .rodata, kernel/utils] + - [0x50170, .rodata, kernel/debug] + - [0x50300, .rodata, libultra/audio/sndplayer] + - [0x50340, .rodata, libultra/audio/csplayer] + - [0x50580, .rodata, libultra/audio/synthesizer] + - [0x50590, .rodata, libultra/audio/cseq] + - [0x505A0, .rodata, libultra/sp/sprite] + - [0x505B0, rodata, libultra/os/setintmask] + - [0x50630, .rodata, libultra/audio/seqplayer] + - [0x50870, .rodata, libultra/audio/cents2ratio] + - [0x50880, rodata, libultra/os/exceptasm] + - [0x508D0, .rodata, libultra/audio/drvrnew] + - [0x50900, .rodata, libultra/audio/resample] + - [0x50940, .rodata, libultra/audio/env] + - [0x509A0, .rodata, libultra/audio/seq] + - [0x509B0, .rodata, libultra/audio/reverb] + - { start: 0x509E0, type: databin, use_src_path: True, name: rsp/f3dex } + - { start: 0x511E0, type: databin, use_src_path: True, name: rsp/fast3d } + - { start: 0x519E0, type: databin, use_src_path: True, name: rsp/aspMain } + + - { type: .bss, vram: 0x80250CF0, name: kernel/code_1050 } + - { type: .bss, vram: 0x80250D40, name: kernel/audio_emitter } + - { type: .bss, vram: 0x8025BD70, name: kernel/audio_event } + - { type: .bss, vram: 0x8025C420, name: kernel/audio_manager } + - { type: .bss, vram: 0x802610A0, name: kernel/audio_seq } + - { type: .bss, vram: 0x802615A0, name: kernel/chan } + - { type: .bss, vram: 0x802632E0, name: kernel/clocks } + - { type: .bss, vram: 0x80263330, name: kernel/code_8170 } + - { type: .bss, vram: 0x802635F0, name: kernel/dobj } + - { type: .bss, vram: 0x80269D80, name: kernel/env } + - { type: .bss, vram: 0x80269DC0, name: kernel/fx_seq } + - { type: .bss, vram: 0x80269EB0, name: kernel/font } + - { type: .bss, vram: 0x8027C3F0, name: kernel/fx } + - { type: .bss, vram: 0x802829D0, name: kernel/geometry } + - { type: .bss, vram: 0x80288DF0, name: kernel/graphics } + - { type: .bss, vram: 0x802A7650, name: kernel/filesystem } + - { type: .bss, vram: 0x802A7660, name: kernel/controller } + - { type: .bss, vram: 0x802A7710, name: kernel/texture } + - { type: .bss, vram: 0x802AA130, name: kernel/matrix } + - { type: .bss, vram: 0x802AAB70, name: kernel/memory } + - { type: .bss, vram: 0x802AAC90, name: kernel/sched } + - { type: .bss, vram: 0x802ABFE0, name: kernel/system } + - { type: .bss, vram: 0x802B7F10, name: kernel/terrain } + - { type: .bss, vram: 0x802B8320, name: kernel/sprite } + - { type: .bss, vram: 0x802BA370, name: kernel/debug } + - { type: .bss, vram: 0x802BA390, name: libultra/sp/sprite } + - { type: .bss, vram: 0x802BA3A0, name: libultra/io/sptask } + - { type: .bss, vram: 0x802BA3E0, name: libultra/io/vimgr } + - { type: .bss, vram: 0x802BB5F0, name: libultra/os/seteventmesg } + - { type: .bss, vram: 0x802BB670, name: libultra/os/initialize } + - { type: .bss, vram: 0x802BB680, name: libultra/io/pimgr } + - { type: .bss, vram: 0x802BC850, name: libultra/io/controller } + - { type: .bss, vram: 0x802BC8E0, name: libultra/io/piacs } + - { type: .bss, vram: 0x802BC900, name: libultra/os/timerintr } + - { type: .bss, vram: 0x802BC940, name: libultra/io/conteepread } + - { type: .bss, vram: 0x802BC980, name: libultra/io/siacs } + - { type: .bss, vram: 0x802BC9A0, name: libultra/debug/kdebugserver } + + - name: app + type: code + start: 0x51CA0 + vram: 0x802BCC50 + bss_size: 0x293E0 + subsegments: + - { start: 0x51CA0, type: textbin, use_src_path: True, name: app_text } + - { start: 0xD6030, type: databin, use_src_path: True, name: app_data } + - { type: bss, vram: 0x80349BE0 } + + - name: filetable + type: bin + start: 0xDEC30 + + - name: filesys + type: bin + start: 0xDFAC0 + + - name: audio_seq + type: bin + start: 0x612BB0 + + - name: audio_ctl + type: bin + start: 0x6274A0 + + - name: audio_tbl + type: bin + start: 0x62B510 + + - [0x800000] diff --git a/config/jp/sym/hardware_regs.ld b/config/jp/sym/hardware_regs.ld new file mode 100644 index 00000000..cab71a65 --- /dev/null +++ b/config/jp/sym/hardware_regs.ld @@ -0,0 +1,113 @@ + +SP_MEM_ADDR_REG = 0xA4040000; +SP_DRAM_ADDR_REG = 0xA4040004; +SP_RD_LEN_REG = 0xA4040008; +SP_WR_LEN_REG = 0xA404000C; +SP_STATUS_REG = 0xA4040010; +SP_DMA_FULL_REG = 0xA4040014; +SP_DMA_BUSY_REG = 0xA4040018; +SP_SEMAPHORE_REG = 0xA404001C; + +SP_PC = 0xA4080000; + +DPC_START_REG = 0xA4100000; +DPC_END_REG = 0xA4100004; +DPC_CURRENT_REG = 0xA4100008; +DPC_STATUS_REG = 0xA410000C; +DPC_CLOCK_REG = 0xA4100010; +DPC_BUFBUSY_REG = 0xA4100014; +DPC_PIPEBUSY_REG = 0xA4100018; +DPC_TMEM_REG = 0xA410001C; + +DPS_TBIST_REG = 0xA4200000; +DPS_TEST_MODE_REG = 0xA4200004; +DPS_BUFTEST_ADDR_REG = 0xA4200008; +DPS_BUFTEST_DATA_REG = 0xA420000C; + +MI_MODE_REG = 0xA4300000; +MI_VERSION_REG = 0xA4300004; +MI_INTR_REG = 0xA4300008; +MI_INTR_MASK_REG = 0xA430000C; + +VI_STATUS_REG = 0xA4400000; +VI_DRAM_ADDR_REG = 0xA4400004; +VI_WIDTH_REG = 0xA4400008; +VI_INTR_REG = 0xA440000C; +VI_CURRENT_REG = 0xA4400010; +VI_BURST_REG = 0xA4400014; +VI_V_SYNC_REG = 0xA4400018; +VI_H_SYNC_REG = 0xA440001C; +VI_LEAP_REG = 0xA4400020; +VI_H_START_REG = 0xA4400024; +VI_V_START_REG = 0xA4400028; +VI_V_BURST_REG = 0xA440002C; +VI_X_SCALE_REG = 0xA4400030; +VI_Y_SCALE_REG = 0xA4400034; + +AI_DRAM_ADDR_REG = 0xA4500000; +AI_LEN_REG = 0xA4500004; +AI_CONTROL_REG = 0xA4500008; +AI_STATUS_REG = 0xA450000C; +AI_DACRATE_REG = 0xA4500010; +AI_BITRATE_REG = 0xA4500014; + +PI_DRAM_ADDR_REG = 0xA4600000; +PI_CART_ADDR_REG = 0xA4600004; +D_A4600005 = 0xA4600005; +D_A4600006 = 0xA4600006; +D_A4600007 = 0xA4600007; +PI_RD_LEN_REG = 0xA4600008; +PI_WR_LEN_REG = 0xA460000C; +PI_STATUS_REG = 0xA4600010; +PI_BSD_DOM1_LAT_REG = 0xA4600014; +PI_BSD_DOM1_PWD_REG = 0xA4600018; +PI_BSD_DOM1_PGS_REG = 0xA460001C; +PI_BSD_DOM1_RLS_REG = 0xA4600020; +PI_BSD_DOM2_LAT_REG = 0xA4600024; +PI_BSD_DOM2_LWD_REG = 0xA4600028; +PI_BSD_DOM2_PGS_REG = 0xA460002C; +PI_BSD_DOM2_RLS_REG = 0xA4600030; + +RI_MODE_REG = 0xA4700000; +RI_CONFIG_REG = 0xA4700004; +RI_CURRENT_LOAD_REG = 0xA4700008; +RI_SELECT_REG = 0xA470000C; +RI_REFRESH_REG = 0xA4700010; +RI_LATENCY_REG = 0xA4700014; +RI_RERROR_REG = 0xA4700018; +RI_WERROR_REG = 0xA470001C; + +SI_DRAM_ADDR_REG = 0xA4800000; +SI_PIF_ADDR_RD64B_REG = 0xA4800004; +D_A4800008 = 0xA4800008; +D_A480000C = 0xA480000C; +SI_PIF_ADDR_WR64B_REG = 0xA4800010; +D_A4800014 = 0xA4800014; +SI_STATUS_REG = 0xA4800018; + +LEO_CMD = 0xA5000508; +LEO_STATUS = 0xA5000508; +LEO_BM_CTL = 0xA5000510; +LEO_BM_STATUS = 0xA5000510; +LEO_SEQ_CTL = 0xA5000518; +LEO_SEQ_STATUS = 0xA5000518; +LEO_C2_BUFF = 0xA5000000; +LEO_SECTOR_BUFF = 0xA5000400; +LEO_DATA = 0xA5000500; +LEO_MISC_REG = 0xA5000504; +LEO_CUR_TK = 0xA500050C; +LEO_ERR_SECTOR = 0xA5000514; +LEO_CUR_SECTOR = 0xA500051C; +LEO_HARD_RESET = 0xA5000520; +LEO_C1_S0 = 0xA5000524; +LEO_HOST_SECBYTE = 0xA5000528; +LEO_C1_S2 = 0xA500052C; +LEO_SEC_BYTE = 0xA5000530; +LEO_C1_S4 = 0xA5000534; +LEO_C1_S6 = 0xA5000538; +LEO_CUR_ADDR = 0xA500053C; +LEO_ID_REG = 0xA5000540; +LEO_TEST_REG = 0xA5000544; +LEO_TEST_PIN_SEL = 0xA5000548; +LEO_RAM_ADDR = 0xA5000580; + diff --git a/config/jp/sym/libultra_undefined_syms.txt b/config/jp/sym/libultra_undefined_syms.txt new file mode 100644 index 00000000..139597f9 --- /dev/null +++ b/config/jp/sym/libultra_undefined_syms.txt @@ -0,0 +1,2 @@ + + diff --git a/config/jp/sym/pif_syms.ld b/config/jp/sym/pif_syms.ld new file mode 100644 index 00000000..3a4b363e --- /dev/null +++ b/config/jp/sym/pif_syms.ld @@ -0,0 +1,11 @@ + +leoBootID = 0x800001a0; +osTvType = 0x80000300; +osRomType = 0x80000304; +osRomBase = 0x80000308; +osResetType = 0x8000030c; +osCicId = 0x80000310; +osVersion = 0x80000314; +osMemSize = 0x80000318; +osAppNMIBuffer = 0x8000031c; + diff --git a/config/jp/sym/reloc_addrs.txt b/config/jp/sym/reloc_addrs.txt new file mode 100644 index 00000000..960ef7d3 --- /dev/null +++ b/config/jp/sym/reloc_addrs.txt @@ -0,0 +1,12 @@ +// Visit https://github.com/ethteck/splat/wiki/Advanced-Reloc for documentation about this file +// entrypoint relocs +rom:0x001000 reloc:MIPS_HI16 symbol:kernel_BSS_START +rom:0x001008 reloc:MIPS_LO16 symbol:kernel_BSS_START + +// This entry corresponds to the "stack top", which is the end of the array used as the stack for the main segment. +// It is commented out because it was not possible to infer what the start of the stack symbol is, so you'll have to figure it out by yourself. +// Once you have found it you can properly name it and specify the length of this stack as the addend value here. +// The address of the end of the stack is 0x802B5FE0. +// A common size for this stack is 0x2000, so try checking for the address 0x802B3FE0. Note the stack may have a different size. +// rom:0x001028 reloc:MIPS_HI16 symbol:main_stack addend:0xXXXX +// rom:0x001034 reloc:MIPS_LO16 symbol:main_stack addend:0xXXXX diff --git a/config/jp/sym/symbol_addrs.txt b/config/jp/sym/symbol_addrs.txt new file mode 100644 index 00000000..a455ec29 --- /dev/null +++ b/config/jp/sym/symbol_addrs.txt @@ -0,0 +1,755 @@ +// Visit https://github.com/ethteck/splat/wiki/Adding-Symbols for documentation about this file +entrypoint = 0x80200050; // type:func +bootproc = 0x8022E30C; // type:func + +// functions + +uvJanimLoad = 0x80200350; // type:func +uvJanimPoseLine = 0x80200B38; // type:func +uvJanimPoseGrid = 0x80200F00; // type:func +uvEmitterPrintf = 0x80201180; // type:func +uvEmitterInitTable = 0x8020119C; // type:func +uvEmitterInit = 0x802011F0; // type:func +uvEmitterLookup = 0x802012B8; // type:func +uvEmitterFromModel = 0x80201348; // type:func +uvEmitterSetMatrix = 0x802013F8; // type:func +uvEmitterGetMatrix = 0x80201444; // type:func +uvEmitter_80201494 = 0x80201494; // type:func +uvEmitterSetPri = 0x802016D4; // type:func +uvEmitterProp = 0x8020170C; // type:func +uvEmitterTrigger = 0x80201904; // type:func +uvEmitterRelease = 0x80201968; // type:func +uvEmitterStatus = 0x80201A0C; // type:func +_uvaSoundBegin = 0x80201B0C; // type:func +_uvaSoundEnd = 0x80201B7C; // type:func +uvEmitterFlush = 0x80201BA8; // type:func +uvEmitter_80201D08 = 0x80201D08; // type:func +_uvaUpdatePlayList = 0x802021D4; // type:func +_uvaPlaylistRemove = 0x80202678; // type:func +_uvaPlay = 0x80202728; // type:func +_uvaStartVoice = 0x80202998; // type:func +_uvaUpdateVoice = 0x80202AFC; // type:func +_uvaStopVoice = 0x80202BB8; // type:func +_uvaStatus = 0x80202C5C; // type:func +uvEventMaxCb = 0x80202F18; // type:func +uvEventPost = 0x80203088; // type:func +uvEventRemoveCb = 0x80203210; // type:func +uvSysInitAudio = 0x802038A0; // type:func +amCreateAudioMgr = 0x80203B08; // type:func +uvaSeqNew = 0x802046E0; // type:func +uvaSeqPlay = 0x802047A8; // type:func +uvaSeqSetTempo = 0x802047E8; // type:func +uvaSeqSetVol = 0x80204840; // type:func +uvaSeqStop = 0x8020489C; // type:func +uvChanEnv = 0x80204DEC; // type:func +uvChanTerra = 0x80204E5C; // type:func +_uvSortAdd = 0x80205814; // type:func +uvClkInit = 0x80205FD0; // type:func +uvClkUpdate = 0x80205FFC; // type:func +uvClkGetSec = 0x80206058; // type:func +uvClkReset = 0x80206150; // type:func +_uvDbSortHits = 0x802071CC; // type:func +uvTerraGetBox = 0x8020FA08; // type:func +uvModelGetPosm = 0x8020FA54; // type:func +uvModelGetProps = 0x8020FB2C; // type:func +uvTerraGetPt = 0x8020FCEC; // type:func +uvTerraGetSeg = 0x8020FF68; // type:func +uvTerraGetColor = 0x80210B70; // type:func +uvTerraGetState = 0x80210E04; // type:func +uvTerraGetPlane = 0x80210F18; // type:func +_uvSurfGetNorm = 0x8021119C; // type:func +uvSobjGetPt = 0x8021133C; // type:func +uvSobjGetSeg = 0x80211544; // type:func +_uvSegInMboxs = 0x80214F54; // type:func +uvDbColorModel = 0x80216750; // type:func +uvDobjModel = 0x802167F0; // type:func +uvDobjProps = 0x80216C1C; // type:func +uvDobjPosm = 0x80216E08; // type:func +uvDobjGetPosm = 0x80216FD8; // type:func +uvDobjState = 0x8021711C; // type:func +uvDobjSetState = 0x80217268; // type:func +uvDobjClearState = 0x802172C0; // type:func +uvDobjAllocIdx = 0x8021731C; // type:func +uvDobjInit = 0x80217398; // type:func +_uvDobjsDraw = 0x8021744C; // type:func +uvDobj_8021771C = 0x8021771C; // type:func +uvDobjGetLODIndex = 0x80217AB4; // type:func +uvDobj_80217B34 = 0x80217B34; // type:func +uvDobj_80217B4C = 0x80217B4C; // type:func +uvDobj_80217E24 = 0x80217E24; // type:func +uvDobj_802180DC = 0x802180DC; // type:func +uvEnvProps = 0x802181C0; // type:func +uvEnvProps2 = 0x80218470; // type:func +uvEnvFunc = 0x80218688; // type:func +_uvEnvDraw = 0x8021872C; // type:func +uvSeqModel = 0x80218D00; // type:func +uvSeqProps = 0x80218DB8; // type:func +uvParseTopUVFT = 0x80219270; // type:func +uvFontSet = 0x802194D8; // type:func +uvFontScale = 0x80219550; // type:func +uvFontColor = 0x8021956C; // type:func +uvFontStrLen = 0x802195A0; // type:func +uvFontStr16WidthFont = 0x802195DC; // type:func +uvFontStr16Width = 0x802196B0; // type:func +uvFontStrWidth = 0x802196EC; // type:func +uvFontWidth = 0x802197EC; // type:func +uvFontHeight = 0x80219828; // type:func +// first diff function: 0x80219874 - likely different uvFontPrintStr16 +uvFontPrintStr16 = 0x80219874; // type:func +// likely different uvFontPrintStr +uvFontPrintStr = 0x80219A1C; // type:func +uvFontSpriteWidth = 0x80219C30; // type:func +uvFontMsgGenDlist = 0x80219D14; // type:func +uvFontGenDlist = 0x80219E18; // type:func + +uvFxProps = 0x8021A4C0; // type:func +uvFxGetProps = 0x8021B4AC; // type:func +uvModelGet = 0x8021B950; // type:func +_uvFxDraw = 0x8021EC98; // type:func + +uvVtxInit = 0x8021F080; // type:func +uvVtx = 0x8021F1E4; // type:func +uvVtxReset = 0x8021F28C; // type:func +uvVtxBeginPoly = 0x8021F2E8; // type:func +uvBeginGrid = 0x8021F2FC; // type:func +uvBeginTmesh = 0x8021F310; // type:func +uvEndTmesh = 0x8021F324; // type:func +uvEndGridWide = 0x8021F4EC; // type:func +uvEndGrid = 0x8021F8EC; // type:func +uvVtxRect = 0x802204AC; // type:func +uvVtxEndPoly = 0x80220640; // type:func + +uvGfxInit = 0x802208E0; // type:func +uvGfxBegin = 0x80220B08; // type:func +uvGfxSetFogFactor = 0x80220C20; // type:func +uvGfxResetState = 0x80220D8C; // type:func +uvGfxMtxView = 0x80220EAC; // type:func +uvGfxMtxProj = 0x80220F78; // type:func +uvGfxDisplayList = 0x80221044; // type:func +uvGfxStateDrawDL = 0x80221068; // type:func +uvGfxStateDraw = 0x80221318; // type:func +uvGfxPushMtxUnk = 0x802219A4; // type:func +uvGfxClampLook = 0x80221A60; // type:func +uvGfxLookAt = 0x80221EB8; // type:func +uvGfxMtxProjPushF = 0x8022202C; // type:func +uvGfxSetCallback = 0x8022209C; // type:func +uvGfxEnd = 0x802220A8; // type:func +uvGfxClearScreen = 0x8022281C; // type:func +uvGfx_80222A98 = 0x802229C4; // type:func +uvGfxEnableZBuffer = 0x80222BC0; // type:func +uvGfxEnableCull = 0x80222CA4; // type:func +uvGfxEnableLighting = 0x80222DBC; // type:func +uvGfxClipRect = 0x80222E14; // type:func +uvGfxClipViewport = 0x80222FC0; // type:func +uvGfxSetViewport = 0x80222FF8; // type:func +uvGfxViewport = 0x80223040; // type:func +uvGfxMstackPushF = 0x80223168; // type:func +uvGfxMstackPushL = 0x80223208; // type:func +uvGfxMstackTop = 0x802232F0; // type:func +uvGfxSetUnkStateF = 0x80223334; // type:func +uvGfxGetUnkStateF = 0x80223340; // type:func +uvGfxMtxViewLoad = 0x80223388; // type:func +uvGfxMtxViewMul = 0x80223420; // type:func +uvGfx_802235A4 = 0x802234D0; // type:func +uvGfxMtxViewPop = 0x802235D4; // type:func +uvGfx_802236CC = 0x802235F8; // type:func +uvGfxGetCnt = 0x8022372C; // type:func +uvGfxStatePush = 0x80223818; // type:func +uvGfxStatePop = 0x80223878; // type:func +uvGfxSetFlags = 0x802238E0; // type:func +uvGfxClearFlags = 0x80223918; // type:func +uvGfxBindTexture = 0x80223954; // type:func +uvGfxTextureDL = 0x80223990; // type:func +uvGfxWaitForMesg = 0x80223AAC; // type:func +uvGfxEnableGamma = 0x80223AE4; // type:func +uvGfxSetUnkState0 = 0x80223B20; // type:func +uvGfx_80223C00 = 0x80223B2C; // type:func +uvCopyFrameBuf = 0x80223D18; // type:func + +uvFileReadHeader = 0x80223DB0; // type:func +uvFile_80223F30 = 0x80223E60; // type:func +uvFileGetCurLength = 0x80223E84; // type:func +uvFileGetCurTag = 0x80223E98; // type:func +uvFileReadBlock = 0x80223EAC; // type:func +uvFile_80224170 = 0x802240A0; // type:func +uvFile_8022427C = 0x802241AC; // type:func + +uvControllerInit = 0x802241D0; // type:func +uvControllerCheckInserted = 0x8022438C; // type:func +uvIOUpdate = 0x802243B8; // type:func +uvControllerUpdate = 0x80224478; // type:func +uvControllerGetStick = 0x802244BC; // type:func +uvControllerButtonCheck = 0x802244E0; // type:func +uvControllerGetButton = 0x80224518; // type:func +uvControllerButtonPress = 0x80224534; // type:func +uvControllerButtonRelease = 0x80224580; // type:func + +uvMemInitBlockHdr = 0x802245D0; // type:func +uvMemLoadDS = 0x802249C0; // type:func +uvMemLoadPal = 0x80224BAC; // type:func +uvLevelAppend = 0x80224C10; // type:func +uvConsumeBytes = 0x802252C4; // type:func +_uvParseUVLT = 0x802253A0; // type:func +_uvParseUVEN = 0x802253E0; // type:func +_uvParseUVSQ = 0x802254D0; // type:func +_uvParseUVMD = 0x802255E8; // type:func +_uvParseUVCT = 0x80225EEC; // type:func +_uvExpandTexture = 0x802264E8; // type:func +_uvExpandTextureImg = 0x80226984; // type:func +_uvExpandTextureCpy = 0x80226A50; // type:func +_uvParseUVTP = 0x80226F00; // type:func +_uvParseUVTR = 0x80226FEC; // type:func +_uvParseUVBT = 0x80227190; // type:func +uvParseTopUVCT = 0x80227734; // type:func +uvParseTopUVEN = 0x802277F0; // type:func +uvParseTopUVLV = 0x80227868; // type:func +uvParseTopUVTP = 0x802278E0; // type:func +uvParseTopUVLT = 0x80227958; // type:func +uvParseTopUVMD = 0x802279D0; // type:func +uvParseTopUVTR = 0x80227A8C; // type:func +uvParseTopUVTX = 0x80227B04; // type:func +uvParseTopUVTI = 0x80227BB4; // type:func +uvParseTopUVBT = 0x80227C64; // type:func +uvParseTopUVSQ = 0x80227D14; // type:func +func_80227E5C = 0x80227D8C; // type:func + +_uvDbMstackReset = 0x80227E60; // type:func +_uvDbMstackTop = 0x80227E70; // type:func +_uvDbMstackPush = 0x80227E8C; // type:func +_uvDbMstackPop = 0x80227F14; // type:func +uvMat4Copy = 0x80227F58; // type:func +uvMat4CopyXYZ = 0x80227FDC; // type:func +uvMat4CopyL = 0x80228028; // type:func +uvMat4CopyL2F = 0x802280B0; // type:func +uvMat4CopyF2L = 0x80228370; // type:func +uvMat4SetIdentity = 0x80228884; // type:func +uvMat4SetIdentityL = 0x802288D4; // type:func +uvMat4Mul = 0x80228920; // type:func +uvMat4MulBA = 0x80228D60; // type:func +uvMat4RotateAxis = 0x802291A0; // type:func +uvMat4LocalTranslate = 0x80229588; // type:func +uvMat4Scale = 0x802296C8; // type:func +uvMat4InvertTranslationRotation = 0x802297A8; // type:func +uvMat4LocalToWorld = 0x80229934; // type:func +uvMat4UnkOp6 = 0x802299D0; // type:func +uvMat4SetFrustrum = 0x80229B40; // type:func +uvMat4SetOrtho = 0x80229C04; // type:func +uvMat4SetQuaternionRotation = 0x80229CA8; // type:func + +uvSqrtF = 0x80229DD0; // type:func +uvSinF = 0x80229DF0; // type:func +uvCosF = 0x80229FB0; // type:func +uvLength2D = 0x8022A138; // type:func +uvLength3D = 0x8022A16C; // type:func +uvAtan2F = 0x8022A1AC; // type:func + +uvMemInitBlocks = 0x8022A2F0; // type:func +uvMemScanBlocks = 0x8022A424; // type:func +_uvJumpHeap = 0x8022A5A4; // type:func +_uvMediaCopy = 0x8022A690; // type:func +uvMemRead = 0x8022A810; // type:func +uvMemSet = 0x8022A9B0; // type:func +uvMemCmp = 0x8022A9E4; // type:func +_uvMemOverAlloc = 0x8022AA3C; // type:func +_uvMemAlloc = 0x8022AB78; // type:func +_uvMemFreeScratch = 0x8022AC88; // type:func +_uvMemGetScratch = 0x8022ACF4; // type:func +_uvMemGetBlocks = 0x8022ADA0; // type:func +uvLevelInit = 0x8022AE34; // type:func +_uvMemAllocAlign8 = 0x8022AFA8; // type:func + +_uvScDoneGfx = 0x8022B250; // type:func +_uvScDoneAud = 0x8022B348; // type:func +_uvScRunAud = 0x8022B3E4; // type:func +_uvScRunGfx = 0x8022B468; // type:func +_uvScDlistRecover = 0x8022B58C; // type:func +_uvScCreateScheduler = 0x8022B5FC; // type:func +_uvScAddClient = 0x8022B7D8; // type:func +_uvScGetCmdQ = 0x8022B7EC; // type:func +_uvScMain = 0x8022B7F4; // type:func +_uvScHandleRetrace = 0x8022B8F8; // type:func +_uvScHandleRSP = 0x8022BC18; // type:func +_uvScHandleRDP = 0x8022BD5C; // type:func +_uvScHandleNMI = 0x8022BDBC; // type:func +_uvScLogCpuEvent = 0x8022BDF4; // type:func +_uvScLogIntoRing = 0x8022C198; // type:func + +uvSobjsDraw = 0x8022C410; // type:func +uvSobjGetLODIndex = 0x8022C6E8; // type:func +uvSobj_8022C8D0 = 0x8022C800; // type:func +uvSobj_8022CC28 = 0x8022CB58; // type:func +uvSobjLoadTerra = 0x8022CE28; // type:func +uvSobjPosm = 0x8022CEF4; // type:func +uvSobj_8022D168 = 0x8022D098; // type:func +uvSobj_8022D1E4 = 0x8022D114; // type:func +uvSobjModel = 0x8022D148; // type:func + +uvStrchr = 0x8022D1E0; // type:func +uvStrlen = 0x8022D230; // type:func +uvStrcmp = 0x8022D268; // type:func +strFormatInt = 0x8022D404; // type:func +strFormatFloat = 0x8022D740; // type:func +strDigitToChar = 0x8022D970; // type:func +strCharToDigit = 0x8022D99C; // type:func +uvSprintf = 0x8022D9CC; // type:func +uvAtoi = 0x8022DD94; // type:func + +uvFileWrite = 0x8022DE20; // type:func +uvFileRead = 0x8022DF18; // type:func +uvSysInit = 0x8022E010; // type:func +uvWaitForMesg = 0x8022E20C; // type:func +uvSetVideoMode = 0x8022E29C; // type:func +Thread_Render = 0x8022E740; // type:func +Thread_App = 0x8022E7F0; // type:func +Thread_Kernel = 0x8022E850; // type:func +uvContMesgInit = 0x8022E950; // type:func +uvReadController = 0x8022EA08; // type:func +_uvDebugPrintf = 0x8022EBE4; // type:func +_uvDMA = 0x8022EC00; // type:func +_uvAssertMsg = 0x8022ED2C; // type:func + +_uvTerraDraw = 0x8022EF34; // type:func +uvComputeLineEndP = 0x8022F6B8; // type:func + +uvSprt_80230130 = 0x80230000; // type:func +uvSprt_802301A4 = 0x80230074; // type:func +_uvTxtDraw = 0x802301EC; // type:func +uvSprtFromBitmap = 0x80230538; // type:func +uvSprt_80230750 = 0x80230620; // type:func +uvSprtFindFree = 0x80230768; // type:func +uvSprtInit = 0x80230824; // type:func +uvSprtDisplayList = 0x80230A68; // type:func +uvSprtDrawAll = 0x80230C00; // type:func +uvSprtDraw = 0x80230CA4; // type:func +uvSprtSetBlit = 0x80230D38; // type:func +uvSprtGetWidth = 0x80230FF0; // type:func +uvSprtGetHeight = 0x8023100C; // type:func +uvSprtProps = 0x80231028; // type:func +uvSprtUpdateUnk = 0x80231320; // type:func +uvSprtResetUnk = 0x80231388; // type:func + +uvUserFileRead = 0x802313A0; // type:func + +uvRandSeed = 0x802314B0; // type:func +uvRandF_RANLUX = 0x802314BC; // type:func +uvRandF_LCG = 0x80231610; // type:func +uvAbs = 0x80231668; // type:func + +uvVec3Len = 0x80231680; // type:func +uvVec2Dot = 0x802316C0; // type:func +uvVec3Dot = 0x802316E4; // type:func +uvVec3Copy = 0x80231714; // type:func +uvVec3ScalarProj = 0x80231730; // type:func +uvVec3Cross = 0x80231778; // type:func +uvVec3Add = 0x802317D0; // type:func +uvVec3Mul = 0x80231804; // type:func +uvVec3Normal = 0x80231830; // type:func + +mio0_decompress = 0x802318F0; // type:func + +uvDbg_80231AC0 = 0x80231990; // type:func +uvDbg_80231C10 = 0x80231AE0; // type:func +uvDbg_80231C9C = 0x80231B6C; // type:func +uvDbg_80231F04 = 0x80231DD4; // type:func +uvDbg_8023217C = 0x8023204C; // type:func +uvDbg_802323A8 = 0x80232278; // type:func +uvDbg_80232554 = 0x80232424; // type:func +uvDbg_80232738 = 0x80232608; // type:func +uvDbg_8023286C = 0x8023273C; // type:func +uvDbg_80232EBC = 0x80232D8C; // type:func +uvDbg_80232ECC = 0x80232D9C; // type:func +uvDbg_80233310 = 0x802331E0; // type:func +uvDbg_802333AC = 0x8023327C; // type:func +uvDbg_8023345C = 0x8023332C; // type:func +uvDbgCnt = 0x802333B4; // type:func +uvDbg_80233590 = 0x80233460; // type:func +uvDbg_80233810 = 0x802336E0; // type:func +uvDbg_80233878 = 0x80233748; // type:func +uvDbg_802338A8 = 0x80233778; // type:func +uvDbg_802339B0 = 0x80233880; // type:func +uvDbg_80233A40 = 0x80233910; // type:func +uvDbg_80233D04 = 0x80233BD4; // type:func +uvDbg_80233DB8 = 0x80233C88; // type:func +uvDbg_80233FC8 = 0x80233E98; // type:func + +alSndpSetSound = 0x80234370; // type:func +alSndpGetState = 0x80234390; // type:func +alSndpStop = 0x802343B0; // type:func +alSndpDeallocate = 0x80234400; // type:func +alSndpAllocate = 0x80234450; // type:func +alSndpPlay = 0x802344F0; // type:func +alSndpSetVol = 0x80234560; // type:func +alSndpSetPitch = 0x802345C0; // type:func +alSndpSetFXMix = 0x80234620; // type:func +alSndpSetPan = 0x80234680; // type:func +alHeapInit = 0x802346E0; // type:func +alSndpNew = 0x80234CF4; // type:func +__CSPPostNextSeqEvent = 0x80234E30; // type:func +alCSPNew = 0x80235EF0; // type:func +osSendMesg = 0x80236060; // type:func +alHeapDBAlloc = 0x802361B0; // type:func +alBnkfNew = 0x80236314; // type:func +alSeqFileNew = 0x80236418; // type:func +osAiSetFrequency = 0x80236460; // type:func +alUnlink = 0x802365C0; // type:func +alLink = 0x802365F0; // type:func +alClose = 0x80236614; // type:func +alInit = 0x8023664C; // type:func +osCreateMesgQueue = 0x80236680; // type:func +osCreateThread = 0x802366B0; // type:func +osStartThread = 0x80236800; // type:func +osRecvMesg = 0x80236950; // type:func +osVirtualToPhysical = 0x80236A90; // type:func +osAiSetNextBuffer = 0x80236B10; // type:func +osAiGetLength = 0x80236BC0; // type:func +_timeToSamples = 0x80236BD8; // type:func +_freePVoice = 0x80236C30; // type:func +_collectPVoices = 0x80236C68; // type:func +__freeParam = 0x80236CC8; // type:func +__allocParam = 0x80236CE0; // type:func +alAudioFrame = 0x80236D18; // type:func +alSynNew = 0x80236FA0; // type:func +osPiStartDma = 0x802372A0; // type:func +alSeqpSetBank = 0x802373B0; // type:func +alSeqpGetState = 0x802373F0; // type:func +alCSeqGetLoc = 0x80237400; // type:func +alCSeqSetLoc = 0x802374A0; // type:func +alCSeqNextEvent = 0x80237664; // type:func +alCSeqNew = 0x8023795C; // type:func +alCSeqNewMarker = 0x80237A70; // type:func +alCSeqGetTicks = 0x80237BDC; // type:func +alCSeqSecToTicks = 0x80237BE4; // type:func +alCSeqTicksToSec = 0x80237CE0; // type:func +__alCSeqNextDelta = 0x80237D4C; // type:func +alSeqpSetSeq = 0x80237EC0; // type:func +alSeqpPlay = 0x80237F00; // type:func +alSeqpSetTempo = 0x80237F30; // type:func +alSeqpSetVol = 0x80237FA0; // type:func +alSeqpStop = 0x80237FE0; // type:func +osGetCount = 0x80238010; // type:func +spFinish = 0x80238020; // type:func +spDraw = 0x80239784; // type:func +spInit = 0x8023A4F0; // type:func +spScissor = 0x8023A61C; // type:func +spMove = 0x8023A640; // type:func +spColor = 0x8023A650; // type:func +spScale = 0x8023A680; // type:func +sqrtf = 0x8023A6F0; // type:func +osViBlack = 0x8023A700; // type:func +osWritebackDCache = 0x8023A770; // type:func +osViSetSpecialFeatures = 0x8023A7F0; // type:func + +__ull_rshift = 0x8023A9B0; // type:func +__ull_rem = 0x8023A9DC; // type:func +__ull_div = 0x8023AA18; // type:func +__ll_lshift = 0x8023AA54; // type:func +__ll_rem = 0x8023AA80; // type:func +__ll_div = 0x8023AABC; // type:func +__ll_mul = 0x8023AB18; // type:func +__ull_divremi = 0x8023AB48; // type:func +__ll_mod = 0x8023ABA8; // type:func +__ll_rshift = 0x8023AC44; // type:func + +osPiReadIo = 0x8023AC70; // type:func +osViSwapBuffer = 0x8023ACF0; // type:func +osWritebackDCacheAll = 0x8023AD40; // type:func +osSpTaskLoad = 0x8023AE8C; // type:func +osSpTaskStartGo = 0x8023AFEC; // type:func +osViGetCurrentFramebuffer = 0x8023B030; // type:func +osViGetNextFramebuffer = 0x8023B070; // type:func +osCreateViManager = 0x8023B0B0; // type:func +viMgrMain = 0x8023B234; // type:func +osViSetMode = 0x8023B410; // type:func +osSetEventMesg = 0x8023B480; // type:func +osViSetEvent = 0x8023B4F0; // type:func +osSpTaskYield = 0x8023B560; // type:func +osSpTaskYielded = 0x8023B580; // type:func +osEepromLongWrite = 0x8023B600; // type:func +osEepromLongRead = 0x8023B740; // type:func +osEepromProbe = 0x8023B880; // type:func +osInitialize = 0x8023B8F0; // type:func +osPiRawReadIo = 0x8023BB20; // type:func +__osGetCurrFaultedThread = 0x8023BB80; // type:func +osCreatePiManager = 0x8023BB90; // type:func +osSetThreadPri = 0x8023BD10; // type:func +osSetTimer = 0x8023BDF0; // type:func +osContInit = 0x8023BED0; // type:func +__osContGetInitData = 0x8023C0CC; // type:func +__osPackRequestData = 0x8023C19C; // type:func +osContStartReadData = 0x8023C290; // type:func +osContGetReadData = 0x8023C354; // type:func +osInvalDCache = 0x8023C4F0; // type:func +lldiv = 0x8023C5A0; // type:func +ldiv = 0x8023C6A0; // type:func +alEvtqFlushType = 0x8023C730; // type:func +alEvtqFlush = 0x8023C7DC; // type:func +alEvtqPostEvent = 0x8023C84C; // type:func +alEvtqNextEvent = 0x8023C970; // type:func +alEvtqNew = 0x8023C9FC; // type:func +alSynAddPlayer = 0x8023CA70; // type:func +_allocatePVoice = 0x8023CAC0; // type:func +alSynAllocVoice = 0x8023CBA8; // type:func +alSynStartVoice = 0x8023CCF0; // type:func +alSynSetPan = 0x8023CD80; // type:func +alSynSetVol = 0x8023CE10; // type:func +alSynSetPitch = 0x8023CEB0; // type:func +alSynSetFXMix = 0x8023CF40; // type:func +alSynStopVoice = 0x8023CFE0; // type:func +alSynFreeVoice = 0x8023D060; // type:func +osSetIntMask = 0x8023D110; // type:func +__setInstChanState = 0x8023D170; // type:func +__resetPerfChanState = 0x8023D1C4; // type:func +__initFromBank = 0x8023D244; // type:func +__vsDelta = 0x8023D300; // type:func +__vsVol = 0x8023D324; // type:func +__seqpReleaseVoice = 0x8023D3AC; // type:func +__voiceNeedsNoteKill = 0x8023D4D8; // type:func +__unmapVoice = 0x8023D580; // type:func +__postNextSeqEvent = 0x8023D5F0; // type:func +__vsPan = 0x8023D744; // type:func +__lookupVoice = 0x8023D78C; // type:func +__mapVoice = 0x8023D800; // type:func +__lookupSoundQuick = 0x8023D870; // type:func +__seqpStopOsc = 0x8023E7B0; // type:func +__initChanState = 0x8023E8B4; // type:func +alSeqpNew = 0x8023E924; // type:func +alCents2Ratio = 0x8023EAB0; // type:func +alSynStartVoiceParams = 0x8023EB00; // type:func +__osDisableInt = 0x8023EBF0; // type:func +__osRestoreInt = 0x8023EC10; // type:func +__osDequeueThread = 0x8023EC30; // type:func +__osExceptionPreamble = 0x8023EC70; // type:func +__osException = 0x8023EC80; // type:func +send_mesg = 0x8023F1C8; // type:func +handle_CpU = 0x8023F27C; // type:func +__osEnqueueAndYield = 0x8023F2B0; // type:func +__osEnqueueThread = 0x8023F340; // type:func +__osPopThread = 0x8023F388; // type:func +__osDispatchThread = 0x8023F398; // type:func +__osCleanupThread = 0x8023F4D8; // use_non_matching_label:False +__osViInit = 0x8023F4E0; // type:func +alSynDelete = 0x8023F5F0; // type:func +__osProbeTLB = 0x8023F600; // type:func +__osAiDeviceBusy = 0x8023F6C0; // type:func +alSaveNew = 0x8023F6F0; // type:func +alResampleNew = 0x8023F7DC; // type:func +alLoadNew = 0x8023F864; // type:func +alEnvmixerNew = 0x8023F90C; // type:func +init_lpfilter = 0x8023F9B0; // type:func +alFxNew = 0x8023FA50; // type:func +alSynAllocFX = 0x8023FE70; // type:func +alMainBusParam = 0x8023FF10; // type:func +alMainBusPull = 0x8023FF40; // type:func +alLoadParam = 0x80240060; // type:func +alRaw16Pull = 0x80240234; // type:func +alAdpcmPull = 0x8024070C; // type:func +alResampleParam = 0x80240BB0; // type:func +alResamplePull = 0x80240C9C; // type:func +_ldexpf = 0x80240EB0; // type:func +_frexpf = 0x80240ED8; // type:func +alEnvmixerParam = 0x80240FC4; // type:func +alEnvmixerPull = 0x802415BC; // type:func +alAuxBusParam = 0x80241B10; // type:func +alAuxBusPull = 0x80241B40; // type:func +alSaveParam = 0x80241C20; // type:func +alSavePull = 0x80241C54; // type:func +osJamMesg = 0x80241CE0; // type:func +osPiGetCmdQueue = 0x80241E30; // type:func +spClearAttribute = 0x80241E60; // type:func +spSetAttribute = 0x80241E80; // type:func +__osPiCreateAccessQueue = 0x80241E90; // type:func +__osPiGetAccess = 0x80241EE0; // type:func +__osPiRelAccess = 0x80241F24; // type:func +bcopy = 0x80241F50; // type:func +__osSpSetStatus = 0x80242260; // type:func +__osSpSetPc = 0x80242270; // type:func +__osSpRawStartDma = 0x802422B0; // type:func +__osSpDeviceBusy = 0x80242340; // type:func +__osTimerServicesInit = 0x80242370; // type:func +__osTimerInterrupt = 0x802423FC; // type:func +__osSetTimerIntr = 0x80242574; // type:func +__osInsertTimer = 0x802425E8; // type:func +osGetThreadPri = 0x80242770; // type:func +__osViGetCurrentContext = 0x80242790; // type:func +__osViSwapContext = 0x802427A0; // type:func +__osSpGetStatus = 0x80242B00; // type:func +osEepromWrite = 0x80242B10; // type:func +__osPackEepWriteData = 0x80242CC0; // type:func +__osEepStatus = 0x80242DCC; // type:func +osEepromRead = 0x80242FF0; // type:func +__osPackEepReadData = 0x802431E0; // type:func +__osSiCreateAccessQueue = 0x802432F0; // type:func +__osSiGetAccess = 0x80243340; // type:func +__osSiRelAccess = 0x80243384; // type:func +__osSetSR = 0x802433B0; // type:func +__osGetSR = 0x802433C0; // type:func +__osSetFpcCsr = 0x802433D0; // type:func +__osSiRawReadIo = 0x802433E0; // type:func +__osSiRawWriteIo = 0x80243430; // type:func +osInvalICache = 0x80243480; // type:func +osMapTLBRdb = 0x80243500; // type:func +bzero = 0x80243560; // type:func +osPiRawStartDma = 0x80243600; // type:func +__osDevMgrMain = 0x802436E0; // type:func +osGetTime = 0x80243860; // type:func +__osSiRawStartDma = 0x802438F0; // type:func +alCopy = 0x802439A0; // type:func +alSeqGetLoc = 0x80243A20; // type:func +alSeqSetLoc = 0x80243A3C; // type:func +alSeqGetTicks = 0x80243A58; // type:func +alSeqNextEvent = 0x80243AB4; // type:func +alSeqNewMarker = 0x80243C38; // type:func +alSeqSecToTicks = 0x80243D58; // type:func +alSeqTicksToSec = 0x80243E3C; // type:func +__alSeqNextDelta = 0x80243E90; // type:func +alSeqNew = 0x80243F68; // type:func +alSynSetPriority = 0x80244040; // type:func +kdebug_u32_to_string = 0x80244050; // type:func +kdebug_string_to_u32 = 0x80244080; // type:func +kdebug_send_packet = 0x802440D8; // type:func +kdebug_send = 0x80244198; // type:func +kdebug_send_buffer = 0x80244270; // type:func +kdebug_send_thread = 0x802442BC; // type:func +kdebugserver = 0x802442E8; // type:func +__osSyncPutChars = 0x802444D0; // type:func +osDestroyThread = 0x80244600; // type:func +alFilterNew = 0x80244700; // type:func +_doModFunc = 0x80244720; // type:func +_filterBuffer = 0x802447C8; // type:func +_saveBuffer = 0x80244880; // type:func +_loadBuffer = 0x80244A08; // type:func +_loadOutputBuffer = 0x80244B94; // type:func +alFxParamHdl = 0x80244DB8; // type:func +alFxParam = 0x80244FD0; // type:func +alFxPull = 0x80244FE8; // type:func +__osSetCompare = 0x80245330; // type:func +__osSiDeviceBusy = 0x80245340; // type:func +__osGetCause = 0x80245370; // type:func +__osAtomicDec = 0x80245380; // type:func + +// data + +nextDMA = 0x80248B30; +curAcmdList = 0x80248B34; +gAudioHeapStart = 0x80248B3C; +gSeqPlayer = 0x80248B40; +gSndPlayer = 0x80248B44; + +gGfxUnkPtrs = 0x80248C80; +D_80248DD8 = 0x80248C88; + +sFontScaleX = 0x80248D2C; +sFontScaleY = 0x80248D30; +sFontCurId = 0x80248D34; +sFontMsgCount = 0x80248D3C; +sFontSprite = 0x80248CD0; // size:0x44 +sFontColorR = 0x80248D14; +sFontColorG = 0x80248D18; +sFontColorB = 0x80248D1C; +sFontColorA = 0x80248D20; + +gGfxDList1 = 0x80248FF0; +gGfxDList2 = 0x80249060; +gGfxFrameTime = 0x80249088; +D_802491E0 = 0x80249090; +D_802491E4 = 0x80249094; +D_802491E8 = 0x80249098; +gGfxGammaEnabled = 0x8024909C; +gGfxFbCurrPtr = 0x802490A0; +gGfxZBufferEnabled = 0x802490A4; +gGfxCullFrontEnabled = 0x802490A8; +gGfxCullBackEnabled = 0x802490AC; +gGfxSyncNeeded = 0x802490B0; +gGfxBeginFlag = 0x802490B4; +gGfxFogFactor = 0x802490B8; +gGfxFbIndex = 0x802490BC; +gGfxElementCount = 0x802490C0; +gGfxFrameCount = 0x802490C4; +gGfxMstackIdx = 0x802490C8; +gGfxFrameTimeFixed = 0x802490CC; + +gMatrixStackIdx = 0x8024B100; + +gRandLcgState = 0x8024B170; +gRanluxState1 = 0x8024B174; +gRanluxState2 = 0x8024B178; + +D_8024B260 = 0x8024B110; + +D_803805E0 = 0x80372FC0; + +alGlobals = 0x8024B630; + +__osViDevMgr = 0x8024B660; // size:0x18 + +osViModeTable = 0x8024B680; // size:0x8c0 + +osClockRate = 0x8024BF40; // size:0x8 +__osShutdown = 0x8024BF48; + +__osPiDevMgr = 0x8024BF50; // size:0x18 + +__osContinitialized = 0x8024BF70; + +__osThreadTail = 0x8024BF80; +__osRunQueue = 0x8024BF88; +__osActiveQueue = 0x8024BF8C; +__osRunningThread = 0x8024BF90; +__osFaultedThread = 0x8024BF94; + +__osPiAccessQueueEnabled = 0x8024C300; + +__osTimerList = 0x8024C310; + +__osRdbSendMessage = 0x8024C340; +__osRdbWriteOK = 0x8024C344; + +osViModeNtscLan1 = 0x8024C350; +osViModePalLan1 = 0x8024C3A0; + +// .bss + +D_80269F50 = 0x80269DC0; // size:0xF0 + +sFontBitmaps = 0x80269EB0; // size:0x190 +sFontDList = 0x8026A040; // size:0x11AC0 +sFontMessages = 0x8027BB00; // size:0x8F0 + +D_8028A0A0 = 0x8027C3F0; + +gGfxTaskOutputBuffer = 0x80288DF0; // size:0x2008 +gGfxTaskOutputBufferStart = 0x8028ADF8; +gGfxTaskOutputBufferEnd = 0x8028ADFC; +gGfxDisplayListHead = 0x8028AE00; +gGfxNumVtxTransforms = 0x8028AE08; +gGfxNumTriangles = 0x8028AE10; +gGfxNumTxtLoads = 0x8028AE18; +gGfxNumMtxLoads = 0x8028AE20; +gGfxNumMtxLoadMults = 0x8028AE28; +gGfxNumLooks = 0x8028AE30; +gGfxLooks = 0x8028AE38; // size:0x780 +gGfxStateStackData = 0x8028B5B8; +gGfxBoundTexture = 0x8028B5BC; +gGfxFbPtrs = 0x8028B5C0; +D_80299278 = 0x8028B5C8; +gGfxDisplayListBase = 0x8028B5D0; // size:0x10680 +gGfxViewports = 0x8029BC50; +gGfxViewX0 = 0x8029BCD0; +gGfxViewX1 = 0x8029BCD2; +gGfxViewY0 = 0x8029BCD4; +gGfxViewY1 = 0x8029BCD6; + +gUVBlockOffsets = 0x802A7740; // size:0x1A40 + +gSchedInst = 0x802B5BF8; +D_802C3B50 = 0x802B5EA0; +D_802C3B68 = 0x802B5EB8; +D_802C3B90 = 0x802B5EE0; +gSchedClient = 0x802B7EF8; + +__osThreadSave = 0x802BCAA0; +__osEventStateTab = 0x802BB5F0; + +// app functions + +app_entrypoint = 0x80302690; // type:func diff --git a/config/us/pilotwings64.us.yaml b/config/us/pilotwings64.us.yaml index b318bfc9..319dc08c 100644 --- a/config/us/pilotwings64.us.yaml +++ b/config/us/pilotwings64.us.yaml @@ -3,7 +3,7 @@ sha1: ec771aedf54ee1b214c25404fb4ec51cfd43191a options: basename: pilotwings64 target_path: baserom.us.z64 - elf_path: build/pilotwings64.elf + elf_path: build/pilotwings64.us.elf base_path: ../.. platform: n64 compiler: IDO diff --git a/decomp.yaml b/decomp.yaml index 27e6b8e8..fd61a65a 100644 --- a/decomp.yaml +++ b/decomp.yaml @@ -14,6 +14,18 @@ versions: expected_dir: "expected" asm: "asm" nonmatchings: "asm/nonmatchings" +- name: jp + fullname: JP + sha1: 892a5472d9a6811b881d093020de81f72baeeec9 + paths: + target: "baserom.jp.z64" + build_dir: "build" + map: "build/pilotwings64.jp.map" + compiled_target: "build/pilotwings64.jp.z64" + elf: "build/pilotwings64.jp.elf" + expected_dir: "expected" + asm: "asm" + nonmatchings: "asm/nonmatchings" tools: decompme: @@ -48,4 +60,3 @@ tools: name: libultra paths: - ultralib - diff --git a/include/kernel/uv_graphics.h b/include/kernel/uv_graphics.h index 402f1159..1af49517 100644 --- a/include/kernel/uv_graphics.h +++ b/include/kernel/uv_graphics.h @@ -277,7 +277,7 @@ typedef struct ParsedUVSQ { u8 mode; u8 reverse; f32 framerate; -} ParsedUVSQ; +} ParsedUVSQ; // size = 0x10 typedef struct { Vec4F unk0; @@ -302,14 +302,20 @@ typedef struct { u8 unk9; } ParsedUVAN; + +#if defined(VERSION_JP) + #define UVFT_IMAG_SIZE 0x28 +#elif defined(VERSION_US) + #define UVFT_IMAG_SIZE 0x2C +#endif typedef struct ParsedUVFT { char* str; u8 pad4[0x4]; u8 bmfmt; u8 bmsiz; Bitmap* bitmap; - void* imag[0x2C]; -} ParsedUVFT; // size = 0x80 + void* imag[UVFT_IMAG_SIZE]; +} ParsedUVFT; // size = JP:0xB0, US:0xC0 typedef struct uvGfxUnkStructFont { char* unk0; diff --git a/src/kernel/font.c b/src/kernel/font.c index 58b36b23..5aa9f7c5 100644 --- a/src/kernel/font.c +++ b/src/kernel/font.c @@ -5,7 +5,16 @@ #include #include +#if defined(VERSION_JP) +#define FONT_MAX_MSG_LEN 25 +#define FONT_DL_COUNT 4524 +#elif defined(VERSION_US) #define FONT_MAX_MSG_LEN 44 +#define FONT_DL_COUNT 7944 +#else +#error Unknown build VERSION +#endif +#define FONT_MSG_COUNT 30 // struct containing a printed string's font data // contains position, scale, color, string, pointer to font @@ -20,43 +29,43 @@ typedef struct Unk80289380 { u8 a; s16 str16[FONT_MAX_MSG_LEN]; ParsedUVFT* font; -} FontMessage; // size = 0x70 +} FontMessage; // size = JP:0x4C US:0x70 STATIC_DATA Bitmap sFontBitmaps[FONT_MAX_MSG_LEN]; -STATIC_DATA Gfx sFontDList[7944 * 2]; -STATIC_DATA FontMessage sFontMessages[30]; +STATIC_DATA Gfx sFontDList[FONT_DL_COUNT * 2]; +STATIC_DATA FontMessage sFontMessages[FONT_MSG_COUNT]; STATIC_DATA Sprite sFontSprite = { - 0, // x - 0, // y - 0, // width - 0, // height - 1.0f, // scalex - 1.0f, // scaley - 0, // expx - 0, // expy - 1, // attr - 0x1234, // zdepth - 255, // red - 255, // green - 255, // blue - 255, // alpha - 0, // startTLUT - 0, // nTLUT - NULL, // LUT - 0, // istart - 1, // istep - 660, // nbitmaps - 7944, // ndisplist - 15, // bmheight - 128, // bmHreal - G_IM_FMT_IA, // bmfmt - G_IM_SIZ_4b, // bmsiz - sFontBitmaps, // bitmap - sFontDList, // rsp_dl - NULL, // rsp_dl_next - 0, // frac_s - 0 // frac_t + 0, // x + 0, // y + 0, // width + 0, // height + 1.0f, // scalex + 1.0f, // scaley + 0, // expx + 0, // expy + 1, // attr + 0x1234, // zdepth + 255, // red + 255, // green + 255, // blue + 255, // alpha + 0, // startTLUT + 0, // nTLUT + NULL, // LUT + 0, // istart + 1, // istep + 15 * FONT_MAX_MSG_LEN, // nbitmaps + FONT_DL_COUNT, // ndisplist + 15, // bmheight + 128, // bmHreal + G_IM_FMT_IA, // bmfmt + G_IM_SIZ_4b, // bmsiz + sFontBitmaps, // bitmap + sFontDList, // rsp_dl + NULL, // rsp_dl_next + 0, // frac_s + 0 // frac_t }; STATIC_DATA u8 sFontColorR = 0xFF; @@ -66,11 +75,11 @@ STATIC_DATA u8 sFontColorA = 0xFF; STATIC_DATA UNUSED s32 D_80248E74 = 0; STATIC_DATA UNUSED s32 D_80248E78 = 0; -STATIC_DATA f32 sFontScaleX = 1.0f; -STATIC_DATA f32 sFontScaleY = 1.0f; -STATIC_DATA u32 sFontCurId = 0; +f32 sFontScaleX = 1.0f; +f32 sFontScaleY = 1.0f; +u32 sFontCurId = 0; STATIC_DATA u32 sFontCurWidth = 8; -STATIC_DATA s32 sFontMsgCount = 0; +s32 sFontMsgCount = 0; ParsedUVFT* uvParseTopUVFT(s32 arg0) { ParsedUVFT* ret; @@ -218,6 +227,9 @@ s32 uvFontHeight(void) { return font->bitmap[1].actualHeight * sFontScaleY; } +#if defined(VERSION_JP) +#pragma GLOBAL_ASM("asm/nonmatchings/kernel/font/uvFontPrintStr16.s") +#else // adds str16 to messages using current font settings s32 uvFontPrintStr16(s32 x, s32 y, s16* str16, s32 strLen, s32 end) { s32 i16; @@ -296,6 +308,7 @@ s32 uvFontPrintStr16(s32 x, s32 y, s16* str16, s32 strLen, s32 end) { } return ret; } +#endif void uvFontPrintStr(s32 x, s32 y, const char* str) { char* chrPos; @@ -389,7 +402,7 @@ void uvFontGenDlist(void) { D_80248E94 = gGfxFbIndex; } spInit(&gGfxDisplayListHead); - sFontSprite.rsp_dl_next = &sFontSprite.rsp_dl[(gGfxFbIndex * 7944) + D_80248E90]; + sFontSprite.rsp_dl_next = &sFontSprite.rsp_dl[(gGfxFbIndex * FONT_DL_COUNT) + D_80248E90]; for (i = 0; i < sFontMsgCount; i++) { uvFontMsgGenDlist(&sFontMessages[i]); diff --git a/src/kernel/fx_seq.c b/src/kernel/fx_seq.c index 85750f4f..5369a01e 100644 --- a/src/kernel/fx_seq.c +++ b/src/kernel/fx_seq.c @@ -10,7 +10,7 @@ typedef struct uvSeqState { u8 currFrame; f32 frameTime; ParsedUVSQ uvsq; -} uvSeqState; +} uvSeqState; // size = 0x18 uvSeqState gSeqStateTable[10]; diff --git a/src/kernel/graphics.c b/src/kernel/graphics.c index c546940a..58468abf 100644 --- a/src/kernel/graphics.c +++ b/src/kernel/graphics.c @@ -228,6 +228,9 @@ void uvGfxStateDrawDL(uvGfxState_t* arg0) { gGfxNumTriangles[gGfxFbIndex] += arg0->triCount * 2; } +#if defined(VERSION_JP) +#pragma GLOBAL_ASM("asm/nonmatchings/kernel/graphics/uvGfxStateDraw.s") +#else void uvGfxStateDraw(uvGfxState_t* arg0) { u32 clearMode; u32 setMode; @@ -423,6 +426,7 @@ void uvGfxStateDraw(uvGfxState_t* arg0) { gGfxNumTriangles[gGfxFbIndex] += arg0->triCount; } } +#endif void uvGfxPushMtxUnk(Mtx4F* arg0) { Mtx spC8; diff --git a/src/kernel/system.c b/src/kernel/system.c index 042cf8f4..d2d020af 100644 --- a/src/kernel/system.c +++ b/src/kernel/system.c @@ -187,6 +187,11 @@ void uvWaitForMesg(char msg_type) { } void uvSetVideoMode(void) { +#if defined(VERSION_JP) + osCreateMesgQueue(&D_802C3B90, D_802C3B68, ARRAY_COUNT(D_802C3B68)); + _uvScCreateScheduler(&gSchedInst, gSchedStack + sizeof(gSchedStack), OS_PRIORITY_APPMAX, OS_VI_NTSC_LAN1, 1); + _uvScAddClient(&gSchedInst, &gSchedClient, &D_802C3B50); +#else s32 viMode; osCreateMesgQueue(&D_802C3B90, D_802C3B68, ARRAY_COUNT(D_802C3B68)); @@ -205,6 +210,7 @@ void uvSetVideoMode(void) { // clang-format on _uvScCreateScheduler(&gSchedInst, gSchedStack + sizeof(gSchedStack), OS_PRIORITY_APPMAX, viMode, 1); _uvScAddClient(&gSchedInst, &gSchedClient, &D_802C3B50); +#endif } void bootproc(void* arg0) { diff --git a/src/libultra/io/vi.c b/src/libultra/io/vi.c index 0050fbee..709929b1 100644 --- a/src/libultra/io/vi.c +++ b/src/libultra/io/vi.c @@ -12,7 +12,9 @@ extern OSViMode osViModePalLan1; extern OSViMode osViModeNtscLan1; void __osViInit(void) { +#if !defined(VERSION_JP) sTvType = osTvType; +#endif bzero(sViContexts, sizeof(sViContexts)); __osViCurr = &sViContexts[0]; @@ -20,6 +22,15 @@ void __osViInit(void) { __osViNext->retraceCount = 1; __osViCurr->retraceCount = 1; +#if defined(VERSION_JP) + if (sTvType != 0) { + __osViNext->modep = &osViModeNtscLan1; + osViClock = VI_NTSC_CLOCK; + } else { + __osViNext->modep = &osViModePalLan1; + osViClock = VI_PAL_CLOCK; + } +#else if (sTvType == OS_TV_TYPE_NTSC) { __osViNext->modep = &osViModeNtscLan1; osViClock = VI_NTSC_CLOCK; @@ -27,6 +38,7 @@ void __osViInit(void) { __osViNext->modep = &osViModePalLan1; osViClock = VI_MPAL_CLOCK; } +#endif __osViNext->state = VI_STATE_BLACK; __osViNext->control = __osViNext->modep->comRegs.ctrl; diff --git a/src/libultra/io/vitbl.c b/src/libultra/io/vitbl.c index 91f97421..90deb5f3 100644 --- a/src/libultra/io/vitbl.c +++ b/src/libultra/io/vitbl.c @@ -1,5 +1,569 @@ #include "PR/ultratypes.h" +#if defined(VERSION_JP) +u32 osViModeTable[] = { + 0x00000000, + 0x0000320E, + 0x00000140, + 0x03E52239, + 0x0000020D, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000280, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x00000280, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x01000000, + 0x0000324E, + 0x00000140, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000280, + 0x01000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000280, + 0x03000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x02000000, + 0x0000311E, + 0x00000140, + 0x03E52239, + 0x0000020D, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000280, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x00000280, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x03000000, + 0x0000305E, + 0x00000140, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000280, + 0x01000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000280, + 0x03000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x04000000, + 0x0000330F, + 0x00000140, + 0x03E52239, + 0x0000020D, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000500, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x00000500, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x05000000, + 0x0000324F, + 0x00000140, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000500, + 0x01000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000500, + 0x03000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x06000000, + 0x0000301F, + 0x00000140, + 0x03E52239, + 0x0000020D, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000500, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x00000500, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x07000000, + 0x0000305F, + 0x00000140, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000200, + 0x00000000, + 0x00000500, + 0x01000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000500, + 0x03000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x08000000, + 0x0000324E, + 0x00000500, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000400, + 0x00000000, + 0x00000500, + 0x00000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000A00, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x09000000, + 0x0000324E, + 0x00000280, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000400, + 0x00000000, + 0x00000500, + 0x02000800, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000A00, + 0x02000800, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x0A000000, + 0x0000305E, + 0x00000500, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000400, + 0x00000000, + 0x00000500, + 0x00000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000A00, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x0B000000, + 0x0000305E, + 0x00000280, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000400, + 0x00000000, + 0x00000500, + 0x02000800, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00000A00, + 0x02000800, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x0C000000, + 0x0000334F, + 0x00000500, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000400, + 0x00000000, + 0x00000A00, + 0x00000400, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00001400, + 0x00000400, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x0D000000, + 0x0000324F, + 0x00000280, + 0x03E52239, + 0x0000020C, + 0x00000C15, + 0x0C150C15, + 0x006C02EC, + 0x00000400, + 0x00000000, + 0x00000A00, + 0x02000800, + 0x002301FD, + 0x000E0204, + 0x00000002, + 0x00001400, + 0x02000800, + 0x002501FF, + 0x000E0204, + 0x00000002, + 0x0E000000, + 0x0000320E, + 0x00000140, + 0x0404233A, + 0x00000271, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000280, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x00000280, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x0F000000, + 0x0000324E, + 0x00000140, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000280, + 0x01000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000280, + 0x03000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x10000000, + 0x0000311E, + 0x00000140, + 0x0404233A, + 0x00000271, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000280, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x00000280, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x11000000, + 0x0000305E, + 0x00000140, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000280, + 0x01000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000280, + 0x03000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x12000000, + 0x0000330F, + 0x00000140, + 0x0404233A, + 0x00000271, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000500, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x00000500, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x13000000, + 0x0000324F, + 0x00000140, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000500, + 0x01000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000500, + 0x03000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x14000000, + 0x0000301F, + 0x00000140, + 0x0404233A, + 0x00000271, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000500, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x00000500, + 0x00000400, + 0x005F0239, + 0x0009026B, + 0x00000002, + 0x15000000, + 0x0000305F, + 0x00000140, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000200, + 0x00000000, + 0x00000500, + 0x01000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000500, + 0x03000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x16000000, + 0x0000324E, + 0x00000500, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000400, + 0x00000000, + 0x00000500, + 0x00000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000A00, + 0x00000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x17000000, + 0x0000324E, + 0x00000280, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000400, + 0x00000000, + 0x00000500, + 0x02000800, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000A00, + 0x02000800, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x18000000, + 0x0000305E, + 0x00000500, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000400, + 0x00000000, + 0x00000500, + 0x00000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000A00, + 0x00000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x19000000, + 0x0000305E, + 0x00000280, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000400, + 0x00000000, + 0x00000500, + 0x02000800, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00000A00, + 0x02000800, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x1A000000, + 0x0000334F, + 0x00000500, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000400, + 0x00000000, + 0x00000A00, + 0x00000400, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00001400, + 0x00000400, + 0x005F0239, + 0x000D0269, + 0x00000002, + 0x1B000000, + 0x0000324F, + 0x00000280, + 0x0404233A, + 0x00000270, + 0x00150C69, + 0x0C6F0C6E, + 0x00800300, + 0x00000400, + 0x00000000, + 0x00000A00, + 0x02000800, + 0x005D0237, + 0x0009026B, + 0x00000002, + 0x00001400, + 0x02000800, + 0x005F0239, + 0x000D0269, + 0x00000002, +}; +#else u32 osViModeTable[] = { 0x00000000, 0x0000320E, @@ -562,6 +1126,7 @@ u32 osViModeTable[] = { 0x000E0204, 0x00000002, }; +#endif #if 0 #include "PR/os.h"