├── .clang-format ├── .clang-tidy ├── .editorconfig ├── .gitattributes ├── .github └── workflows │ ├── clang-format-suggest.yml │ ├── clang-format.yml │ ├── clang-pr.yml │ ├── doxygen-and-linux-test.yml │ ├── linux-compile.yml │ ├── macos-compile.yml │ └── windows-compile.yml ├── .gitignore ├── .gitmodules ├── Dockerfile ├── Doxyfile ├── Makefile ├── Makefile.split ├── README.md ├── addr_to_sym.py ├── asm ├── boot.s ├── entry.s ├── mio0_decode.s ├── os │ ├── __osDisableInt.s │ ├── __osException.s │ ├── __osGetSR.s │ ├── __osProbeTLB.s │ ├── __osRestoreInt.s │ ├── __osSetCompare.s │ ├── __osSetFpcCsr.s │ ├── __osSetSR.s │ ├── bcopy.s │ ├── bzero.s │ ├── llmuldiv_gcc.s │ ├── osGetCount.s │ ├── osInvalDCache.s │ ├── osInvalICache.s │ ├── osMapTLBRdb.s │ ├── osSetIntMask.s │ ├── osWritebackDCache.s │ ├── osWritebackDCacheAll.s │ ├── parameters.s │ └── sqrtf.s ├── rom_header.s ├── tkmk00_decode.s ├── unused_mio0_decode.s └── unused_overflow_check.s ├── assets.json ├── assets ├── blueshell.json ├── bomb.json ├── character_portraits.json ├── character_select │ ├── bowser_select.json │ ├── donkeykong_select.json │ ├── luigi_select.json │ ├── mario_select.json │ ├── peach_select.json │ ├── toad_select.json │ ├── wario_select.json │ └── yoshi_select.json ├── course_outlines.json ├── course_previews.json ├── courses │ ├── banshee_boardwalk.json │ ├── bowsers_castle.json │ ├── choco_mountain.json │ ├── dks_jungle_parkway.json │ ├── frappe_snowland.json │ ├── kalimari_desert.json │ ├── koopa_troopa_beach.json │ ├── luigi_raceway.json │ ├── mario_raceway.json │ ├── moo_moo_farm.json │ ├── rainbow_road.json │ ├── royal_raceway.json │ ├── sherbet_land.json │ ├── toads_turnpike.json │ ├── wario_stadium.json │ └── yoshi_valley.json ├── debug_font.json ├── ending_ceremony.json ├── finish_line_banner.json ├── greenshell.json ├── hud_type_c.json ├── include │ ├── blueshell.mk │ ├── bomb.mk │ ├── character_portraits.mk │ ├── character_select │ │ ├── bowser_select.mk │ │ ├── donkeykong_select.mk │ │ ├── luigi_select.mk │ │ ├── mario_select.mk │ │ ├── peach_select.mk │ │ ├── toad_select.mk │ │ ├── wario_select.mk │ │ └── yoshi_select.mk │ ├── course_outlines.mk │ ├── course_previews.mk │ ├── courses │ │ ├── banshee_boardwalk.mk │ │ ├── bowsers_castle.mk │ │ ├── choco_mountain.mk │ │ ├── dks_jungle_parkway.mk │ │ ├── frappe_snowland.mk │ │ ├── kalimari_desert.mk │ │ ├── koopa_troopa_beach.mk │ │ ├── luigi_raceway.mk │ │ ├── mario_raceway.mk │ │ ├── moo_moo_farm.mk │ │ ├── rainbow_road.mk │ │ ├── royal_raceway.mk │ │ ├── sherbet_land.mk │ │ ├── toads_turnpike.mk │ │ ├── wario_stadium.mk │ │ └── yoshi_valley.mk │ ├── debug_font.mk │ ├── ending_ceremony.mk │ ├── finish_line_banner.mk │ ├── greenshell.mk │ ├── hud_type_c.mk │ ├── item_window.mk │ ├── karts │ │ ├── bowser_kart.mk │ │ ├── donkeykong_kart.mk │ │ ├── luigi_kart.mk │ │ ├── mario_kart.mk │ │ ├── peach_kart.mk │ │ ├── toad_kart.mk │ │ ├── wario_kart.mk │ │ └── yoshi_kart.mk │ ├── lakitu │ │ ├── bluelight.mk │ │ ├── checkeredflag.mk │ │ ├── finallap.mk │ │ ├── fishing.mk │ │ ├── nolights.mk │ │ ├── redlights.mk │ │ ├── reverse.mk │ │ └── secondlap.mk │ ├── minimap_icons.mk │ ├── onomatopoeia.mk │ ├── other_textures.mk │ ├── player_emblems.mk │ ├── startup_logo.mk │ ├── trees.mk │ └── unused_traffic_light.mk ├── item_window.json ├── karts │ ├── bowser_kart.json │ ├── donkeykong_kart.json │ ├── luigi_kart.json │ ├── mario_kart.json │ ├── peach_kart.json │ ├── toad_kart.json │ ├── wario_kart.json │ └── yoshi_kart.json ├── lakitu │ ├── bluelight.json │ ├── checkeredflag.json │ ├── finallap.json │ ├── fishing.json │ ├── nolights.json │ ├── redlights.json │ ├── reverse.json │ └── secondlap.json ├── minimap_icons.json ├── onomatopoeia.json ├── player_emblems.json ├── startup_logo.json ├── trees.json └── unused_traffic_light.json ├── config.yml ├── courses ├── all_course_data.h ├── all_course_model.h ├── all_course_offsets.h ├── all_course_packed.h ├── banshee_boardwalk │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── big_donut │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── block_fort │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── bowsers_castle │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── choco_mountain │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── courseTable.c ├── courseTable.h ├── dks_jungle_parkway │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── double_deck │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── frappe_snowland │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── kalimari_desert │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── koopa_troopa_beach │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── luigi_raceway │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ ├── course_vertices.inc.c │ └── staff_ghost.inc.c ├── mario_raceway │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ ├── course_vertices.inc.c │ └── staff_ghost.inc.c ├── moo_moo_farm │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── rainbow_road │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── royal_raceway │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ ├── course_vertices.inc.c │ └── staff_ghost.inc.c ├── sherbet_land │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── skyscraper │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── staff_ghost_data.c ├── toads_turnpike │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── wario_stadium │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c └── yoshi_valley │ ├── course_data.c │ ├── course_data.h │ ├── course_displaylists.inc.c │ ├── course_displaylists.inc.h │ ├── course_offsets.c │ └── course_vertices.inc.c ├── data ├── course_player_selection.s ├── karts │ ├── bowser_kart.s │ ├── donkeykong_kart.s │ ├── luigi_kart.s │ ├── mario_kart.s │ ├── peach_kart.s │ ├── toad_kart.s │ ├── wario_kart.s │ └── yoshi_kart.s ├── other_textures.h ├── other_textures.s ├── rsp.s ├── sound_data │ ├── audiobanks.s │ ├── audiotables.s │ ├── instrument_sets.s │ ├── sequences.s │ └── sequences_eu.s ├── texture_data_2.s └── texture_tkmk00.s ├── diff ├── diff_settings.py ├── docs ├── actors │ ├── actors.md │ ├── items.md │ ├── objects.md │ └── vehicles.md ├── actorsmenu.md ├── basics │ ├── basicconcepts.md │ ├── compiling.md │ ├── controlflow.md │ ├── placeholder.png │ └── terminology.md ├── basicsmenu.md ├── courses │ ├── courses.md │ └── surfacetypes.md ├── coursesmenu.md ├── docs.css ├── header.html ├── html │ └── buttonimage.png ├── images │ └── buttonimage.png ├── mainpage.md ├── tutorials.md └── tutorials │ ├── audio.md │ ├── boostramps.md │ └── paths.md ├── enhancements ├── README.md └── flycam.patch ├── extract_assets.py ├── first-diff.py ├── import ├── include ├── PR │ ├── R4300.h │ ├── abi.h │ ├── gbi.h │ ├── gs2dex.h │ ├── gu.h │ ├── libaudio.h │ ├── libultra.h │ ├── mbi.h │ ├── os.h │ ├── os_ai.h │ ├── os_cache.h │ ├── os_cont.h │ ├── os_eeprom.h │ ├── os_exception.h │ ├── os_internal.h │ ├── os_libc.h │ ├── os_message.h │ ├── os_misc.h │ ├── os_pi.h │ ├── os_rdp.h │ ├── os_thread.h │ ├── os_time.h │ ├── os_tlb.h │ ├── os_vi.h │ ├── rcp.h │ ├── sptask.h │ ├── ucode.h │ └── ultratypes.h ├── actor_types.h ├── bomb_kart.h ├── common_structs.h ├── config.h ├── course.h ├── course_offsets.h ├── debug.h ├── decode.h ├── defines.h ├── kart_attributes.h ├── libc │ ├── math.h │ ├── stdarg.h │ ├── stddef.h │ ├── stdio.h │ ├── stdlib.h │ └── string.h ├── macros.h ├── macros.inc ├── mk64.h ├── objects.h ├── path.h ├── save_data.h ├── segments.h ├── sounds.h ├── spline.h ├── ultra64.h └── vehicles.h ├── m2c_helper.sh ├── mk64.eu.v10.sha1 ├── mk64.eu.v11.sha1 ├── mk64.ld ├── mk64.us.sha1 ├── models ├── README.MD ├── common_textures.json └── tracks │ ├── banshee_boardwalk.json │ ├── banshee_boardwalk.zip │ ├── battle_track.json │ ├── bowsers_castle.json │ ├── choco_mountain.json │ ├── dks_jungle_parkway.json │ ├── frappe_snowland.json │ ├── kalimari_desert.json │ ├── koopa_troopa_beach.json │ ├── luigi_raceway.json │ ├── mario_raceway.json │ ├── moo_moo_farm.json │ ├── rainbow_road.json │ ├── royal_raceway.json │ ├── sherbet_land.json │ ├── toads_turnpike.json │ ├── wario_stadium.json │ └── yoshi_valley.json ├── permute ├── permuter_settings.toml ├── progress.py ├── python_convert.py ├── rename_sym.sh ├── safe_gcc.mk ├── safe_gcc_old.mk ├── src ├── actors │ ├── banana │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── blue_and_red_shells │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── box_truck │ │ └── render.inc.c │ ├── car │ │ └── render.inc.c │ ├── cow │ │ └── render.inc.c │ ├── fake_item_box │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── falling_rock │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── green_shell │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── item_box │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── kiwano_fruit │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── mario_sign │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── paddle_boat │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── palm_tree │ │ └── render.inc.c │ ├── piranha_plant │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── railroad_crossing │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── school_bus │ │ └── render.inc.c │ ├── tanker_truck │ │ └── render.inc.c │ ├── train │ │ ├── render.inc.c │ │ └── update.inc.c │ ├── trees │ │ └── render.inc.c │ ├── wario_sign │ │ ├── render.inc.c │ │ └── update.inc.c │ └── yoshi_egg │ │ ├── render.inc.c │ │ └── update.inc.c ├── animation.c ├── animation.h ├── audio │ ├── audio_session_presets.c │ ├── data.c │ ├── data.h │ ├── effects.c │ ├── effects.h │ ├── external.c │ ├── external.h │ ├── heap.c │ ├── heap.h │ ├── internal.h │ ├── load.c │ ├── load.h │ ├── playback.c │ ├── playback.h │ ├── port_eu.c │ ├── port_eu.h │ ├── seqplayer.c │ ├── seqplayer.h │ ├── synthesis.c │ └── synthesis.h ├── buffers.h ├── buffers │ ├── audio_heap.c │ ├── audio_heap.h │ ├── buffers.c │ ├── gfx_output_buffer.c │ ├── gfx_output_buffer.h │ ├── memory_pool.c │ ├── random.c │ ├── random.h │ ├── trig_tables.c │ ├── trig_tables.h │ └── trig_tables_bss.c ├── camera.c ├── camera.h ├── camera_junk.h ├── code_800029B0.c ├── code_800029B0.h ├── code_8003DC40.c ├── code_8003DC40.h ├── code_80057C60.c ├── code_80057C60.h ├── code_80057C60_var.c ├── code_8006E9C0.c ├── code_8006E9C0.h ├── code_80086E70.c ├── code_80086E70.h ├── code_80091440.c ├── code_80091440.h ├── code_800AF9B0.c ├── code_800AF9B0.h ├── cpu_vehicles_camera_path.c ├── cpu_vehicles_camera_path.h ├── cpu_vehicles_camera_path │ ├── actor_utils.inc.c │ ├── behaviour_utils.inc.c │ ├── bomb_kart.inc.c │ ├── cpu_item_strategy.inc.c │ ├── cpu_speed_control.inc.c │ ├── path_calc.inc.c │ ├── path_utils.inc.c │ └── vehicle_utils.inc.c ├── crash_screen.c ├── crash_screen.h ├── data │ ├── data_segment2.c │ ├── kart_attributes.c │ ├── path_spawn_metadata.c │ ├── path_spawn_metadata.h │ ├── some_data.c │ ├── some_data.h │ └── textures.c ├── data_segment2.h ├── debug │ ├── all_variables.h │ ├── crash_screen_enhancement.c │ ├── crash_screen_enhancement.h │ ├── debug.c │ └── debug.inc.c ├── effects.c ├── effects.h ├── ending │ ├── camera_junk.c │ ├── ceremony_and_credits.c │ ├── ceremony_and_credits.h │ ├── code_80280000.c │ ├── code_80280000.h │ ├── code_80281780.c │ ├── code_80281780.h │ ├── code_80281C40.c │ ├── code_80281C40.h │ ├── credits.c │ ├── credits.h │ ├── dl_unk_80284EE0.c │ ├── podium_ceremony_actors.c │ └── podium_ceremony_actors.h ├── gbiMacro.c ├── kart_dma.c ├── kart_dma.h ├── main.c ├── main.h ├── math_util_2.c ├── math_util_2.h ├── menu_items.c ├── menu_items.h ├── menus.c ├── menus.h ├── os │ ├── NaN.c │ ├── _Ldtob.c │ ├── _Litob.c │ ├── _Printf.c │ ├── __osAiDeviceBusy.c │ ├── __osAtomicDec.c │ ├── __osDequeueThread.c │ ├── __osDevMgrMain.c │ ├── __osEPiRawReadIo.c │ ├── __osEPiRawWriteIo.c │ ├── __osGetCurrFaultedThread.c │ ├── __osLeoInterrupt.c │ ├── __osPiCreateAccessQueue.c │ ├── __osResetGlobalIntMask.c │ ├── __osSetGlobalIntMask.c │ ├── __osSetHWIntrRoutine.c │ ├── __osSiCreateAccessQueue.c │ ├── __osSiDeviceBusy.c │ ├── __osSiRawReadIo.c │ ├── __osSiRawStartDma.c │ ├── __osSiRawWriteIo.c │ ├── __osSpDeviceBusy.c │ ├── __osSpGetStatus.c │ ├── __osSpRawStartDma.c │ ├── __osSpSetPc.c │ ├── __osSpSetStatus.c │ ├── __osSyncPutChars.c │ ├── __osViGetCurrentContext.c │ ├── __osViInit.c │ ├── __osViSwapContext.c │ ├── alBnkfNew.c │ ├── bstring.h │ ├── contpfs.c │ ├── contramread.c │ ├── contramwrite.c │ ├── controller.h │ ├── crc.c │ ├── epidma.c │ ├── guLookAtF.c │ ├── guLookAtRef.c │ ├── guMtxCatF.c │ ├── guMtxCatL.c │ ├── guMtxF2L.c │ ├── guNormalize.c │ ├── guOrthoF.c │ ├── guPerspectiveF.c │ ├── guRotateF.c │ ├── guScaleF.c │ ├── guTranslateF.c │ ├── hardware.h │ ├── is_debug.c │ ├── ldiv.c │ ├── libaudio_internal.h │ ├── libultra_internal.h │ ├── math │ │ ├── cosf.c │ │ ├── llconv.c │ │ ├── llmuldiv.c │ │ └── sinf.c │ ├── new_func.h │ ├── osAi.h │ ├── osAiGetLength.c │ ├── osAiSetFrequency.c │ ├── osAiSetNextBuffer.c │ ├── osCartRomInit.c │ ├── osContInit.c │ ├── osContStartReadData.c │ ├── osCreateMesgQueue.c │ ├── osCreatePiManager.c │ ├── osCreateThread.c │ ├── osCreateViManager.c │ ├── osDestroyThread.c │ ├── osEPiRawStartDma.c │ ├── osEepromLongRead.c │ ├── osEepromLongWrite.c │ ├── osEepromProbe.c │ ├── osEepromRead.c │ ├── osEepromWrite.c │ ├── osGetThreadPri.c │ ├── osGetTime.c │ ├── osInitialize.c │ ├── osJamMesg.c │ ├── osLeoDiskInit.c │ ├── osPfsAllocateFile.c │ ├── osPfsChecker.c │ ├── osPfsDeleteFile.c │ ├── osPfsFileState.c │ ├── osPfsFreeBlocks.c │ ├── osPfsInit.c │ ├── osPfsIsPlug.c │ ├── osPfsNumFiles.c │ ├── osPfsReadWriteFile.c │ ├── osPfsSearchFile.c │ ├── osPiGetCmdQueue.c │ ├── osPiRawReadIo.c │ ├── osPiRawStartDma.c │ ├── osPiStartDma.c │ ├── osRecvMesg.c │ ├── osSendMesg.c │ ├── osSetEventMesg.c │ ├── osSetThreadPri.c │ ├── osSetTime.c │ ├── osSetTimer.c │ ├── osSpTaskLoadGo.c │ ├── osSpTaskYield.c │ ├── osSpTaskYielded.c │ ├── osStartThread.c │ ├── osSyncPrintf.c │ ├── osTimer.c │ ├── osViBlack.c │ ├── osViData.c │ ├── osViSetEvent.c │ ├── osViSetMode.c │ ├── osViSetSpecialFeatures.c │ ├── osViSwapBuffer.c │ ├── osViTable.c │ ├── osVirtualToPhysical.c │ ├── osYieldThread.c │ ├── osint.h │ ├── piint.h │ ├── printf.h │ ├── sprintf.c │ └── string.c ├── player_controller.c ├── player_controller.h ├── profiler.c ├── profiler.h ├── racing │ ├── actors.c │ ├── actors.h │ ├── actors_extended.c │ ├── actors_extended.h │ ├── collision.c │ ├── collision.h │ ├── math_util.c │ ├── math_util.h │ ├── memory.c │ ├── memory.h │ ├── race_logic.c │ ├── race_logic.h │ ├── render_courses.c │ ├── render_courses.h │ ├── skybox_and_splitscreen.c │ └── skybox_and_splitscreen.h ├── render_objects.c ├── render_objects.h ├── render_player.c ├── render_player.h ├── save.c ├── save.h ├── spawn_players.c ├── spawn_players.h ├── staff_ghosts.c ├── staff_ghosts.h ├── textures.h ├── update_objects.c └── update_objects.h ├── test_blend.bat ├── tools ├── .gitignore ├── Makefile ├── apply_patch.sh ├── asm_processor │ ├── asm_processor.py │ ├── build.py │ └── prelude.inc ├── bin2c.py ├── blender │ ├── blender_export.py │ ├── clean_scene.py │ ├── extract_models.py │ └── fast64_run.py ├── create_patch.sh ├── displaylist_packer.c ├── doxygen_symbol_gen.py ├── extract_data_for_mio.c ├── format.py ├── gfxdis_multi.py ├── ido-recomp │ ├── linux │ │ ├── acpp │ │ ├── as0 │ │ ├── as1 │ │ ├── c++filt │ │ ├── cc │ │ ├── cfe │ │ ├── copt │ │ ├── crt1.o │ │ ├── crtn.o │ │ ├── err.english.cc │ │ ├── ld │ │ ├── libc.so │ │ ├── libc.so.1 │ │ ├── libexc.so │ │ ├── libgen.so │ │ ├── libm.so │ │ ├── strip │ │ ├── ugen │ │ ├── ujoin │ │ ├── uld │ │ ├── umerge │ │ ├── uopt │ │ ├── upas │ │ └── usplit │ ├── macos │ │ ├── acpp │ │ ├── as0 │ │ ├── as1 │ │ ├── c++filt │ │ ├── cc │ │ ├── cfe │ │ ├── copt │ │ ├── crt1.o │ │ ├── crtn.o │ │ ├── err.english.cc │ │ ├── ld │ │ ├── libc.so │ │ ├── libc.so.1 │ │ ├── libexc.so │ │ ├── libgen.so │ │ ├── libm.so │ │ ├── strip │ │ ├── ugen │ │ ├── ujoin │ │ ├── uld │ │ ├── umerge │ │ ├── uopt │ │ ├── upas │ │ └── usplit │ ├── versions.txt │ └── windows │ │ ├── acpp.exe │ │ ├── as0.exe │ │ ├── as1.exe │ │ ├── c++filt.exe │ │ ├── cc.exe │ │ ├── cfe.exe │ │ ├── copt.exe │ │ ├── crt1.o │ │ ├── crtn.o │ │ ├── err.english.cc │ │ ├── ld.exe │ │ ├── libc.so │ │ ├── libc.so.1 │ │ ├── libexc.so │ │ ├── libgen.so │ │ ├── libm.so │ │ ├── msys-2.0.dll │ │ ├── strip.exe │ │ ├── ugen.exe │ │ ├── ujoin.exe │ │ ├── uld.exe │ │ ├── umerge.exe │ │ ├── uopt.exe │ │ ├── upas.exe │ │ └── usplit.exe ├── libmio0.c ├── libmio0.h ├── libtkmk00.c ├── libtkmk00.h ├── linkonly_generator.py ├── m2ctx ├── mkgccgen.py ├── n64cksum.c ├── n64cksum.h ├── n64graphics.c ├── n64graphics.h ├── new_extract_assets.py ├── revert_patch.sh ├── set_o32abi_bit.py ├── stb │ ├── stb_image.h │ └── stb_image_write.h ├── utils.c ├── utils.h └── windows_build.py ├── undefined_syms.txt ├── util.mk └── yamls ├── courses ├── banshee_boardwalk_metadata.yml ├── big_donut_metadata.yml ├── block_fort_metadata.yml ├── bowsers_castle_metadata.yml ├── choco_mountain_metadata.yml ├── dks_jungle_parkway_metadata.yml ├── double_deck_metadata.yml ├── frappe_snowland_metadata.yml ├── kalimari_desert_metadata.yml ├── koopa_beach_metadata.yml ├── luigi_raceway_metadata.yml ├── mario_raceway_metadata.yml ├── moo_moo_farm_metadata.yml ├── podium_ceremony_metadata.yml ├── rainbow_road_metadata.yml ├── royal_raceway_metadata.yml ├── sherbet_land_metadata.yml ├── skyscraper_metadata.yml ├── toads_turnpike_metadata.yml ├── wario_stadium_metadata.yml └── yoshi_valley_metadata.yml └── us ├── ceremony_data.yml ├── ceremony_rsp_init_80284EE0.yml ├── common_data.yml ├── course_metadata.yml ├── data_800E45C0.yml ├── data_800E8700.yml ├── data_segment2.yml ├── rainbow_road_tluts.yml └── startup_logo.yml /.clang-format: -------------------------------------------------------------------------------- 1 | IndentWidth: 4 2 | Language: Cpp 3 | UseTab: Never 4 | ColumnLimit: 120 5 | PointerAlignment: Left 6 | BreakBeforeBraces: Attach 7 | SpaceAfterCStyleCast: true 8 | Cpp11BracedListStyle: false 9 | IndentCaseLabels: true 10 | BinPackArguments: true 11 | BinPackParameters: true 12 | AlignAfterOpenBracket: Align 13 | AlignOperands: true 14 | BreakBeforeTernaryOperators: true 15 | BreakBeforeBinaryOperators: None 16 | AllowShortBlocksOnASingleLine: true 17 | AllowShortIfStatementsOnASingleLine: false 18 | AllowShortLoopsOnASingleLine: false 19 | AllowShortCaseLabelsOnASingleLine: false 20 | AllowShortFunctionsOnASingleLine: false 21 | AlignEscapedNewlines: Left 22 | AlignTrailingComments: true 23 | SortIncludes: false 24 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: '-*,readability-braces-around-statements,readability-inconsistent-declaration-parameter-name' 2 | WarningsAsErrors: '' 3 | HeaderFilterRegex: '(src|include)\/.*\.h$' 4 | FormatStyle: 'file' 5 | CheckOptions: 6 | # Require argument names to match exactly (instead of allowing a name to be a prefix/suffix of another) 7 | # Note: 'true' is expected by clang-tidy 12+ but '1' is used for compatibility with older versions 8 | - key: readability-inconsistent-declaration-parameter-name.Strict 9 | value: 1 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | end_of_line = lf 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case people don't have core.autocrlf set. 2 | * text=auto 3 | 4 | # force C files to unix endings regardless of host platform 5 | # for compatibility with IDO cc 6 | *.c text eol=lf diff=c 7 | *.h text eol=lf diff=c 8 | 9 | # List text files in case git doesn't characterize correctly 10 | *.s text 11 | *.in text 12 | *.js text 13 | *.md text 14 | *.py text diff=python 15 | *.sh text 16 | *.ld text 17 | *.inc text 18 | *.txt text 19 | *.json text 20 | *.yaml text 21 | *.toml text 22 | *.rs text diff=rust 23 | -------------------------------------------------------------------------------- /.github/workflows/clang-format-suggest.yml: -------------------------------------------------------------------------------- 1 | name: clang-format Suggest 2 | on: [pull_request] 3 | jobs: 4 | formatting-check: 5 | runs-on: ubuntu-24.04 6 | permissions: 7 | pull-requests: write 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Install Dependance 11 | run: | 12 | sudo apt install clang-format make 13 | - name: Run clang-format style check for C/C++/Protobuf programs. 14 | run: | 15 | clang-format --version 16 | python tools/format.py 17 | - uses: parkerbxyz/suggest-changes@v1 18 | with: 19 | comment: 'Please commit the suggested changes from clang-format.' 20 | -------------------------------------------------------------------------------- /.github/workflows/clang-format.yml: -------------------------------------------------------------------------------- 1 | name: clang-format Check 2 | on: [push] 3 | jobs: 4 | formatting-check: 5 | name: Formatting Check 6 | runs-on: ubuntu-24.04 7 | strategy: 8 | matrix: 9 | path: 10 | - include 11 | - data 12 | - courses 13 | - src 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Run clang-format style check for C/C++/Protobuf programs. 17 | uses: jidicula/clang-format-action@v4.13.0 18 | with: 19 | clang-format-version: "18" 20 | check-path: ${{ matrix.path }} 21 | exclude-regex: "gbi.h" 22 | -------------------------------------------------------------------------------- /.github/workflows/clang-pr.yml: -------------------------------------------------------------------------------- 1 | name: clang-format PR 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | formatting-check: 8 | runs-on: ubuntu-24.04 9 | steps: 10 | - uses: actions/checkout@v4 11 | - name: Install Dependance 12 | run: | 13 | sudo apt install clang-format make 14 | - name: Run clang-format style check for C/C++/Protobuf programs. 15 | run: | 16 | clang-format --version 17 | python tools/format.py 18 | - name: Create Pull Request 19 | uses: peter-evans/create-pull-request@v7 20 | with: 21 | commit-message: Clang Format 22 | title: Clang Format 23 | branch: clang-format 24 | -------------------------------------------------------------------------------- /.github/workflows/linux-compile.yml: -------------------------------------------------------------------------------- 1 | name: Linux Compile test 2 | 3 | on: 4 | push: 5 | branches: [ "*" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4.1.1 14 | with: 15 | submodules: "true" 16 | - name: Get Complementary file 17 | uses: actions/checkout@v4.1.1 18 | with: 19 | path: complementary_file 20 | repository: UnspaghettifyKart/action-build-private-file 21 | ssh-key: ${{ secrets.LINUX_SSH_PRIVATE_KEY }} 22 | - name: Install dependencies 23 | run: | 24 | sudo apt install build-essential cmake pkg-config git binutils-mips-linux-gnu python3 zlib1g-dev libaudiofile-dev libcapstone-dev 25 | - name: Build 26 | run: | 27 | cp -r complementary_file/* . 28 | echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64 29 | make assets 30 | make -j || ./first-diff.py -------------------------------------------------------------------------------- /.github/workflows/macos-compile.yml: -------------------------------------------------------------------------------- 1 | name: Macos Compile test 2 | 3 | on: 4 | push: 5 | branches: [ "*" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | if: 0 12 | runs-on: macos-latest 13 | steps: 14 | - uses: actions/checkout@v4.1.1 15 | with: 16 | submodules: "true" 17 | - name: Get Complementary file 18 | uses: actions/checkout@v4.1.1 19 | with: 20 | path: complementary_file 21 | repository: UnspaghettifyKart/action-build-private-file 22 | ssh-key: ${{ secrets.MACOS_SSH_PRIVATE_KEY }} 23 | - name: Install dependencies 24 | run: | 25 | brew update 26 | brew install python3 capstone coreutils make pkg-config tehzz/n64-dev/mips64-elf-binutils cmake 27 | - name: Build 28 | run: | 29 | cp -r complementary_file/* . 30 | echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64 31 | make assets 32 | make -j -------------------------------------------------------------------------------- /.github/workflows/windows-compile.yml: -------------------------------------------------------------------------------- 1 | name: Windows Compile test 2 | 3 | on: 4 | push: 5 | branches: [ "*" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | runs-on: windows-2022 12 | steps: 13 | - uses: actions/checkout@v4.1.1 14 | with: 15 | submodules: "true" 16 | - name: Get Complementary file 17 | uses: actions/checkout@v4.1.1 18 | with: 19 | path: complementary_file 20 | repository: UnspaghettifyKart/action-build-private-file 21 | ssh-key: ${{ secrets.WINDOWS_SSH_PRIVATE_KEY }} 22 | - name: Install dependencies 23 | run: | 24 | Invoke-WebRequest https://github.com/coco875/mk64-tools/releases/download/v0.0.8/mips-tools-chain-windows.zip -OutFile mips-tools-chain-windows.zip 25 | Expand-Archive mips-tools-chain-windows.zip -DestinationPath mips-tools-chain-windows 26 | Copy-Item -Path mips-tools-chain-windows/mingw64 -Destination tools -Recurse 27 | - name: Build 28 | run: | 29 | Copy-Item -Path complementary_file/* -Destination . -Recurse 30 | echo "${{ secrets.AES_KEY }}" | openssl enc -d -aes-256-cbc -pass stdin -pbkdf2 -in baserom.us.z64.aes -out baserom.us.z64 31 | python tools/windows_build.py -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tools/asm-differ"] 2 | path = tools/asm-differ 3 | url = https://github.com/simonlindholm/asm-differ 4 | [submodule "tools/decomp-permuter"] 5 | path = tools/decomp-permuter 6 | url = https://github.com/simonlindholm/decomp-permuter 7 | [submodule "tools/asm-differ"] 8 | path = tools/asm-differ 9 | url = https://github.com/simonlindholm/asm-differ 10 | [submodule "doxygen-awesome-css"] 11 | path = doxygen-awesome-css 12 | url = https://github.com/jothepro/doxygen-awesome-css.git 13 | [submodule "tools/torch"] 14 | path = tools/torch 15 | url = https://github.com/HarbourMasters/torch 16 | [submodule "tools/blender/fast64"] 17 | path = tools/blender/fast64 18 | url = https://github.com/Fast-64/fast64.git 19 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 as build 2 | 3 | RUN apt-get update && \ 4 | apt-get upgrade -y && \ 5 | apt-get install -y \ 6 | binutils-mips-linux-gnu \ 7 | build-essential \ 8 | cmake \ 9 | git \ 10 | libaudiofile-dev \ 11 | libcapstone-dev \ 12 | pkg-config \ 13 | python3 \ 14 | zlib1g-dev 15 | 16 | RUN mkdir /mk64 17 | WORKDIR /mk64 18 | 19 | CMD echo 'Usage: docker run --rm -v ${PWD}:/mk64 mk64 make\n'\ 20 | 'See https://github.com/n64decomp/mk64/blob/master/README.md for more information' 21 | -------------------------------------------------------------------------------- /Makefile.split: -------------------------------------------------------------------------------- 1 | STANDALONE_TEXTURE_MIO0_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.mio0,$(wildcard $(TEXTURES_DIR)/standalone/*.png))) 2 | 3 | RAW_TEXTURE_FILES := $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%,$(wildcard $(TEXTURES_DIR)/raw/*.png))) 4 | 5 | MIO0_FILES := $(STANDALONE_TEXTURE_MIO0_FILES) 6 | -------------------------------------------------------------------------------- /addr_to_sym.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | # Define the regex query to match the hex values 4 | regex_query = r'0x07[0-9a-fA-F]{6}' 5 | 6 | # Define a function to process each match 7 | def process_match(match): 8 | offset = int(match.group(0)[4:], 16) 9 | return f"d_course_big_donut_packed_dl_{hex(offset)[2:].upper()}" 10 | 11 | # Open the input file 12 | with open("courses/big_donut/packed.inc.c", "r") as f: 13 | # Read the file contents 14 | file_content = f.read() 15 | 16 | # Use re.sub() to find and replace all matches in the file content 17 | modified_content = re.sub(regex_query, process_match, file_content) 18 | 19 | # Print the modified content to console 20 | print(modified_content) 21 | -------------------------------------------------------------------------------- /asm/os/__osDisableInt.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | 10 | glabel __osDisableInt 11 | mfc0 $t0, C0_SR 12 | and $t1, $t0, ~SR_IE 13 | mtc0 $t1, C0_SR 14 | andi $v0, $t0, SR_IE 15 | nop 16 | jr $ra 17 | nop 18 | 19 | -------------------------------------------------------------------------------- /asm/os/__osGetSR.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel __osGetSR 10 | mfc0 $v0, C0_SR 11 | jr $ra 12 | nop 13 | 14 | nop 15 | 16 | -------------------------------------------------------------------------------- /asm/os/__osProbeTLB.s: -------------------------------------------------------------------------------- 1 | .set noat # allow manual use of $at 2 | .set noreorder # don't insert nops after branches 3 | .set gp=64 4 | 5 | .include "macros.inc" 6 | 7 | 8 | .section .text, "ax" 9 | 10 | glabel __osProbeTLB 11 | mfc0 $t0, C0_ENTRYHI 12 | andi $t1, $t0, TLBHI_PIDMASK 13 | li $at, TLBHI_VPN2MASK 14 | and $t2, $a0, $at 15 | or $t1, $t1, $t2 16 | mtc0 $t1, C0_ENTRYHI 17 | nop 18 | nop 19 | nop 20 | tlbp 21 | nop 22 | nop 23 | mfc0 $t3, C0_INX 24 | lui $at, %hi(TLBINX_PROBE) 25 | and $t3, $t3, $at 26 | bnez $t3, .L8032A0D8 27 | nop 28 | tlbr 29 | nop 30 | nop 31 | nop 32 | mfc0 $t3, C0_PAGEMASK 33 | addi $t3, $t3, DCACHE_SIZE 34 | srl $t3, $t3, 1 35 | and $t4, $t3, $a0 36 | bnez $t4, .L8032A0A8 37 | addi $t3, $t3, -1 38 | mfc0 $v0, C0_ENTRYLO0 39 | b .L8032A0AC 40 | nop 41 | .L8032A0A8: 42 | mfc0 $v0, C0_ENTRYLO1 43 | .L8032A0AC: 44 | andi $t5, $v0, TLBLO_V 45 | beqz $t5, .L8032A0D8 46 | nop 47 | lui $at, (TLBLO_PFNMASK >> 16) # lui $at, 0x3fff 48 | ori $at, %lo(TLBLO_PFNMASK) # ori $at, $at, 0xffc0 49 | and $v0, $v0, $at 50 | sll $v0, $v0, TLBLO_PFNSHIFT 51 | and $t5, $a0, $t3 52 | add $v0, $v0, $t5 53 | b .L8032A0DC 54 | nop 55 | .L8032A0D8: 56 | li $v0, -1 57 | .L8032A0DC: 58 | mtc0 $t0, C0_ENTRYHI 59 | jr $ra 60 | nop 61 | 62 | nop 63 | nop 64 | 65 | -------------------------------------------------------------------------------- /asm/os/__osRestoreInt.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel __osRestoreInt 10 | mfc0 $t0, C0_SR 11 | or $t0, $t0, $a0 12 | mtc0 $t0, C0_SR 13 | nop 14 | nop 15 | jr $ra 16 | nop 17 | 18 | nop 19 | 20 | -------------------------------------------------------------------------------- /asm/os/__osSetCompare.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel __osSetCompare 10 | mtc0 $a0, C0_COMPARE 11 | jr $ra 12 | nop 13 | 14 | nop 15 | 16 | -------------------------------------------------------------------------------- /asm/os/__osSetFpcCsr.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel __osSetFpcCsr 10 | cfc1 $v0, $31 11 | ctc1 $a0, $31 12 | jr $ra 13 | nop 14 | 15 | -------------------------------------------------------------------------------- /asm/os/__osSetSR.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel __osSetSR 10 | mtc0 $a0, C0_SR 11 | nop 12 | jr $ra 13 | nop 14 | 15 | -------------------------------------------------------------------------------- /asm/os/osGetCount.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel osGetCount 10 | mfc0 $v0, $9 11 | jr $ra 12 | nop 13 | 14 | nop 15 | 16 | -------------------------------------------------------------------------------- /asm/os/osMapTLBRdb.s: -------------------------------------------------------------------------------- 1 | .set noat # allow manual use of $at 2 | .set noreorder # don't insert nops after branches 3 | .set gp=64 4 | 5 | .include "macros.inc" 6 | 7 | 8 | .section .text, "ax" 9 | 10 | glabel osMapTLBRdb 11 | mfc0 $t0, C0_ENTRYHI 12 | li $t1, 31 13 | mtc0 $t1, C0_INX 14 | mtc0 $zero, C0_PAGEMASK 15 | li $t2, TLBLO_UNCACHED | TLBLO_D | TLBLO_V | TLBLO_G 16 | lui $t1, K2BASE >> 16 17 | mtc0 $t1, C0_ENTRYHI 18 | lui $t1, KUSIZE >> 16 19 | srl $t3, $t1, TLBLO_PFNSHIFT 20 | or $t3, $t3, $t2 21 | mtc0 $t3, C0_ENTRYLO0 22 | li $t1, TLBLO_G 23 | mtc0 $t1, C0_ENTRYLO1 24 | nop 25 | tlbwi 26 | nop 27 | nop 28 | nop 29 | nop 30 | mtc0 $t0, C0_ENTRYHI 31 | jr $ra 32 | nop 33 | 34 | nop 35 | nop 36 | 37 | -------------------------------------------------------------------------------- /asm/os/osWritebackDCache.s: -------------------------------------------------------------------------------- 1 | .set noreorder # don't insert nops after branches 2 | .set gp=64 3 | 4 | .include "macros.inc" 5 | 6 | 7 | .section .text, "ax" 8 | 9 | glabel osWritebackDCache 10 | blez $a1, .osWritebackDCacheReturn 11 | nop 12 | li $t3, DCACHE_SIZE 13 | bgeu $a1, $t3, .L80324E40 14 | nop 15 | move $t0, $a0 16 | addu $t1, $a0, $a1 17 | bgeu $t0, $t1, .osWritebackDCacheReturn 18 | nop 19 | andi $t2, $t0, DCACHE_LINEMASK 20 | addiu $t1, $t1, -DCACHE_LINESIZE 21 | subu $t0, $t0, $t2 22 | .L80324E28: 23 | cache C_HWB|CACH_PD, ($t0) 24 | bltu $t0, $t1, .L80324E28 25 | addiu $t0, $t0, 0x10 26 | .osWritebackDCacheReturn: 27 | jr $ra 28 | nop 29 | 30 | .L80324E40: 31 | li $t0, KUSIZE 32 | addu $t1, $t0, $t3 33 | addiu $t1, $t1, -DCACHE_LINESIZE 34 | .L80324E4C: 35 | cache C_IWBINV|CACH_PD, ($t0) 36 | bltu $t0, $t1, .L80324E4C 37 | addiu $t0, DCACHE_LINESIZE # addiu $t0, $t0, 0x10 38 | jr $ra 39 | nop 40 | -------------------------------------------------------------------------------- /asm/os/osWritebackDCacheAll.s: -------------------------------------------------------------------------------- 1 | # handwritten 2 | # assembler directives 3 | .set noat # allow manual use of $at 4 | .set noreorder # don't insert nops after branches 5 | .set gp=64 6 | 7 | .include "macros.inc" 8 | 9 | .section .text, "ax" 10 | 11 | glabel osWritebackDCacheAll 12 | /* 0CE490 800CD890 3C088000 */ li $t0, KUSIZE # $t0, 0x8000 13 | /* 0CE494 800CD894 240A2000 */ li $t2, DCACHE_SIZE 14 | /* 0CE498 800CD898 010A4821 */ addu $t1, $t0, $t2 15 | /* 0CE49C 800CD89C 2529FFF0 */ addiu $t1, $t1, -DCACHE_LINESIZE 16 | .L800CD8A0: 17 | /* 0CE4A0 800CD8A0 BD010000 */ cache C_IWBINV | CACH_PD, ($t0) 18 | /* 0CE4A4 800CD8A4 0109082B */ sltu $at, $t0, $t1 19 | /* 0CE4A8 800CD8A8 1420FFFD */ bnez $at, .L800CD8A0 20 | /* 0CE4AC 800CD8AC 25080010 */ addiu $t0, $t0, DCACHE_LINESIZE 21 | /* 0CE4B0 800CD8B0 03E00008 */ jr $ra 22 | /* 0CE4B4 800CD8B4 00000000 */ nop 23 | 24 | /* 0CE4B8 800CD8B8 00000000 */ nop 25 | /* 0CE4BC 800CD8BC 00000000 */ nop 26 | -------------------------------------------------------------------------------- /asm/os/parameters.s: -------------------------------------------------------------------------------- 1 | 2 | .ifdef VERSION_EU 3 | .macro gsymbol sym addr 4 | .global \sym 5 | .set \sym, \addr 6 | .endm 7 | 8 | .else 9 | 10 | .macro gsymbol sym addr 11 | .global \sym 12 | .set \sym, \addr 13 | nop 14 | nop 15 | .endm 16 | 17 | .endif 18 | 19 | .text 20 | gsymbol osTvType 0x80000300 21 | gsymbol osRomType 0x80000304 22 | gsymbol osRomBase 0x80000308 23 | gsymbol osResetType 0x8000030C 24 | gsymbol osCiCId 0x80000310 25 | gsymbol osVersion 0x80000314 26 | gsymbol osMemSize 0x80000318 27 | gsymbol osAppNmiBuffer 0x8000031C 28 | -------------------------------------------------------------------------------- /asm/os/sqrtf.s: -------------------------------------------------------------------------------- 1 | # Handwritten 2 | # assembler directives 3 | .set noat # allow manual use of $at 4 | .set noreorder # don't insert nops after branches 5 | .set gp=64 6 | 7 | .include "macros.inc" 8 | 9 | .section .text, "ax" 10 | 11 | glabel sqrtf 12 | /* 0CED40 800CE140 03E00008 */ jr $ra 13 | /* 0CED44 800CE144 46006004 */ sqrt.s $f0, $f12 14 | 15 | /* 0CED48 800CE148 00000000 */ nop 16 | /* 0CED4C 800CE14C 00000000 */ nop 17 | -------------------------------------------------------------------------------- /asm/rom_header.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Mario Kart 64 ROM header 3 | * Only the first 0x18 bytes matter to the console. 4 | */ 5 | 6 | .byte 0x80, 0x37, 0x12, 0x40 /* PI BSD Domain 1 register */ 7 | .word 0x0000000F /* Clockrate setting*/ 8 | .word entry_point /* Entrypoint */ 9 | 10 | /* Revision */ 11 | .word 0x00001446 /* NTSC-U */ 12 | 13 | .word 0x3E5055B6 /* Checksum 1 */ 14 | .word 0x2E92DA52 /* Checksum 2 */ 15 | .word 0x00000000 /* Unknown */ 16 | .word 0x00000000 /* Unknown */ 17 | .ascii "MARIOKART64 " /* Internal ROM name */ 18 | .word 0x00000000 /* Unknown */ 19 | .word 0x0000004E /* Cartridge */ 20 | .ascii "KT" /* Cartridge ID */ 21 | 22 | /* Region */ 23 | 24 | .ifdef VERSION_EU 25 | .ascii "P" /* PAL (Europe) */ 26 | .else 27 | .ascii "E" /* NTSC-U (North America) */ 28 | .endif 29 | 30 | .ifdef VERSION_EU_V11 31 | .byte 0x01 /* Version */ 32 | .else 33 | .byte 0x00 /* Version */ 34 | .endif 35 | -------------------------------------------------------------------------------- /asm/unused_overflow_check.s: -------------------------------------------------------------------------------- 1 | # Mario Kart 64 (U) disassembly and split file 2 | # generated by n64split v0.4a - N64 ROM splitter 3 | 4 | # assembler directives 5 | .set noat # allow manual use of $at 6 | .set noreorder # don't insert nops after branches 7 | .set gp=64 8 | 9 | .include "macros.inc" 10 | 11 | .section .text, "ax" 12 | 13 | /* Checks for overflow in unsigned shorts after arithmetic */ 14 | /* 006BB0 80005FB0 00853020 */ add $a2, $a0, $a1 15 | /* 006BB4 80005FB4 3403FFFF */ li $v1, 65535 16 | /* 006BB8 80005FB8 03E00008 */ jr $ra 17 | /* 006BBC 80005FBC 0066102B */ sltu $v0, $v1, $a2 18 | 19 | /* 006BC0 80005FC0 03E00008 */ jr $ra 20 | /* 006BC4 80005FC4 0085102A */ slt $v0, $a0, $a1 21 | 22 | /* 006BC8 80005FC8 00000000 */ nop 23 | /* 006BCC 80005FCC 00000000 */ nop 24 | -------------------------------------------------------------------------------- /assets/blueshell.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_blue_shell": {"output_dir": "blueshell", "rom_offset": "0x132B50", "block_offset": "0x05038", "width": 16, "height": 16, "type": "rgba16"}, 3 | "gTextureBlueShell0": {"output_dir": "blueshell", "rom_offset": "0x68FE20", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 4 | "gTextureBlueShell1": {"output_dir": "blueshell", "rom_offset": "0x69004C", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 5 | "gTextureBlueShell2": {"output_dir": "blueshell", "rom_offset": "0x690284", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 6 | "gTextureBlueShell3": {"output_dir": "blueshell", "rom_offset": "0x6904C4", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 7 | "gTextureBlueShell4": {"output_dir": "blueshell", "rom_offset": "0x690708", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 8 | "gTextureBlueShell5": {"output_dir": "blueshell", "rom_offset": "0x690960", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 9 | "gTextureBlueShell6": {"output_dir": "blueshell", "rom_offset": "0x690BBC", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"}, 10 | "gTextureBlueShell7": {"output_dir": "blueshell", "rom_offset": "0x690DF8", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_blue_shell"} 11 | } -------------------------------------------------------------------------------- /assets/bomb.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_bomb": {"output_dir": "bomb", "rom_offset": "0x132B50", "block_offset": "0x2A858", "width": 16, "height": 16, "type": "rgba16"}, 3 | "common_texture_bomb_1": {"output_dir": "bomb", "rom_offset": "0x132B50", "block_offset": "0x29858", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_bomb"}, 4 | "common_texture_bomb_2": {"output_dir": "bomb", "rom_offset": "0x132B50", "block_offset": "0x29C58", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_bomb"}, 5 | "common_texture_bomb_3": {"output_dir": "bomb", "rom_offset": "0x132B50", "block_offset": "0x2A058", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_bomb"}, 6 | "common_texture_bomb_4": {"output_dir": "bomb", "rom_offset": "0x132B50", "block_offset": "0x2A458", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_bomb"} 7 | } 8 | -------------------------------------------------------------------------------- /assets/courses/bowsers_castle.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureThwompSide": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x6738", "width": 32, "height": 32, "type": "rgba16"}, 3 | "gTLUTThwomp": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x6F38", "width": 16, "height": 16, "type": "rgba16"}, 4 | "gTextureThwompFace1": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x7138", "width": 16, "height": 64, "type": "ci8", "tlut": "gTLUTThwomp"}, 5 | "gTextureThwompFace2": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x7538", "width": 16, "height": 64, "type": "ci8", "tlut": "gTLUTThwomp"}, 6 | "gTextureThwompFace3": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x7938", "width": 16, "height": 64, "type": "ci8", "tlut": "gTLUTThwomp"}, 7 | "gTextureThwompFace4": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x7D38", "width": 16, "height": 64, "type": "ci8", "tlut": "gTLUTThwomp"}, 8 | "gTextureThwompFace5": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x8138", "width": 16, "height": 64, "type": "ci8", "tlut": "gTLUTThwomp"}, 9 | "gTextureThwompFace6": {"output_dir": "bowsers_castle", "rom_offset": "0x82DF40", "block_offset": "0x8538", "width": 16, "height": 64, "type": "ci8", "tlut": "gTLUTThwomp"} 10 | } 11 | -------------------------------------------------------------------------------- /assets/courses/choco_mountain.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureChocoMountainWall": {"output_dir": "choco_mountain", "rom_offset": "0x82B620", "block_offset": "0x05B38", "width": 32, "height": 32, "type": "rgba16"}, 3 | "gTextureChocoMountainRock": {"output_dir": "choco_mountain", "rom_offset": "0x82B620", "block_offset": "0x06338", "width": 32, "height": 32, "type": "rgba16"} 4 | } 5 | -------------------------------------------------------------------------------- /assets/courses/frappe_snowland.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTLUTSnowman": {"output_dir": "frappe_snowland", "rom_offset": "0x83F740", "block_offset": "0x4B20", "width": 16, "height": 16, "type": "rgba16"}, 3 | "gTextureSnowmanHead": {"output_dir": "frappe_snowland", "rom_offset": "0x83F740", "block_offset": "0x4D20", "width": 64, "height": 64, "type": "ci8", "tlut": "gTLUTSnowman"}, 4 | "gTextureSnowmanBody": {"output_dir": "frappe_snowland", "rom_offset": "0x83F740", "block_offset": "0x5D20", "width": 64, "height": 64, "type": "ci8", "tlut": "gTLUTSnowman"}, 5 | 6 | "gTLUTSnow": {"output_dir": "frappe_snowland", "rom_offset": "0x83F740", "block_offset": "0x6D20", "width": 16, "height": 16, "type": "rgba16"}, 7 | "gTextureSnow": {"output_dir": "frappe_snowland", "rom_offset": "0x83F740", "block_offset": "0x6F20", "width": 32, "height": 32, "type": "ci8", "tlut": "gTLUTSnow"}, 8 | 9 | "gTLUTFrappeSnowlandTree": {"output_dir": "frappe_snowland", "rom_offset": "0x83F740", "block_offset": "0x7320", "width": 16, "height": 16, "type": "rgba16"}, 10 | "gTextureFrappeSnowlandTreeLeft": {"output_dir": "frappe_snowland", "rom_offset": "0x69333C", "width": 32, "height": 64, "type": "ci8", "tlut": "gTLUTFrappeSnowlandTree"}, 11 | "gTextureFrappeSnowlandTreeRight": {"output_dir": "frappe_snowland", "rom_offset": "0x693790", "width": 32, "height": 64, "type": "ci8", "tlut": "gTLUTFrappeSnowlandTree"} 12 | } 13 | -------------------------------------------------------------------------------- /assets/courses/luigi_raceway.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureLuigiRacewaySignLeft": {"output_dir": "luigi_raceway", "rom_offset": "0x84E8E0", "block_offset": "0x0C588", "width": 32, "height": 64, "type": "rgba16"}, 3 | "gTextureLuigiRacewaySignRight": {"output_dir": "luigi_raceway", "rom_offset": "0x84E8E0", "block_offset": "0x0D588", "width": 32, "height": 64, "type": "rgba16"}, 4 | "gTextureLuigiRacewayBalloonBasket": {"output_dir": "luigi_raceway", "rom_offset": "0x84E8E0", "block_offset": "0x0E588", "width": 32, "height": 32, "type": "rgba16"}, 5 | "gTextureLuigiRacewayBalloonRope": {"output_dir": "luigi_raceway", "rom_offset": "0x84E8E0", "block_offset": "0x0ED88", "width": 32, "height": 32, "type": "rgba16"} 6 | } 7 | -------------------------------------------------------------------------------- /assets/courses/royal_raceway.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTLUTRoyalRacewayPiranhaPlant": {"output_dir": "royal_raceway", "rom_offset": "0x84ABD0", "block_offset": "0x0D610", "width": 16, "height": 16, "type": "rgba16"} 3 | } 4 | -------------------------------------------------------------------------------- /assets/courses/sherbet_land.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureSherbetLandIce": {"output_dir": "sherbet_land", "rom_offset": "0x86ECF0", "block_offset": "0x068E8", "width": 32, "height": 32, "type": "ia16"}, 3 | "gTexturePenguinBeak": {"output_dir": "sherbet_land", "rom_offset": "0x86ECF0", "block_offset": "0x072E8", "width": 32, "height": 32, "type": "rgba16"}, 4 | "gTexturePenguinEye": {"output_dir": "sherbet_land", "rom_offset": "0x86ECF0", "block_offset": "0x07AE8", "width": 32, "height": 32, "type": "rgba16"} 5 | } 6 | -------------------------------------------------------------------------------- /assets/courses/wario_stadium.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureWarioStadiumSignTopLeft": {"output_dir": "wario_stadium", "rom_offset": "0x8804A0", "block_offset": "0x08890", "width": 64, "height": 32, "type": "rgba16"}, 3 | "gTextureWarioStadiumSignBottomLeft": {"output_dir": "wario_stadium", "rom_offset": "0x8804A0", "block_offset": "0x09890", "width": 64, "height": 32, "type": "rgba16"}, 4 | "gTextureWarioStadiumSignTopRight": {"output_dir": "wario_stadium", "rom_offset": "0x8804A0", "block_offset": "0x0A890", "width": 64, "height": 32, "type": "rgba16"}, 5 | "gTextureWarioStadiumSignBottomRight": {"output_dir": "wario_stadium", "rom_offset": "0x8804A0", "block_offset": "0x0B890", "width": 64, "height": 32, "type": "rgba16"} 6 | } 7 | -------------------------------------------------------------------------------- /assets/courses/yoshi_valley.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureYoshiValleyYoshiFlag": {"output_dir": "yoshi_valley", "rom_offset": "0x835BA0", "block_offset": "0x139A0", "width": 32, "height": 32, "type": "rgba16"}, 3 | "gTLUTYoshiValleyHedgehog": {"output_dir": "yoshi_valley", "rom_offset": "0x835BA0", "block_offset": "0x14908", "width": 16, "height": 16, "type": "rgba16"}, 4 | "gTextureYoshiValleyHedgehog": {"output_dir": "yoshi_valley", "rom_offset": "0x835BA0", "block_offset": "0x14B08", "width": 64, "height": 64, "type": "ci8", "tlut": "gTLUTYoshiValleyHedgehog"}, 5 | "gTextureYoshiValleyEggSpot": {"output_dir": "yoshi_valley", "rom_offset": "0x835BA0", "block_offset": "0x16570", "width": 32, "height": 32, "type": "rgba16"}, 6 | "gTextureYoshiValleyEgg": {"output_dir": "yoshi_valley", "rom_offset": "0x835BA0", "block_offset": "0x16FA8", "width": 64, "height": 32, "type": "rgba16"} 7 | } 8 | -------------------------------------------------------------------------------- /assets/debug_font.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_debug_font": {"output_dir": "debug_font", "rom_offset": "0x132B50", "block_offset": "0x6ED8", "width": 4, "height": 4, "type": "rgba16"}, 3 | "common_texture_debug_font": {"output_dir": "debug_font", "rom_offset": "0x132B50", "block_offset": "0x6EF8", "width": 128, "height": 32, "type": "ci4", "tlut": "common_tlut_debug_font"} 4 | } 5 | -------------------------------------------------------------------------------- /assets/ending_ceremony.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureReflectionMapBrass": {"output_dir": "ending_ceremony", "rom_offset": "0x821D10", "block_offset": "0x4670", "width": 32, "height": 32, "type": "rgba16"}, 3 | "gTextureReflectionMapSilver": {"output_dir": "ending_ceremony", "rom_offset": "0x821D10", "block_offset": "0x4E70", "width": 32, "height": 32, "type": "rgba16"}, 4 | "gTextureReflectionMapGold": {"output_dir": "ending_ceremony", "rom_offset": "0x821D10", "block_offset": "0x5670", "width": 32, "height": 32, "type": "rgba16"}, 5 | "gTexturePodium1": {"output_dir": "ending_ceremony", "rom_offset": "0x821D10", "block_offset": "0x6BD0", "width": 32, "height": 32, "type": "rgba16"}, 6 | "gTexturePodium2": {"output_dir": "ending_ceremony", "rom_offset": "0x821D10", "block_offset": "0x7760", "width": 32, "height": 32, "type": "rgba16"}, 7 | "gTexturePodium3": {"output_dir": "ending_ceremony", "rom_offset": "0x821D10", "block_offset": "0x8070", "width": 32, "height": 32, "type": "rgba16"} 8 | } 9 | -------------------------------------------------------------------------------- /assets/greenshell.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_green_shell": {"output_dir": "greenshell", "rom_offset": "0x132B50", "block_offset": "0x04E38", "width": 16, "height": 16, "type": "rgba16"}, 3 | "gTextureGreenShell0": {"output_dir": "greenshell", "rom_offset": "0x68EB50", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 4 | "gTextureGreenShell1": {"output_dir": "greenshell", "rom_offset": "0x68EDA0", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 5 | "gTextureGreenShell2": {"output_dir": "greenshell", "rom_offset": "0x68EFF0", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 6 | "gTextureGreenShell3": {"output_dir": "greenshell", "rom_offset": "0x68F248", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 7 | "gTextureGreenShell4": {"output_dir": "greenshell", "rom_offset": "0x68F4A8", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 8 | "gTextureGreenShell5": {"output_dir": "greenshell", "rom_offset": "0x68F700", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 9 | "gTextureGreenShell6": {"output_dir": "greenshell", "rom_offset": "0x68F96C", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"}, 10 | "gTextureGreenShell7": {"output_dir": "greenshell", "rom_offset": "0x68FBCC", "width": 32, "height": 32, "type": "ci8", "tlut": "common_tlut_green_shell"} 11 | } 12 | -------------------------------------------------------------------------------- /assets/include/bomb.mk: -------------------------------------------------------------------------------- 1 | BOMB_DIR := assets/bomb 2 | 3 | BOMB_PALETTE := $(BOMB_DIR)/common_tlut_bomb.png 4 | 5 | BOMB_FRAMES := \ 6 | $(BOMB_DIR)/common_texture_bomb_1.png \ 7 | $(BOMB_DIR)/common_texture_bomb_2.png \ 8 | $(BOMB_DIR)/common_texture_bomb_3.png \ 9 | $(BOMB_DIR)/common_texture_bomb_4.png 10 | 11 | BOMB_EXPORT_SENTINEL := $(BOMB_DIR)/.export 12 | 13 | $(BUILD_DIR)/src/data/common_textures.o: $(BOMB_FRAMES:%.png=%.inc.c) $(BOMB_PALETTE:%.png=%.inc.c) 14 | 15 | $(BOMB_FRAMES:%.png=%.inc.c): %.inc.c : %.png 16 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 17 | $(V)$(N64GRAPHICS) -Z $@ -g $< -s u8 -f ci8 -c rgba16 -p $(BOMB_PALETTE) 18 | 19 | $(BOMB_PALETTE:%.png=%.inc.c): %.inc.c : %.png 20 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 21 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 22 | 23 | $(BOMB_FRAMES) $(BOMB_PALETTE): $(BOMB_EXPORT_SENTINEL) ; 24 | 25 | $(BOMB_EXPORT_SENTINEL): $(ASSET_DIR)/bomb.json 26 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 27 | $(V)$(TOUCH) $@ 28 | 29 | .PHONY: distclean_bomb 30 | distclean_bomb: 31 | rm -rf $(BOMB_DIR) 32 | 33 | distclean_assets: distclean_bomb 34 | -------------------------------------------------------------------------------- /assets/include/courses/choco_mountain.mk: -------------------------------------------------------------------------------- 1 | CHOCO_MOUNTAIN_DIR := assets/courses/choco_mountain 2 | 3 | CHOCO_MOUNTAIN_PNG := \ 4 | $(CHOCO_MOUNTAIN_DIR)/gTextureChocoMountainWall.png \ 5 | $(CHOCO_MOUNTAIN_DIR)/gTextureChocoMountainRock.png 6 | 7 | CHOCO_MOUNTAIN_EXPORT_SENTINEL := $(CHOCO_MOUNTAIN_DIR)/.export 8 | 9 | $(BUILD_DIR)/courses/choco_mountain/course_data.o: $(CHOCO_MOUNTAIN_PNG:%.png=%.inc.c) 10 | 11 | $(CHOCO_MOUNTAIN_PNG:%.png=%.inc.c): %.inc.c : %.png 12 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 13 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 14 | 15 | $(CHOCO_MOUNTAIN_PNG): $(CHOCO_MOUNTAIN_EXPORT_SENTINEL) ; 16 | 17 | $(CHOCO_MOUNTAIN_EXPORT_SENTINEL): $(ASSET_DIR)/courses/choco_mountain.json 18 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 19 | $(V)$(TOUCH) $@ 20 | 21 | .PHONY: distclean_choco_mountain 22 | distclean_choco_mountain: 23 | rm -rf $(CHOCO_MOUNTAIN_DIR) 24 | 25 | distclean_assets: distclean_choco_mountain 26 | -------------------------------------------------------------------------------- /assets/include/courses/luigi_raceway.mk: -------------------------------------------------------------------------------- 1 | LUIGI_RACEWAY_DIR := assets/courses/luigi_raceway 2 | 3 | LUIGI_RACEWAY_PNG := \ 4 | $(LUIGI_RACEWAY_DIR)/gTextureLuigiRacewaySignLeft.png \ 5 | $(LUIGI_RACEWAY_DIR)/gTextureLuigiRacewaySignRight.png \ 6 | $(LUIGI_RACEWAY_DIR)/gTextureLuigiRacewayBalloonBasket.png \ 7 | $(LUIGI_RACEWAY_DIR)/gTextureLuigiRacewayBalloonRope.png 8 | 9 | LUIGI_RACEWAY_EXPORT_SENTINEL := $(LUIGI_RACEWAY_DIR)/.export 10 | 11 | $(BUILD_DIR)/courses/luigi_raceway/course_data.o: $(LUIGI_RACEWAY_PNG:%.png=%.inc.c) 12 | 13 | $(LUIGI_RACEWAY_PNG:%.png=%.inc.c): %.inc.c : %.png 14 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 15 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 16 | 17 | $(LUIGI_RACEWAY_PNG): $(LUIGI_RACEWAY_EXPORT_SENTINEL) ; 18 | 19 | $(LUIGI_RACEWAY_EXPORT_SENTINEL): $(ASSET_DIR)/courses/luigi_raceway.json 20 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 21 | $(V)$(TOUCH) $@ 22 | 23 | .PHONY: distclean_luigi_raceway 24 | distclean_luigi_raceway: 25 | rm -rf $(LUIGI_RACEWAY_DIR) 26 | 27 | distclean_assets: distclean_luigi_raceway 28 | -------------------------------------------------------------------------------- /assets/include/courses/royal_raceway.mk: -------------------------------------------------------------------------------- 1 | ROYAL_RACEWAY_DIR := assets/courses/royal_raceway 2 | 3 | ROYAL_RACEWAY_PIRANHA_PLANT_PALETTE := $(ROYAL_RACEWAY_DIR)/gTLUTRoyalRacewayPiranhaPlant.png 4 | 5 | ROYAL_RACEWAY_EXPORT_SENTINEL := $(ROYAL_RACEWAY_DIR)/.export 6 | 7 | $(BUILD_DIR)/courses/royal_raceway/course_data.o: $(ROYAL_RACEWAY_PIRANHA_PLANT_PALETTE:%.png=%.inc.c) 8 | 9 | $(ROYAL_RACEWAY_PIRANHA_PLANT_PALETTE:%.png=%.inc.c): %.inc.c : %.png 10 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 11 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 12 | 13 | $(ROYAL_RACEWAY_PIRANHA_PLANT_PALETTE): $(ROYAL_RACEWAY_EXPORT_SENTINEL) ; 14 | 15 | $(ROYAL_RACEWAY_EXPORT_SENTINEL): $(ASSET_DIR)/courses/royal_raceway.json 16 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 17 | $(V)$(TOUCH) $@ 18 | 19 | .PHONY: distclean_royal_raceway 20 | distclean_royal_raceway: 21 | rm -rf $(ROYAL_RACEWAY_DIR) 22 | 23 | distclean_assets: distclean_royal_raceway 24 | -------------------------------------------------------------------------------- /assets/include/courses/sherbet_land.mk: -------------------------------------------------------------------------------- 1 | SHERBET_LAND_DIR := assets/courses/sherbet_land 2 | 3 | SHERBET_LAND_ICE := $(SHERBET_LAND_DIR)/gTextureSherbetLandIce.png 4 | 5 | PENGUIN_PNG := \ 6 | $(SHERBET_LAND_DIR)/gTexturePenguinBeak.png \ 7 | $(SHERBET_LAND_DIR)/gTexturePenguinEye.png 8 | 9 | SHERBET_LAND_EXPORT_SENTINEL := $(SHERBET_LAND_DIR)/.export 10 | 11 | $(BUILD_DIR)/courses/sherbet_land/course_data.o: $(SHERBET_LAND_ICE:%.png=%.inc.c) $(PENGUIN_PNG:%.png=%.inc.c) 12 | 13 | $(SHERBET_LAND_ICE:%.png=%.inc.c): %.inc.c : %.png 14 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 15 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f ia16 16 | 17 | $(PENGUIN_PNG:%.png=%.inc.c): %.inc.c : %.png 18 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 19 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 20 | 21 | $(SHERBET_LAND_PNG) $(PENGUIN_PNG) $(SHERBET_LAND_ICE): $(SHERBET_LAND_EXPORT_SENTINEL) ; 22 | 23 | $(SHERBET_LAND_EXPORT_SENTINEL): $(ASSET_DIR)/courses/sherbet_land.json 24 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 25 | $(V)$(TOUCH) $@ 26 | 27 | .PHONY: distclean_sherbet_land 28 | distclean_sherbet_land: 29 | rm -rf $(SHERBET_LAND_DIR) 30 | 31 | distclean_assets: distclean_sherbet_land 32 | -------------------------------------------------------------------------------- /assets/include/courses/wario_stadium.mk: -------------------------------------------------------------------------------- 1 | WARIO_STADIUM_DIR := assets/courses/wario_stadium 2 | 3 | WARIO_STADIUM_SIGN := \ 4 | $(WARIO_STADIUM_DIR)/gTextureWarioStadiumSignTopLeft.png \ 5 | $(WARIO_STADIUM_DIR)/gTextureWarioStadiumSignBottomLeft.png \ 6 | $(WARIO_STADIUM_DIR)/gTextureWarioStadiumSignTopRight.png \ 7 | $(WARIO_STADIUM_DIR)/gTextureWarioStadiumSignBottomRight.png 8 | 9 | WARIO_STADIUM_EXPORT_SENTINEL := $(WARIO_STADIUM_DIR)/.export 10 | 11 | $(BUILD_DIR)/courses/wario_stadium/course_data.o: $(WARIO_STADIUM_SIGN:%.png=%.inc.c) 12 | 13 | $(WARIO_STADIUM_SIGN:%.png=%.inc.c): %.inc.c : %.png 14 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 15 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 16 | 17 | $(WARIO_STADIUM_SIGN): $(WARIO_STADIUM_EXPORT_SENTINEL) ; 18 | 19 | $(WARIO_STADIUM_EXPORT_SENTINEL): $(ASSET_DIR)/courses/wario_stadium.json 20 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 21 | $(V)$(TOUCH) $@ 22 | 23 | .PHONY: distclean_wario_stadium 24 | distclean_wario_stadium: 25 | rm -rf $(WARIO_STADIUM_DIR) 26 | 27 | distclean_assets: distclean_wario_stadium 28 | -------------------------------------------------------------------------------- /assets/include/debug_font.mk: -------------------------------------------------------------------------------- 1 | DEBUG_FONT_DIR := assets/debug_font 2 | 3 | DEBUG_FONT_PALETTE := $(DEBUG_FONT_DIR)/common_tlut_debug_font.png 4 | 5 | DEBUG_FONT_PNG := $(DEBUG_FONT_DIR)/common_texture_debug_font.png 6 | 7 | DEBUG_FONT_EXPORT_SENTINEL := $(DEBUG_FONT_DIR)/.export 8 | 9 | $(BUILD_DIR)/src/data/common_textures.o: $(DEBUG_FONT_PNG:%.png=%.inc.c) $(DEBUG_FONT_PALETTE:%.png=%.inc.c) 10 | 11 | $(DEBUG_FONT_PNG:%.png=%.inc.c): %.inc.c : %.png 12 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 13 | $(V)$(N64GRAPHICS) -Z $@ -g $< -s u8 -f ci4 -c rgba16 -p $(DEBUG_FONT_PALETTE) 14 | 15 | $(DEBUG_FONT_PALETTE:%.png=%.inc.c): %.inc.c : %.png 16 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 17 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 18 | 19 | $(DEBUG_FONT_PNG) $(DEBUG_FONT_PALETTE): $(DEBUG_FONT_EXPORT_SENTINEL) ; 20 | 21 | $(DEBUG_FONT_EXPORT_SENTINEL): $(ASSET_DIR)/debug_font.json 22 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 23 | $(V)$(TOUCH) $@ 24 | 25 | .PHONY: distclean_debug_font 26 | distclean_debug_font: 27 | rm -rf $(DEBUG_FONT_DIR) 28 | 29 | distclean_assets: distclean_debug_font 30 | -------------------------------------------------------------------------------- /assets/include/ending_ceremony.mk: -------------------------------------------------------------------------------- 1 | ENDING_CEREMONY := assets/ending_ceremony 2 | 3 | TROHPY_PNG := \ 4 | $(ENDING_CEREMONY)/gTextureReflectionMapBrass.png \ 5 | $(ENDING_CEREMONY)/gTextureReflectionMapSilver.png \ 6 | $(ENDING_CEREMONY)/gTextureReflectionMapGold.png 7 | 8 | PODIUM_PNG := \ 9 | $(ENDING_CEREMONY)/gTexturePodium1.png \ 10 | $(ENDING_CEREMONY)/gTexturePodium2.png \ 11 | $(ENDING_CEREMONY)/gTexturePodium3.png 12 | 13 | ENDING_CEREMONY_EXPORT_SENTINEL := $(ENDING_CEREMONY)/.export 14 | 15 | $(BUILD_DIR)/src/ending/ceremony_data.o: $(TROHPY_PNG:%.png=%.inc.c) $(PODIUM_PNG:%.png=%.inc.c) 16 | 17 | $(TROHPY_PNG:%.png=%.inc.c) $(PODIUM_PNG:%.png=%.inc.c): %.inc.c : %.png 18 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 19 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 20 | 21 | $(TROHPY_PNG) $(PODIUM_PNG): $(ENDING_CEREMONY_EXPORT_SENTINEL) ; 22 | 23 | $(ENDING_CEREMONY_EXPORT_SENTINEL): $(ASSET_DIR)/ending_ceremony.json 24 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 25 | $(V)$(TOUCH) $@ 26 | 27 | .PHONY: distclean_ending_ceremony 28 | distclean_ending_ceremony: 29 | rm -rf $(ENDING_CEREMONY) 30 | 31 | distclean_assets: distclean_ending_ceremony 32 | -------------------------------------------------------------------------------- /assets/include/lakitu/fishing.mk: -------------------------------------------------------------------------------- 1 | FISHING_DIR := assets/lakitu/fishing 2 | 3 | FISHING_PALETTE := $(FISHING_DIR)/common_tlut_lakitu_fishing.png 4 | 5 | FISHING_FRAMES := \ 6 | $(FISHING_DIR)/gTextureLakituFishing1.png \ 7 | $(FISHING_DIR)/gTextureLakituFishing2.png \ 8 | $(FISHING_DIR)/gTextureLakituFishing3.png \ 9 | $(FISHING_DIR)/gTextureLakituFishing4.png 10 | 11 | FISHING_EXPORT_SENTINEL := $(FISHING_DIR)/.export 12 | 13 | $(BUILD_DIR)/$(DATA_DIR)/other_textures.o: $(FISHING_FRAMES:%.png=%.bin) 14 | 15 | $(FISHING_FRAMES:%.png=%.bin): %.bin : %.png 16 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 17 | $(V)$(N64GRAPHICS) -Z $@ -g $< -s raw -f ci8 -c rgba16 -p $(FISHING_PALETTE) 18 | 19 | $(BUILD_DIR)/src/data/common_textures.o: $(FISHING_PALETTE:%.png=%.inc.c) 20 | 21 | $(FISHING_PALETTE:%.png=%.inc.c): %.inc.c : %.png 22 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 23 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 24 | 25 | $(FISHING_FRAMES) $(FISHING_PALETTE): $(FISHING_EXPORT_SENTINEL) ; 26 | 27 | $(FISHING_EXPORT_SENTINEL): assets/lakitu/fishing.json 28 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 29 | $(V)$(TOUCH) $@ 30 | 31 | .PHONY: distclean_lakitu_fishing 32 | distclean_lakitu_fishing: 33 | rm -rf $(FISHING_DIR) 34 | 35 | distclean_assets: distclean_lakitu_fishing 36 | -------------------------------------------------------------------------------- /assets/include/minimap_icons.mk: -------------------------------------------------------------------------------- 1 | MINIMAP_ICONS_DIR := assets/minimap_icons 2 | 3 | MINIMAP_ICONS_PNG := \ 4 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_finish_line.png \ 5 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_mario.png \ 6 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_luigi.png \ 7 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_yoshi.png \ 8 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_toad.png \ 9 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_donkey_kong.png \ 10 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_wario.png \ 11 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_peach.png \ 12 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_kart_bowser.png \ 13 | $(MINIMAP_ICONS_DIR)/common_texture_minimap_progress_dot.png 14 | 15 | MINIMAP_ICONS_EXPORT_SENTINEL := $(MINIMAP_ICONS_DIR)/.export 16 | 17 | $(BUILD_DIR)/src/data/common_textures.o: $(MINIMAP_ICONS_PNG:%.png=%.inc.c) 18 | 19 | $(MINIMAP_ICONS_PNG:%.png=%.inc.c): %.inc.c : %.png 20 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 21 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 22 | 23 | $(MINIMAP_ICONS_PNG): $(MINIMAP_ICONS_EXPORT_SENTINEL) ; 24 | 25 | $(MINIMAP_ICONS_EXPORT_SENTINEL): $(ASSET_DIR)/minimap_icons.json 26 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 27 | $(V)$(TOUCH) $@ 28 | 29 | .PHONY: distclean_minimap_icons 30 | distclean_minimap_icons: 31 | rm -rf $(MINIMAP_ICONS_DIR) 32 | 33 | distclean_assets: distclean_minimap_icons 34 | -------------------------------------------------------------------------------- /assets/include/player_emblems.mk: -------------------------------------------------------------------------------- 1 | PLAYER_EMBLEM_DIR := assets/player_emblems 2 | 3 | PLAYER_EMBLEM_PALETTE := $(PLAYER_EMBLEM_DIR)/common_tlut_player_emblem.png 4 | 5 | PLAYER_EMBLEM_PNGS := \ 6 | $(PLAYER_EMBLEM_DIR)/common_texture_player_emblem_1p.png \ 7 | $(PLAYER_EMBLEM_DIR)/common_texture_player_emblem_2p.png \ 8 | $(PLAYER_EMBLEM_DIR)/common_texture_player_emblem_3p.png \ 9 | $(PLAYER_EMBLEM_DIR)/common_texture_player_emblem_4p.png 10 | 11 | PLAYER_EMBLEM_EXPORT_SENTINEL := $(PLAYER_EMBLEM_DIR)/.export 12 | 13 | $(BUILD_DIR)/src/data/common_textures.o: $(PLAYER_EMBLEM_PNGS:%.png=%.inc.c) $(PLAYER_EMBLEM_PALETTE:%.png=%.inc.c) 14 | 15 | $(PLAYER_EMBLEM_PNGS:%.png=%.inc.c): %.inc.c : %.png 16 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 17 | $(V)$(N64GRAPHICS) -Z $@ -g $< -s u8 -f ci8 -c rgba16 -p $(PLAYER_EMBLEM_PALETTE) 18 | 19 | $(PLAYER_EMBLEM_PALETTE:%.png=%.inc.c): %.inc.c : %.png 20 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 21 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 22 | 23 | $(PLAYER_EMBLEM_PNGS) $(PLAYER_EMBLEM_PALETTE): $(PLAYER_EMBLEM_EXPORT_SENTINEL) ; 24 | 25 | $(PLAYER_EMBLEM_EXPORT_SENTINEL): $(ASSET_DIR)/player_emblems.json 26 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 27 | $(V)$(TOUCH) $@ 28 | 29 | .PHONY: distclean_player_emblems 30 | distclean_player_emblems: 31 | rm -rf $(PLAYER_EMBLEM_DIR) 32 | 33 | distclean_assets: distclean_player_emblems 34 | -------------------------------------------------------------------------------- /assets/include/startup_logo.mk: -------------------------------------------------------------------------------- 1 | STARTUP_LOGO := assets/startup_logo 2 | 3 | REFLECTION_MAP := $(STARTUP_LOGO)/gTextureReflectionMapGold.png 4 | 5 | STARTUP_LOGO_EXPORT_SENTINEL := $(STARTUP_LOGO)/.export 6 | 7 | $(BUILD_DIR)/src/data/startup_logo.o: $(REFLECTION_MAP:%.png=%.inc.c) 8 | 9 | $(REFLECTION_MAP:%.png=%.inc.c): %.inc.c : %.png 10 | @$(PRINT) "$(GREEN)Converting: $(BLUE) $< -> $@$(NO_COL)\n" 11 | $(V)$(N64GRAPHICS) -i $@ -g $< -s u8 -f rgba16 12 | 13 | $(REFLECTION_MAP): $(STARTUP_LOGO_EXPORT_SENTINEL) ; 14 | 15 | $(STARTUP_LOGO_EXPORT_SENTINEL): $(ASSET_DIR)/startup_logo.json 16 | $(V)$(ASSET_EXTRACT) $(BASEROM) $< 17 | $(V)$(TOUCH) $@ 18 | 19 | .PHONY: distclean_startup_logo 20 | distclean_startup_logo: 21 | rm -rf $(STARTUP_LOGO) 22 | 23 | distclean_assets: distclean_startup_logo 24 | -------------------------------------------------------------------------------- /assets/lakitu/fishing.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_lakitu_fishing": {"output_dir": "fishing", "rom_offset": "0x132B50", "block_offset": "0x25CD8", "width": 16, "height": 16, "type": "rgba16"}, 3 | "gTextureLakituFishing1": {"output_dir": "fishing", "rom_offset": "0x70EEC0", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_fishing"}, 4 | "gTextureLakituFishing2": {"output_dir": "fishing", "rom_offset": "0x70FE80", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_fishing"}, 5 | "gTextureLakituFishing3": {"output_dir": "fishing", "rom_offset": "0x710E40", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_fishing"}, 6 | "gTextureLakituFishing4": {"output_dir": "fishing", "rom_offset": "0x711E00", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_fishing"} 7 | } 8 | -------------------------------------------------------------------------------- /assets/lakitu/nolights.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_lakitu_no_lights": {"output_dir": "nolights", "rom_offset": "0x132B50", "block_offset": "0x24ED8", "width": 16, "height": 16, "type": "rgba16"}, 3 | "gTextureLakituNoLights1": {"output_dir": "nolights", "rom_offset": "0x6A0AC0", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 4 | "gTextureLakituNoLights2": {"output_dir": "nolights", "rom_offset": "0x6A1A80", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 5 | "gTextureLakituNoLights3": {"output_dir": "nolights", "rom_offset": "0x6A2A40", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 6 | "gTextureLakituNoLights4": {"output_dir": "nolights", "rom_offset": "0x6A3A00", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 7 | "gTextureLakituNoLights5": {"output_dir": "nolights", "rom_offset": "0x6A49C0", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 8 | "gTextureLakituNoLights6": {"output_dir": "nolights", "rom_offset": "0x6A5980", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 9 | "gTextureLakituNoLights7": {"output_dir": "nolights", "rom_offset": "0x6A6940", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"}, 10 | "gTextureLakituNoLights8": {"output_dir": "nolights", "rom_offset": "0x6A7900", "width": 56, "height": 72, "type": "ci8", "tlut": "common_tlut_lakitu_no_lights"} 11 | } 12 | -------------------------------------------------------------------------------- /assets/onomatopoeia.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTLUTOnomatopoeia": {"output_dir": "onomatopoeia", "rom_offset": "0xE5ED0", "width": 16, "height": 16, "type": "rgba16"}, 3 | "gTextureOnomatopoeiaCrash1": {"output_dir": "onomatopoeia", "rom_offset": "0x69F158", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 4 | "gTextureOnomatopoeiaCrash2": {"output_dir": "onomatopoeia", "rom_offset": "0x69F390", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 5 | "gTextureOnomatopoeiaWhrrrr1": {"output_dir": "onomatopoeia", "rom_offset": "0x69F5E4", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 6 | "gTextureOnomatopoeiaWhrrrr2": {"output_dir": "onomatopoeia", "rom_offset": "0x69F9C0", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 7 | "gTextureOnomatopoeiaPoomp1": {"output_dir": "onomatopoeia", "rom_offset": "0x69FD6C", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 8 | "gTextureOnomatopoeiaPoomp2": {"output_dir": "onomatopoeia", "rom_offset": "0x69FF30", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 9 | "gTextureBalloon1": {"output_dir": "onomatopoeia", "rom_offset": "0x6A010C", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"}, 10 | "gTextureBalloon2": {"output_dir": "onomatopoeia", "rom_offset": "0x6A0350", "width": 64, "height": 32, "type": "ci8", "tlut": "gTLUTOnomatopoeia"} 11 | } 12 | -------------------------------------------------------------------------------- /assets/player_emblems.json: -------------------------------------------------------------------------------- 1 | { 2 | "common_tlut_player_emblem": {"output_dir": "player_emblems", "rom_offset": "0x132B50", "block_offset": "0x17258", "width": 16, "height": 16, "type": "rgba16"}, 3 | "common_texture_player_emblem_1p": {"output_dir": "player_emblems", "rom_offset": "0x132B50", "block_offset": "0x17458", "width": 64, "height": 32, "type": "ci8", "tlut": "common_tlut_player_emblem"}, 4 | "common_texture_player_emblem_2p": {"output_dir": "player_emblems", "rom_offset": "0x132B50", "block_offset": "0x17C58", "width": 64, "height": 32, "type": "ci8", "tlut": "common_tlut_player_emblem"}, 5 | "common_texture_player_emblem_3p": {"output_dir": "player_emblems", "rom_offset": "0x132B50", "block_offset": "0x18458", "width": 64, "height": 32, "type": "ci8", "tlut": "common_tlut_player_emblem"}, 6 | "common_texture_player_emblem_4p": {"output_dir": "player_emblems", "rom_offset": "0x132B50", "block_offset": "0x18C58", "width": 64, "height": 32, "type": "ci8", "tlut": "common_tlut_player_emblem"} 7 | } 8 | -------------------------------------------------------------------------------- /assets/startup_logo.json: -------------------------------------------------------------------------------- 1 | { 2 | "gTextureReflectionMapGold": {"output_dir": "startup_logo", "rom_offset": "0x825800", "block_offset": "0x8A48", "width": 32, "height": 32, "type": "rgba16"} 3 | } -------------------------------------------------------------------------------- /config.yml: -------------------------------------------------------------------------------- 1 | 579c48e211ae952530ffc8738709f078d5dd215e: 2 | name: Mario Kart 64 [US] 3 | path: yamls/us 4 | config: 5 | gbi: F3DEX_MK64 6 | sort: OFFSET 7 | enums: 8 | - include/defines.h 9 | output: 10 | binary: mkcube.otr 11 | headers: include/assets 12 | code: assets/code 13 | metadata: [yamls/courses] 14 | segments: 15 | - 0x000000 16 | - 0x000000 17 | - 0x12AAE0 18 | - 0x000000 19 | - 0x000000 20 | - 0x000000 21 | - 0x825800 22 | - 0x000000 23 | - 0x000000 24 | - 0x88CD70 25 | - 0x729A30 26 | - 0x821D10 27 | - 0x7FA3C0 28 | - 0x132B50 29 | - 0x000000 30 | - 0x145470 31 | -------------------------------------------------------------------------------- /courses/all_course_data.h: -------------------------------------------------------------------------------- 1 | #ifndef ALL_COURSE_DATA_H 2 | #define ALL_COURSE_DATA_H 3 | 4 | #include "courses/big_donut/course_data.h" 5 | #include "courses/block_fort/course_data.h" 6 | #include "courses/double_deck/course_data.h" 7 | #include "courses/skyscraper/course_data.h" 8 | #include "courses/choco_mountain/course_data.h" 9 | #include "courses/frappe_snowland/course_data.h" 10 | #include "courses/mario_raceway/course_data.h" 11 | #include "courses/toads_turnpike/course_data.h" 12 | #include "courses/kalimari_desert/course_data.h" 13 | #include "courses/koopa_troopa_beach/course_data.h" 14 | #include "courses/luigi_raceway/course_data.h" 15 | #include "courses/moo_moo_farm/course_data.h" 16 | #include "courses/banshee_boardwalk/course_data.h" 17 | #include "courses/dks_jungle_parkway/course_data.h" 18 | #include "courses/rainbow_road/course_data.h" 19 | #include "courses/yoshi_valley/course_data.h" 20 | #include "courses/bowsers_castle/course_data.h" 21 | #include "courses/royal_raceway/course_data.h" 22 | #include "courses/sherbet_land/course_data.h" 23 | #include "courses/wario_stadium/course_data.h" 24 | 25 | #endif // ALL_COURSE_DATA_H 26 | -------------------------------------------------------------------------------- /courses/big_donut/course_data.h: -------------------------------------------------------------------------------- 1 | #ifndef BIG_DONUT_COURSE_DATA_H 2 | #define BIG_DONUT_COURSE_DATA_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern Gfx d_course_big_donut_dl[]; 9 | extern struct ActorSpawnData d_course_big_donut_item_box_spawns[]; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /courses/big_donut/course_displaylists.inc.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "macros.h" 3 | 4 | extern Gfx d_course_big_donut_packed_dl_0[]; 5 | extern Gfx d_course_big_donut_packed_dl_210[]; 6 | extern Gfx d_course_big_donut_packed_dl_220[]; 7 | extern Gfx d_course_big_donut_packed_dl_230[]; 8 | extern Gfx d_course_big_donut_packed_dl_240[]; 9 | extern Gfx d_course_big_donut_packed_dl_450[]; 10 | extern Gfx d_course_big_donut_packed_dl_460[]; 11 | extern Gfx d_course_big_donut_packed_dl_AC0[]; 12 | extern Gfx d_course_big_donut_packed_dl_AD0[]; 13 | extern Gfx d_course_big_donut_packed_dl_B58[]; 14 | extern Gfx d_course_big_donut_packed_dl_D20[]; 15 | extern Gfx d_course_big_donut_packed_dl_D38[]; 16 | extern Gfx d_course_big_donut_packed_dl_DE8[]; 17 | extern Gfx d_course_big_donut_packed_dl_DF8[]; 18 | extern Gfx d_course_big_donut_packed_dl_E80[]; 19 | extern Gfx d_course_big_donut_packed_dl_F08[]; 20 | extern Gfx d_course_big_donut_packed_dl_F90[]; 21 | extern Gfx d_course_big_donut_packed_dl_1018[]; 22 | extern Gfx d_course_big_donut_packed_dl_1040[]; 23 | extern Gfx d_course_big_donut_packed_dl_1070[2]; 24 | 25 | #define d_course_big_donut_packed_end GET_PACKED_END(d_course_big_donut_packed_dl_1070) 26 | -------------------------------------------------------------------------------- /courses/big_donut/course_offsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "course_offsets.h" 3 | 4 | extern u8 gTexture66ABA4[]; 5 | extern u8 gTexture6747C4[]; 6 | extern u8 gTexture67490C[]; 7 | extern u8 gTexture64BA50[]; 8 | 9 | const course_texture big_donut_textures[] = { 10 | { gTexture66ABA4, 0x0312, 0x0800, 0x0 }, { gTexture6747C4, 0x0145, 0x0800, 0x0 }, 11 | { gTexture67490C, 0x021C, 0x0800, 0x0 }, { gTexture64BA50, 0x0110, 0x0800, 0x0 }, 12 | { 0x00000000, 0x0000, 0x0000, 0x0 }, 13 | }; 14 | -------------------------------------------------------------------------------- /courses/block_fort/course_data.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOCK_FORT_COURSE_DATA_H 2 | #define BLOCK_FORT_COURSE_DATA_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern Gfx d_course_block_fort_dl[]; 9 | extern struct ActorSpawnData d_course_block_fort_item_box_spawns[]; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /courses/block_fort/course_offsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "course_offsets.h" 3 | 4 | extern u8 gTexture64286C[]; 5 | extern u8 gTextureGrayCheckerboard[]; 6 | extern u8 gTextureGrayCobblestone[]; 7 | extern u8 gTexture64275C[]; 8 | extern u8 gTexture642978[]; 9 | extern u8 gTexture6747C4[]; 10 | extern u8 gTexture6442D4[]; 11 | 12 | const course_texture block_fort_textures[] = { 13 | { gTexture64286C, 0x010A, 0x0800, 0x0 }, { gTextureGrayCheckerboard, 0x010C, 0x0800, 0x0 }, 14 | { gTextureGrayCobblestone, 0x010C, 0x0800, 0x0 }, { gTexture64275C, 0x0110, 0x0800, 0x0 }, 15 | { gTexture642978, 0x010D, 0x0800, 0x0 }, { gTexture6747C4, 0x0145, 0x0800, 0x0 }, 16 | { gTexture6442D4, 0x0138, 0x0800, 0x0 }, { 0x00000000, 0x0000, 0x0000, 0x0 }, 17 | }; 18 | -------------------------------------------------------------------------------- /courses/double_deck/course_data.h: -------------------------------------------------------------------------------- 1 | #ifndef DOUBLE_DECK_COURSE_DATA_H 2 | #define DOUBLE_DECK_COURSE_DATA_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern Gfx d_course_double_deck_dl[]; 9 | extern struct ActorSpawnData d_course_double_deck_item_box_spawns[]; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /courses/double_deck/course_displaylists.inc.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "macros.h" 3 | 4 | extern Gfx d_course_double_deck_packed_dl_0[]; 5 | extern Gfx d_course_double_deck_packed_dl_210[]; 6 | extern Gfx d_course_double_deck_packed_dl_3A0[]; 7 | extern Gfx d_course_double_deck_packed_dl_3B8[]; 8 | extern Gfx d_course_double_deck_packed_dl_580[]; 9 | extern Gfx d_course_double_deck_packed_dl_708[]; 10 | extern Gfx d_course_double_deck_packed_dl_720[]; 11 | extern Gfx d_course_double_deck_packed_dl_738[]; 12 | extern Gfx d_course_double_deck_packed_dl_748[1]; 13 | 14 | #define d_course_double_deck_packed_end GET_PACKED_END(d_course_double_deck_packed_dl_748) 15 | -------------------------------------------------------------------------------- /courses/double_deck/course_offsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "course_offsets.h" 3 | 4 | extern u8 gTextureGrayCobblestone[]; 5 | extern u8 gTexture642978[]; 6 | 7 | const course_texture double_deck_textures[] = { 8 | { gTextureGrayCobblestone, 0x010C, 0x0800, 0x0 }, 9 | { gTexture642978, 0x010D, 0x0800, 0x0 }, 10 | { 0x00000000, 0x0000, 0x0000, 0x0 }, 11 | }; 12 | -------------------------------------------------------------------------------- /courses/frappe_snowland/course_offsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "course_offsets.h" 3 | 4 | extern u8 gTexture6684F8[]; 5 | extern u8 gTexture66CA98[]; 6 | extern u8 gTexture66EBF0[]; 7 | extern u8 gTexture675434[]; 8 | extern u8 gTexture677F04[]; 9 | extern u8 gTexture678118[]; 10 | extern u8 gTexture679258[]; 11 | extern u8 gTexture67973C[]; 12 | 13 | const course_texture frappe_snowland_textures[] = { 14 | { gTexture6684F8, 0x010D, 0x0800, 0x0 }, { gTexture66CA98, 0x02C9, 0x0800, 0x0 }, 15 | { gTexture66EBF0, 0x0146, 0x0800, 0x0 }, { gTexture675434, 0x0245, 0x0800, 0x0 }, 16 | { gTexture677F04, 0x0213, 0x0800, 0x0 }, { gTexture678118, 0x0314, 0x0800, 0x0 }, 17 | { gTexture679258, 0x04E3, 0x1000, 0x0 }, { gTexture67973C, 0x04C6, 0x1000, 0x0 }, 18 | { 0x00000000, 0x0000, 0x0000, 0x0 }, 19 | }; 20 | -------------------------------------------------------------------------------- /courses/rainbow_road/course_offsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "course_offsets.h" 3 | 4 | extern u8 gTextureStarOutline[]; 5 | extern u8 gTexture67A1B8[]; 6 | extern u8 gTextureCheckerboardBlackWhite[]; 7 | extern u8 gTexture662A34[]; 8 | extern u8 gTextureRainbow[]; 9 | 10 | const course_texture rainbow_road_textures[] = { 11 | { gTextureStarOutline, 0x037A, 0x0800, 0x0 }, 12 | { gTexture67A1B8, 0x01B7, 0x0800, 0x0 }, 13 | { gTextureCheckerboardBlackWhite, 0x0107, 0x0800, 0x0 }, 14 | { gTexture662A34, 0x0106, 0x0800, 0x0 }, 15 | { gTextureRainbow, 0x025D, 0x1000, 0x0 }, 16 | { 0x00000000, 0x0000, 0x0000, 0x0 }, 17 | }; 18 | -------------------------------------------------------------------------------- /courses/skyscraper/course_data.h: -------------------------------------------------------------------------------- 1 | #ifndef SKYSCRAPER_COURSE_DATA_H 2 | #define SKYSCRAPER_COURSE_DATA_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | extern Gfx d_course_skyscraper_dl[]; 9 | extern struct ActorSpawnData d_course_skyscraper_item_box_spawns[]; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /courses/skyscraper/course_displaylists.inc.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "macros.h" 3 | 4 | extern Gfx d_course_skyscraper_packed_dl_0[]; 5 | extern Gfx d_course_skyscraper_packed_dl_238[]; 6 | extern Gfx d_course_skyscraper_packed_dl_248[]; 7 | extern Gfx d_course_skyscraper_packed_dl_258[]; 8 | extern Gfx d_course_skyscraper_packed_dl_268[]; 9 | extern Gfx d_course_skyscraper_packed_dl_570[]; 10 | extern Gfx d_course_skyscraper_packed_dl_580[]; 11 | extern Gfx d_course_skyscraper_packed_dl_6B8[]; 12 | extern Gfx d_course_skyscraper_packed_dl_6C8[]; 13 | extern Gfx d_course_skyscraper_packed_dl_8D8[]; 14 | extern Gfx d_course_skyscraper_packed_dl_B70[]; 15 | extern Gfx d_course_skyscraper_packed_dl_B88[]; 16 | extern Gfx d_course_skyscraper_packed_dl_C60[]; 17 | extern Gfx d_course_skyscraper_packed_dl_C70[]; 18 | extern Gfx d_course_skyscraper_packed_dl_FE8[]; 19 | extern Gfx d_course_skyscraper_packed_dl_FF8[]; 20 | extern Gfx d_course_skyscraper_packed_dl_10C8[]; 21 | extern Gfx d_course_skyscraper_packed_dl_10D8[]; 22 | extern Gfx d_course_skyscraper_packed_dl_1110[2]; 23 | 24 | #define d_course_skyscraper_packed_end GET_PACKED_END(d_course_skyscraper_packed_dl_1110) 25 | -------------------------------------------------------------------------------- /courses/staff_ghost_data.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | /* 6 | * This file is required for data alignment 7 | * 8 | */ 9 | 10 | StaffGhost d_mario_raceway_staff_ghost[] = { 11 | #include "courses/mario_raceway/staff_ghost.inc.c" 12 | }; 13 | 14 | StaffGhost d_luigi_raceway_staff_ghost[1046] = { 15 | #include "courses/luigi_raceway/staff_ghost.inc.c" 16 | }; 17 | 18 | StaffGhost d_royal_raceway_staff_ghost[] = { 19 | #include "courses/royal_raceway/staff_ghost.inc.c" 20 | }; 21 | 22 | // Unknown data. Perhaps colour or lights 23 | s32 D_0F4FCAD0[] = { 0x00000000, 0xc8c8c8c8, 0xc8c80000, 0x00007b39, 0x6f6f6f6f, 24 | 0x6f6f6f6f, 0x3f7b0000, 0x0000c8c8, 0xc8c8c8c8, 0xc8000000 }; 25 | -------------------------------------------------------------------------------- /courses/yoshi_valley/course_offsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "course_offsets.h" 3 | 4 | extern u8 gTexture66EBF0[]; 5 | extern u8 gTextureWoodBridgeSlats[]; 6 | extern u8 gTexture65E2EC[]; 7 | extern u8 gTexture6846DC[]; 8 | extern u8 gTextureFenceRope[]; 9 | extern u8 gTexture685108[]; 10 | extern u8 gTexture64CC20[]; 11 | extern u8 gTextureGrass4[]; 12 | extern u8 gTexture6775EC[]; 13 | extern u8 gTexture68E2D0[]; 14 | extern u8 gTextureCheckerboardBlackWhite[]; 15 | extern u8 gTexture643B3C[]; 16 | extern u8 gTextureSignWoodRedArrow[]; 17 | extern u8 gTexture68DEC0[]; 18 | 19 | const course_texture yoshi_valley_textures[] = { 20 | { gTexture66EBF0, 0x0146, 0x0800, 0x0 }, 21 | { gTextureWoodBridgeSlats, 0x0DAB, 0x1000, 0x0 }, 22 | { gTexture65E2EC, 0x02B0, 0x0800, 0x0 }, 23 | { gTexture6846DC, 0x04EA, 0x0800, 0x0 }, 24 | { gTextureFenceRope, 0x0540, 0x0800, 0x0 }, 25 | { gTexture685108, 0x04D4, 0x0800, 0x0 }, 26 | { gTexture64CC20, 0x0EC3, 0x1000, 0x0 }, 27 | { gTextureGrass4, 0x05C3, 0x0800, 0x0 }, 28 | { gTexture6775EC, 0x0233, 0x1000, 0x0 }, 29 | { gTexture68E2D0, 0x087F, 0x0800, 0x0 }, 30 | { gTextureCheckerboardBlackWhite, 0x0107, 0x0800, 0x0 }, 31 | { gTexture643B3C, 0x0798, 0x0800, 0x0 }, 32 | { gTextureSignWoodRedArrow, 0x04E1, 0x1000, 0x0 }, 33 | { gTexture68DEC0, 0x0410, 0x0800, 0x0 }, 34 | { 0x00000000, 0x0000, 0x0000, 0x0 }, 35 | }; 36 | -------------------------------------------------------------------------------- /data/rsp.s: -------------------------------------------------------------------------------- 1 | # Mario Kart 64 (U) disassembly and split file 2 | # generated by n64split v0.4a - N64 ROM splitter 3 | 4 | .include "macros.inc" 5 | 6 | .section .text, "ax" 7 | 8 | # 0x800D8F70 D9B70-D9C40 9 | glabel rspF3DBootStart 10 | .incbin "bin/lib/PR/boot/F3D_boot.bin" 11 | glabel rspF3DBootEnd 12 | 13 | # 0x800D9040 D9C40-DB020 14 | glabel gspF3DEXTextStart 15 | .incbin "bin/lib/PR/f3d/F3DEX.bin" 16 | glabel gspF3DEXTextEnd 17 | 18 | # 0x800DA420 DB020-DC430 19 | glabel gspF3DLXTextStart 20 | .incbin "bin/lib/PR/f3d/F3DLX.bin" 21 | glabel gspF3DLXTextEnd 22 | 23 | # 0x800DB830 DC430-DD0A0 24 | glabel rspAspMainStart 25 | .incbin "bin/lib/PR/audio/aspMain.bin" 26 | glabel rspAspMainEnd 27 | 28 | .section .data 29 | 30 | # 0x800F3D00 F4900-F5100 31 | glabel gspF3DEXDataStart 32 | .incbin "bin/lib/PR/f3d/F3DEX_data.bin" 33 | glabel gspF3DEXDataEnd 34 | 35 | # 0x800F4500 F5100-F5900 36 | glabel gspF3DLXDataStart 37 | .incbin "bin/lib/PR/f3d/F3DLX_data.bin" 38 | glabel gspF3DLXDataEnd 39 | 40 | # 0x800F4D00 F5900-F5C00 41 | glabel rspAspMainDataStart 42 | .incbin "bin/lib/PR/audio/aspMain_data.bin" 43 | glabel rspAspMainDataEnd 44 | -------------------------------------------------------------------------------- /data/sound_data/audiobanks.s: -------------------------------------------------------------------------------- 1 | # Mario Kart 64 (U) disassembly and split file 2 | # generated by n64split v0.4a - N64 ROM splitter 3 | 4 | .include "macros.inc" 5 | 6 | .section .data 7 | 8 | # Audiobank data 9 | 10 | .ifdef VERSION_EU_V10 11 | .incbin "bin/audiobanks.eu.bin" 12 | .else 13 | .incbin "bin/audiobanks.us.bin" 14 | .endif 15 | -------------------------------------------------------------------------------- /data/sound_data/audiotables.s: -------------------------------------------------------------------------------- 1 | # Mario Kart 64 (U) disassembly and split file 2 | # generated by n64split v0.4a - N64 ROM splitter 3 | 4 | .include "macros.inc" 5 | 6 | .section .data 7 | 8 | .incbin "bin/audiotables.bin" # Audiotables and data 9 | 10 | -------------------------------------------------------------------------------- /diff: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # note, this quick hack only works with five arguments. 4 | # if you're trying to use six arguments, you need to add another `$6` etc. 5 | 6 | python3 tools/asm-differ/diff.py $1 $2 $3 $4 $5 $6 $7 $8 7 | 8 | -------------------------------------------------------------------------------- /diff_settings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | def add_custom_arguments(parser): 4 | group = parser.add_mutually_exclusive_group(required=False) 5 | group.add_argument('-u', dest='lang', action='store_const', const='us', 6 | help="Set version to US.") 7 | group.add_argument('-eu10', dest='lang', action='store_const', const='eu.v10', 8 | help="Set version to EU 1.0.") 9 | group.add_argument('-eu11', dest='lang', action='store_const', const='eu.v11', 10 | help="Set version to EU 1.1.") 11 | 12 | def apply(config, args): 13 | lang = args.lang or 'us' 14 | config['mapfile'] = f'build/{lang}/mk64.{lang}.map' 15 | config['myimg'] = f'build/{lang}/mk64.{lang}.z64' 16 | config['baseimg'] = f'baserom.{lang}.z64' 17 | config['makeflags'] = [f'VERSION={lang}'] 18 | config['source_directories'] = ['.'] 19 | -------------------------------------------------------------------------------- /docs/actors/items.md: -------------------------------------------------------------------------------- 1 | @page items Items 2 | -------------------------------------------------------------------------------- /docs/actors/objects.md: -------------------------------------------------------------------------------- 1 | @page objects Objects 2 | # Objects 3 | -------------------------------------------------------------------------------- /docs/actors/vehicles.md: -------------------------------------------------------------------------------- 1 | @page vehicles Vehicles 2 | 3 | [TOC] 4 | 5 | See vehicles.h for defines and other configurable options. This includes how many of each vehicle to spawn. 6 | 7 | The game evenly disperses vehicles around their path even when spawning extra vehicles. 8 | 9 | # Trains 10 | * Follows a path containing only an x and z coordinate. 11 | * Y coordinate is hard-coded. 12 | * Some of the train path is generated to save space. 13 | 14 | 15 | # Cars & Trucks 16 | 17 | 18 | # Boats 19 | -------------------------------------------------------------------------------- /docs/basics/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/docs/basics/placeholder.png -------------------------------------------------------------------------------- /docs/courses/courses.md: -------------------------------------------------------------------------------- 1 | \page courses Courses 2 | # Courses 3 | 4 | -------------------------------------------------------------------------------- /docs/coursesmenu.md: -------------------------------------------------------------------------------- 1 | @page coursesmenu Courses 2 | 3 | @htmlonly 4 | 5 | How courses work in mk64 6 |

7 | 8 | 21 | 22 | 23 | 36 | 37 | @endhtmlonly 38 | 39 | @subpage courses 40 | @subpage surfacetypes 41 | 42 | -------------------------------------------------------------------------------- /docs/html/buttonimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/docs/html/buttonimage.png -------------------------------------------------------------------------------- /docs/images/buttonimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/docs/images/buttonimage.png -------------------------------------------------------------------------------- /docs/tutorials.md: -------------------------------------------------------------------------------- 1 | @page tutorials Tutorials 2 | Topics discussing how to work with certain features. 3 | 4 | @htmlonly 5 |
6 | 19 | 32 | 33 | 46 | @endhtmlonly 47 | 48 | @subpage boostramps 49 | @subpage paths 50 | @subpage tutorialaudio 51 | -------------------------------------------------------------------------------- /docs/tutorials/audio.md: -------------------------------------------------------------------------------- 1 | @page tutorialaudio Audio 2 | -------------------------------------------------------------------------------- /docs/tutorials/boostramps.md: -------------------------------------------------------------------------------- 1 | \page boostramps Boost Ramps 2 | # Boost Ramps 3 | 4 | Boost ramps use a surface-type and is part of the course geography. 5 | -------------------------------------------------------------------------------- /docs/tutorials/paths.md: -------------------------------------------------------------------------------- 1 | @page paths Paths 2 | The game uses multiple types of course paths 3 | 4 | # Course Paths 5 | Used by courses 6 | 7 | 8 | # Horizontal Paths (no Y coordinate) 9 | Used by the train 10 | 11 | # Camera Rails 12 | Pathing for the camera during end of race scene, podium ceremony, and credits. 13 | -------------------------------------------------------------------------------- /enhancements/README.md: -------------------------------------------------------------------------------- 1 | # Mario Kart 64 Enhancements 2 | 3 | This directory contains unofficial patches to the source code that provide various features 4 | and enhancements. 5 | 6 | To apply a patch, run `tools/apply_patch.sh [patch]` where `[patch]` is the name of the 7 | .patch file you wish to apply. This will perform all of the patch's changes 8 | to the source code. 9 | 10 | Likewise, to undo the changes from a patch you applied, run 11 | `tools/revert_patch.sh` with the name of the .patch file you wish to undo. 12 | 13 | To create your own enhancement patch, switch to the `master` Git 14 | branch, make your changes to the code (but do not commit), then run `tools/create_patch.sh`. Your changes will be stored in the .patch file you specify. 15 | 16 | The following enhancements are included in this directory: 17 | 18 | ## Flycam - `flycam.patch` 19 | 20 | This enhancement provides a flycam mode. 21 | -------------------------------------------------------------------------------- /import: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # note, this quick hack only works with five arguments. 4 | # if you're trying to use six arguments, you need to add another `$6` etc. 5 | 6 | python3 tools/decomp-permuter/import.py $1 $2 $3 $4 $5 7 | 8 | -------------------------------------------------------------------------------- /include/PR/gu.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_GU_H_ 2 | #define _ULTRA64_GU_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define GU_PI 3.1415926 9 | /* Functions */ 10 | 11 | void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far, float scale); 12 | void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale); 13 | void guFrustum(Mtx* m, float left, float right, float bottom, float top, float near, float far, float scale); 14 | void guOrtho(Mtx* m, float left, float right, float bottom, float top, float near, float far, float scale); 15 | void guTranslate(Mtx* m, float x, float y, float z); 16 | void guRotate(Mtx* m, float a, float x, float y, float z); 17 | void guScale(Mtx* m, float x, float y, float z); 18 | void guMtxF2L(float mf[4][4], Mtx* m); 19 | void guMtxIdent(Mtx* m); 20 | void guMtxIdentF(float mf[4][4]); 21 | void guMtxL2F(float mf[4][4], Mtx* m); 22 | void guNormalize(float*, float*, float*); 23 | 24 | void guLookAt(Mtx*, f32, f32, f32, f32, f32, f32, f32, f32, f32); 25 | 26 | void guLookAtF(f32[4][4], f32, f32, f32, f32, f32, f32, f32, f32, f32); 27 | 28 | /* Used only in Fast3DEX2 */ 29 | void guLookAtReflect(Mtx* m, LookAt* l, float xEye, float yEye, float zEye, float xAt, float yAt, float zAt, float xUp, 30 | float yUp, float zUp); 31 | #endif 32 | -------------------------------------------------------------------------------- /include/PR/libaudio.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_LIBAUDIO_H_ 2 | #define _ULTRA64_LIBAUDIO_H_ 3 | 4 | #include "abi.h" 5 | 6 | typedef struct { 7 | u8* offset; 8 | s32 len; 9 | } ALSeqData; 10 | 11 | typedef struct { 12 | s16 revision; 13 | s16 seqCount; 14 | ALSeqData seqArray[1]; 15 | } ALSeqFile; 16 | 17 | void alSeqFileNew(ALSeqFile* f, u8* base); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /include/PR/libultra.h: -------------------------------------------------------------------------------- 1 | #ifndef _LIBULTRA_H 2 | #define _LIBULTRA_H 3 | 4 | #define TV_TYPE_NTSC 1 5 | #define TV_TYPE_PAL 0 6 | #define TV_TYPE_MPAL 2 7 | 8 | #define RESET_TYPE_COLD_RESET 0 9 | #define RESET_TYPE_NMI 1 10 | #define RESET_TYPE_BOOT_DISK 2 11 | 12 | extern u32 osTvType; 13 | extern u32 osRomBase; 14 | extern u32 osResetType; 15 | extern u32 osMemSize; 16 | extern s32 osAppNmiBuffer[16]; 17 | 18 | #endif /* _LIBULTRA_H */ 19 | -------------------------------------------------------------------------------- /include/PR/os_internal.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_OS_INTERNAL_H_ 2 | #define _ULTRA64_OS_INTERNAL_H_ 3 | 4 | /* Internal functions used by the operating system */ 5 | /* Do not include this header in application code */ 6 | 7 | /* Variables */ 8 | 9 | // extern u64 osClockRate; 10 | 11 | /* Functions */ 12 | 13 | /*u32 __osProbeTLB(void *); 14 | u32 __osDisableInt(void); 15 | void __osRestoreInt(u32);*/ 16 | OSThread* __osGetCurrFaultedThread(void); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /include/PR/os_libc.h: -------------------------------------------------------------------------------- 1 | #ifndef _OS_LIBC_H_ 2 | #define _OS_LIBC_H_ 3 | 4 | #include "ultratypes.h" 5 | 6 | // Old deprecated functions from strings.h, replaced by memcpy/memset. 7 | extern void bcopy(const void*, void*, size_t); 8 | extern void bzero(void*, size_t); 9 | 10 | #endif /* !_OS_LIBC_H_ */ 11 | -------------------------------------------------------------------------------- /include/PR/os_misc.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_OS_MISC_H_ 2 | #define _ULTRA64_OS_MISC_H_ 3 | #include 4 | /* Miscellaneous OS functions */ 5 | 6 | void osInitialize(void); 7 | u32 osGetCount(void); 8 | 9 | uintptr_t osVirtualToPhysical(void*); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /include/PR/os_time.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_TIME_H_ 2 | #define _ULTRA64_TIME_H_ 3 | 4 | #include 5 | #include 6 | 7 | /* Types */ 8 | 9 | typedef struct OSTimer_str { 10 | struct OSTimer_str* next; 11 | struct OSTimer_str* prev; 12 | u64 interval; 13 | u64 remaining; 14 | OSMesgQueue* mq; 15 | OSMesg* msg; 16 | } OSTimer; 17 | 18 | typedef u64 OSTime; 19 | 20 | /* Functions */ 21 | 22 | OSTime osGetTime(void); 23 | void osSetTime(OSTime time); 24 | u32 osSetTimer(OSTimer*, OSTime, u64, OSMesgQueue*, OSMesg); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /include/PR/ucode.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_UCODE_H_ 2 | #define _ULTRA64_UCODE_H_ 3 | 4 | #define SP_DRAM_STACK_SIZE8 0x400 5 | #define SP_UCODE_SIZE 0x1000 6 | #define SP_UCODE_DATA_SIZE 0x800 7 | 8 | // standard boot ucode 9 | extern u64 rspF3DBootStart[], rspF3DBootEnd[]; 10 | 11 | // F3D ucode 12 | extern u64 gspF3DEXTextStart[], gspF3DEXTextEnd[]; 13 | 14 | extern u64 gspF3DLXTextStart[], gspF3DLXTextEnd[]; 15 | 16 | // F3D ucode data 17 | extern u64 gspF3DEXDataStart[], gspF3DEXDataEnd[]; 18 | 19 | extern u64 gspF3DLXDataStart[], gspF3DLXDataEnd[]; 20 | 21 | // aspMain (audio) ucode 22 | extern u64 rspAspMainStart[], rspAspMainEnd[]; 23 | 24 | // aspMain ucode data 25 | extern u64 rspAspMainDataStart[], rspAspMainDataEnd[]; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /include/PR/ultratypes.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_TYPES_H_ 2 | #define _ULTRA64_TYPES_H_ 3 | 4 | #ifndef NULL 5 | #define NULL (void*) 0 6 | #endif 7 | 8 | #define true 1 9 | #define false 0 10 | 11 | typedef signed char s8; 12 | typedef unsigned char u8; 13 | typedef signed short int s16; 14 | typedef unsigned short int u16; 15 | typedef signed int s32; 16 | typedef unsigned int u32; 17 | typedef signed long long int s64; 18 | typedef unsigned long long int u64; 19 | 20 | #define bool signed int 21 | 22 | typedef signed char bool8; 23 | typedef unsigned char ubool8; 24 | 25 | typedef volatile u8 vu8; 26 | typedef volatile u16 vu16; 27 | typedef volatile u32 vu32; 28 | typedef volatile u64 vu64; 29 | typedef volatile s8 vs8; 30 | typedef volatile s16 vs16; 31 | typedef volatile s32 vs32; 32 | typedef volatile s64 vs64; 33 | 34 | typedef float f32; 35 | typedef double f64; 36 | 37 | #ifdef TARGET_N64 38 | typedef u32 size_t; 39 | typedef s32 ssize_t; 40 | typedef u32 uintptr_t; 41 | typedef u8 uint8_t; 42 | typedef s32 intptr_t; 43 | typedef s32 ptrdiff_t; 44 | #else 45 | #include 46 | #include 47 | typedef ptrdiff_t ssize_t; 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /include/config.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIG_H 2 | #define CONFIG_H 3 | 4 | /** 5 | * @brief Use a custom course engine 6 | * Use a custom course engine instead of the default one who use switch. see course.h and everywhere 7 | * ENABLE_CUSTOM_COURSE_ENGINE are use to define your 8 | * 9 | */ 10 | #define ENABLE_CUSTOM_COURSE_ENGINE 0 11 | #endif 12 | -------------------------------------------------------------------------------- /include/course_offsets.h: -------------------------------------------------------------------------------- 1 | #ifndef COURSE_OFFSETS_H 2 | #define COURSE_OFFSETS_H 3 | 4 | #include 5 | 6 | typedef struct { 7 | u8* addr; // segmented address texture file 8 | u32 file_size; // compressed file size 9 | u32 data_size; // uncompressed texture size 10 | u32 padding; // always zero 11 | } course_texture; 12 | 13 | #endif // COURSE_OFFSETS_H 14 | -------------------------------------------------------------------------------- /include/decode.h: -------------------------------------------------------------------------------- 1 | #ifndef _FUNCTIONS_H_ 2 | #define _FUNCTIONS_H_ 3 | 4 | #include 5 | 6 | void mio0decode(u8* arg0, u8* arg1); 7 | 8 | // Unused mio0decode function. 9 | void func_80040030(u8* arg0, u8* arg1); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /include/libc/math.h: -------------------------------------------------------------------------------- 1 | #ifndef MATH_H 2 | #define MATH_H 3 | 4 | #define M_PI 3.14159265358979323846 5 | 6 | float sinf(float); 7 | double sin(double); 8 | float cosf(float); 9 | double cos(double); 10 | 11 | float sqrtf(float); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /include/libc/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef STDDEF_H 2 | #define STDDEF_H 3 | 4 | #include 5 | 6 | #ifndef offsetof 7 | #define offsetof(st, m) ((size_t) & (((st*) 0)->m)) 8 | #endif 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/libc/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef STDIO_H 2 | #define STDIO_H 3 | 4 | extern int sprintf(char* s, const char* fmt, ...); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /include/libc/stdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef STDLIB_H 2 | #define STDLIB_H 3 | 4 | typedef struct lldiv_t { 5 | long long quot; 6 | long long rem; 7 | } lldiv_t; 8 | 9 | typedef struct ldiv_t { 10 | long quot; 11 | long rem; 12 | } ldiv_t; 13 | 14 | lldiv_t lldiv(long long num, long long denom); 15 | ldiv_t ldiv(long num, long denom); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /include/libc/string.h: -------------------------------------------------------------------------------- 1 | #ifndef STRING_H 2 | #define STRING_H 3 | 4 | #include 5 | 6 | void* memcpy(void* dst, const void* src, size_t size); 7 | size_t strlen(const char* str); 8 | char* strchr(const char* str, s32 ch); 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /include/ultra64.h: -------------------------------------------------------------------------------- 1 | #ifndef _ULTRA64_H_ 2 | #define _ULTRA64_H_ 3 | 4 | #include 5 | 6 | #ifndef _LANGUAGE_C 7 | #define _LANGUAGE_C 8 | #endif 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mk64.eu.v10.sha1: -------------------------------------------------------------------------------- 1 | a729039453210b84f17019dda3f248d5888f7690 build/eu.v10/mk64.eu.v10.z64 2 | -------------------------------------------------------------------------------- /mk64.eu.v11.sha1: -------------------------------------------------------------------------------- 1 | f6b5f519dd57ea59e9f013cc64816e9d273b2329 build/eu.v11/mk64.eu.v11.z64 2 | -------------------------------------------------------------------------------- /mk64.us.sha1: -------------------------------------------------------------------------------- 1 | 579c48e211ae952530ffc8738709f078d5dd215e build/us/mk64.us.z64 2 | -------------------------------------------------------------------------------- /models/README.MD: -------------------------------------------------------------------------------- 1 | # Model Extract 2 | this folder contain all element to extract interesting Gfx 3 | 4 | ## Instruction 5 | you need blender between 3.6 and 4.2.1 6 | 7 | run `make model_extract -j` to extract assets in multithreaded. And waits (for me it take around 20 minutes so it take his time). 8 | 9 | you can run `make fast64_blender` to run blender with fast64 enable without downloading it. 10 | 11 | ## Organisation 12 | In Tracks there is all track json and folder (once extracted). In each track folder you can find three folder objects, sections, preview, collision_sections. Objects are all assets who are use for object/actor. Sections are all sections reference in a Gfx list who are use with render_course_segments. And preview are the version of the track who are use in render_course_credits who the complete track or a big part (some are broken). Collision sections are just collision who are use in mk64. -------------------------------------------------------------------------------- /models/common_textures.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file": "src/data/common_textures.c", 4 | "out_dir": "common_textures/assets", 5 | "models": [ 6 | "D_0D001B90", 7 | "D_0D001BD8", 8 | "D_0D001C20", 9 | "D_0D001C88", 10 | "D_0D002EE8", 11 | "common_model_fake_itembox", 12 | "itemBoxQuestionMarkModel", 13 | "D_0D0030F8", 14 | "D_0D003128", 15 | "D_0D003158", 16 | "D_0D003188", 17 | "D_0D0031B8", 18 | "D_0D0031E8", 19 | "D_0D003218", 20 | "D_0D003248", 21 | "D_0D003288", 22 | "common_model_banana", 23 | "common_model_flat_banana", 24 | "D_0D0052B8", 25 | "D_0D005338", 26 | "D_0D005368", 27 | "D_0D007B20", 28 | "D_0D007B98", 29 | "D_0D007C10" 30 | ] 31 | } 32 | ] -------------------------------------------------------------------------------- /models/tracks/banshee_boardwalk.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/models/tracks/banshee_boardwalk.zip -------------------------------------------------------------------------------- /models/tracks/battle_track.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "file":"courses/big_donut/course_data.c", 4 | "out_dir": "tracks/big_donut/preview", 5 | "models": [ 6 | "d_course_big_donut_dl" 7 | ] 8 | }, 9 | { 10 | "file":"courses/block_fort/course_data.c", 11 | "out_dir": "tracks/block_fort/preview", 12 | "models": [ 13 | "d_course_block_fort_dl" 14 | ] 15 | }, 16 | { 17 | "file":"courses/double_deck/course_data.c", 18 | "out_dir": "tracks/double_deck/preview", 19 | "models": [ 20 | "d_course_double_deck_dl" 21 | ] 22 | }, 23 | { 24 | "file":"courses/skyscraper/course_data.c", 25 | "out_dir": "tracks/skyscraper/preview", 26 | "models": [ 27 | "d_course_skyscraper_dl" 28 | ] 29 | } 30 | ] -------------------------------------------------------------------------------- /permute: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # note, this quick hack only works with three arguments. 4 | # if you're trying to use four arguments, you need to add another `$4` etc. 5 | 6 | python3 tools/decomp-permuter/permuter.py $1 $2 $3 7 | 8 | -------------------------------------------------------------------------------- /permuter_settings.toml: -------------------------------------------------------------------------------- 1 | # Optional configuration file for import.py. Put it in the root or in tools/ 2 | # of the repo you are importing from. 3 | 4 | compiler_type = "ido" 5 | 6 | [decompme.compilers] 7 | "tools/ido-recomp/linux/cc" = "ido5.3" 8 | 9 | [preserve_macros] 10 | "gs?DP.*" = "void" 11 | "gs?SP.*" = "void" 12 | "G_.*" = "int" 13 | "VIRTUAL_.*" = "unsigned int" 14 | "PHYSICAL_.*" = "unsigned int" 15 | "TIME_TRIAL_.*" = "int" 16 | "TEXT_.*" = "int" 17 | "OS_.*" = "int" 18 | "SEGMENT_.*" = "int" 19 | "ACTOR_.*" = "int" 20 | "A_[A-Z]+" = "int" 21 | "a[A-Za-z]+" = "void" 22 | "_SHIFT[LR]" = "void" 23 | "ALIGN.*" = "int" 24 | "aClearBuffer" = "void" 25 | "aEnvSetup1Alt" = "void" 26 | "aEnvSetup1" = "void" 27 | "aEnvSetup2" = "void" 28 | "aEnvMixer" = "void" 29 | -------------------------------------------------------------------------------- /rename_sym.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | shopt -s globstar 4 | 5 | if [ "$#" -ne "2" ]; 6 | then 7 | echo "usage: $0 old_name new_name" 8 | exit 1 9 | fi 10 | 11 | #echo "Replace $1 with $2?" 12 | #read 13 | grep -rl "$1" asm/**/*.s data/*.s src/**/*.c src/audio/*.c src/**/*.h src/os/*.{c,h} courses/**/*.{c,h} undefined_syms.txt | xargs sed -i "s/\b$1\b/$2/g" 14 | -------------------------------------------------------------------------------- /src/actors/blue_and_red_shells/render.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * @brief Render the red shell actor 6 | * 7 | * @param camera 8 | * @param matrix 9 | * @param shell 10 | */ 11 | void render_actor_red_shell(Camera* camera, Mat4 matrix, struct ShellActor* shell) { 12 | gDPLoadTLUT_pal256(gDisplayListHead++, &gTLUTRedShell); // set texture 13 | render_actor_shell(camera, matrix, shell); 14 | } 15 | 16 | /** 17 | * @brief Render the blue shell actor 18 | * 19 | * @param camera 20 | * @param matrix 21 | * @param shell 22 | */ 23 | void render_actor_blue_shell(Camera* camera, Mat4 matrix, struct ShellActor* shell) { 24 | gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_blue_shell); // set texture 25 | render_actor_shell(camera, matrix, shell); 26 | } 27 | -------------------------------------------------------------------------------- /src/actors/green_shell/render.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | /** 7 | * @brief Renders the green shell actor. 8 | * 9 | * @param camera 10 | * @param matrix 11 | * @param shell 12 | */ 13 | void render_actor_green_shell(Camera* camera, Mat4 matrix, struct ShellActor* shell) { 14 | gDPLoadTLUT_pal256(gDisplayListHead++, common_tlut_green_shell); // set texture 15 | render_actor_shell(camera, matrix, shell); 16 | } 17 | -------------------------------------------------------------------------------- /src/actors/kiwano_fruit/render.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "courses/dks_jungle_parkway/course_data.h" 5 | 6 | /** 7 | * @brief Renders the kiwano fruit actor. 8 | * Actor used in DK's Jungle Parkway. 9 | * 10 | * @param camera 11 | * @param arg1 12 | * @param actor 13 | */ 14 | void render_actor_kiwano_fruit(UNUSED Camera* camera, Mat4 arg1, struct Actor* actor) { 15 | uintptr_t addr; 16 | s32 maxObjectsReached; 17 | 18 | if (actor->state == 0) { 19 | return; 20 | } 21 | 22 | arg1[3][0] = actor->pos[0]; 23 | arg1[3][1] = actor->pos[1]; 24 | arg1[3][2] = actor->pos[2]; 25 | 26 | maxObjectsReached = render_set_position(arg1, 0) == 0; 27 | if (maxObjectsReached) { 28 | return; 29 | } 30 | 31 | addr = (actor->rot[0] << 0xA) + 0x03009000; // Can this be a real symbol? Doesn't match. 32 | gDPLoadTextureBlock(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(addr), G_IM_FMT_CI, G_IM_SIZ_8b, 32, 32, 0, 33 | G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, 34 | G_TX_NOLOD); 35 | gSPDisplayList(gDisplayListHead++, d_course_dks_jungle_parkway_dl_kiwano_fruit); 36 | } 37 | -------------------------------------------------------------------------------- /src/actors/mario_sign/render.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "courses/mario_raceway/course_data.h" 4 | 5 | /** 6 | * @brief Renders the Mario sign actor. 7 | * Actor used in Mario Raceway. 8 | * 9 | * @param arg0 10 | * @param arg1 11 | * @param arg2 12 | */ 13 | void render_actor_mario_sign(Camera* arg0, UNUSED Mat4 arg1, struct Actor* arg2) { 14 | Mat4 sp40; 15 | f32 unk; 16 | s16 temp = arg2->flags; 17 | 18 | if (temp & 0x800) { 19 | return; 20 | } 21 | 22 | unk = is_within_render_distance(arg0->pos, arg2->pos, arg0->rot[1], 0, gCameraZoom[arg0 - camera1], 16000000.0f); 23 | if (!(unk < 0.0f)) { 24 | gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); 25 | gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); 26 | mtxf_pos_rotation_xyz(sp40, arg2->pos, arg2->rot); 27 | if (render_set_position(sp40, 0) != 0) { 28 | gSPDisplayList(gDisplayListHead++, d_course_mario_raceway_dl_sign); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/actors/mario_sign/update.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * @brief Updates the Mario sign actor. 5 | * 6 | * @param arg0 7 | */ 8 | void update_actor_mario_sign(struct Actor* arg0) { 9 | if ((arg0->flags & 0x800) == 0) { 10 | if ((arg0->flags & 0x400) != 0) { 11 | arg0->pos[1] += 4.0f; 12 | if (arg0->pos[1] > 800.0f) { 13 | arg0->flags |= 0x800; 14 | arg0->rot[1] += 1820; 15 | } 16 | } else { 17 | arg0->rot[1] += 182; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/actors/paddle_boat/update.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * @brief Updates the paddle boat actor. 6 | * Actor used in DK's Jungle Parkway. 7 | * Rotate only the paddle wheel, for position and rotation of the boat it's in vehicle. 8 | * 9 | * @param boat 10 | */ 11 | void update_actor_paddle_boat(struct PaddleWheelBoat* boat) { 12 | boat->wheelRot += 0x38E; 13 | } 14 | -------------------------------------------------------------------------------- /src/actors/railroad_crossing/update.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * @brief Updates the railroad crossing actor. 5 | * Actor used in Kalimari Desert. 6 | * Make the sound of the bell when the train is close. 7 | * 8 | * @param crossing 9 | */ 10 | void update_actor_railroad_crossing(struct RailroadCrossing* crossing) { 11 | // If train close? 12 | if (isCrossingTriggeredByIndex[crossing->crossingId] != 0) { 13 | // Timer++ 14 | crossing->someTimer++; 15 | // Reset timer 16 | if (crossing->someTimer > 40) { 17 | crossing->someTimer = 1; 18 | } 19 | // Play Bell sound when timer hits 20 or 1. 20 | if ((crossing->someTimer == 1) || (crossing->someTimer == 20)) { 21 | func_800C98B8(crossing->pos, crossing->velocity, SOUND_ARG_LOAD(0x19, 0x01, 0x70, 0x16)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/actors/train/update.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * @brief Updates the train engine actor. 5 | * Used in Kalimari Desert. 6 | * Update wheels and make sound, for his update position it's in vehicle. 7 | * 8 | * @param arg0 9 | */ 10 | void update_actor_train_engine(struct TrainCar* arg0) { 11 | arg0->wheelRot -= 0x666; 12 | 13 | if (arg0->unk_08 != 0.0f) { 14 | arg0->unk_08 = 0.0f; 15 | func_800C9D80(arg0->pos, arg0->velocity, SOUND_ARG_LOAD(0x51, 0x01, 0x80, 0x00)); 16 | } 17 | } 18 | 19 | /** 20 | * @brief Updates the train tender actor. 21 | * Used in Kalimari Desert. 22 | * Update wheels, for his update position it's in vehicle. 23 | * @param tender 24 | */ 25 | void update_actor_train_tender(struct TrainCar* tender) { 26 | tender->wheelRot -= 0x4FA; 27 | } 28 | 29 | /** 30 | * @brief Updates the train passenger car actor. 31 | * Used in Kalimari Desert. 32 | * Update wheels, for his update position it's in vehicle. 33 | * 34 | * @param arg0 35 | */ 36 | void update_actor_train_passenger_car(struct TrainCar* arg0) { 37 | arg0->wheelRot -= 0x666; 38 | } 39 | -------------------------------------------------------------------------------- /src/actors/wario_sign/render.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "courses/wario_stadium/course_data.h" 5 | 6 | /** 7 | * @brief Renders the Wario sign actor. 8 | * Used in Wario Stadium. 9 | * 10 | * @param arg0 11 | * @param arg1 12 | */ 13 | void render_actor_wario_sign(Camera* arg0, struct Actor* arg1) { 14 | Mat4 sp38; 15 | f32 unk = 16 | is_within_render_distance(arg0->pos, arg1->pos, arg0->rot[1], 0, gCameraZoom[arg0 - camera1], 16000000.0f); 17 | 18 | if (!(unk < 0.0f)) { 19 | gSPSetGeometryMode(gDisplayListHead++, G_SHADING_SMOOTH); 20 | gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); 21 | 22 | mtxf_pos_rotation_xyz(sp38, arg1->pos, arg1->rot); 23 | if (render_set_position(sp38, 0) != 0) { 24 | 25 | gSPDisplayList(gDisplayListHead++, d_course_wario_stadium_dl_sign); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/actors/wario_sign/update.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * @brief Updates the Wario sign actor. 5 | * Used in Wario Stadium. 6 | * 7 | * @param arg0 8 | */ 9 | void update_actor_wario_sign(struct Actor* arg0) { 10 | arg0->rot[1] += 0xB6; 11 | } 12 | -------------------------------------------------------------------------------- /src/actors/yoshi_egg/update.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * @brief Updates the Yoshi egg actor. 5 | * 6 | * @param egg 7 | */ 8 | void update_actor_yoshi_egg(struct YoshiValleyEgg* egg) { 9 | egg->pathRot += 0x5B; 10 | egg->pos[0] = egg->pathCenter[0] + (sins(egg->pathRot) * egg->pathRadius); 11 | egg->pos[2] = egg->pathCenter[2] + (coss(egg->pathRot) * egg->pathRadius); 12 | if ((egg->flags & 0x400) != 0) { 13 | egg->pathCenter[1] -= 0.12; 14 | if (egg->pathCenter[1] < -3.0f) { 15 | egg->pathCenter[1] = -3.0f; 16 | } 17 | egg->pos[1] += egg->pathCenter[1]; 18 | if (egg->pos[1] < 0.0f) { 19 | egg->pos[1] = 0.0f; 20 | egg->pathCenter[1] = 0.0f; 21 | egg->flags &= ~(1 << 10); 22 | } 23 | egg->eggRot -= 0x4FA; 24 | } 25 | egg->eggRot -= 0x222; 26 | } 27 | -------------------------------------------------------------------------------- /src/audio/port_eu.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIO_PORT_EU_H 2 | #define AUDIO_PORT_EU_H 3 | 4 | #include "audio/internal.h" 5 | 6 | #define SAMPLES_TO_OVERPRODUCE 0x10 7 | #define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x40 8 | 9 | void eu_process_audio_cmd(struct EuAudioCmd*); 10 | void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime); 11 | void func_800CBA64(s32 playerIndex, s32 fadeInTime); 12 | void port_eu_init_queues(void); 13 | void func_800CBB48(s32, s32*); 14 | void func_800CBB88(u32, f32); 15 | void func_800CBBB8(u32, u32); 16 | void func_800CBBE8(u32, s8); 17 | void func_800CBC24(void); 18 | void func_800CBCB0(u32 arg0); 19 | void port_eu_init(void); 20 | 21 | extern OSMesgQueue D_801937C0; 22 | extern OSMesgQueue D_801937D8; 23 | extern OSMesgQueue D_801937F0; 24 | extern OSMesgQueue D_80193808; 25 | 26 | extern struct EuAudioCmd sAudioCmd[0x100]; 27 | 28 | extern OSMesg D_80194020[]; 29 | extern OSMesg D_80194028[]; 30 | extern OSMesg D_80194038[]; 31 | extern OSMesg D_8019403C[]; 32 | 33 | extern OSMesgQueue* D_800EA3A8; 34 | extern OSMesgQueue* D_800EA3AC; 35 | extern OSMesgQueue* D_800EA3B0; 36 | extern OSMesgQueue* D_800EA3B4; 37 | extern s32 D_800EA484; 38 | extern s32 D_800EA4A4; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/buffers/audio_heap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "audio_heap.h" 6 | #include "audio/data.h" 7 | 8 | ALIGNED8 u8 gAudioHeap[DOUBLE_SIZE_ON_64_BIT(AUDIO_HEAP_SIZE)]; 9 | -------------------------------------------------------------------------------- /src/buffers/audio_heap.h: -------------------------------------------------------------------------------- 1 | #ifndef AUDIO_HEAP_H 2 | #define AUDIO_HEAP_H 3 | 4 | #include 5 | #include 6 | 7 | #define AUDIO_HEAP_SIZE 0x48C00 8 | #define AUDIO_HEAP_INIT_SIZE 0x2600 9 | 10 | #endif // AUDIO_HEAP_H 11 | -------------------------------------------------------------------------------- /src/buffers/buffers.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "buffers.h" 5 | 6 | /** 7 | * @brief look like to be a buffer of decoded textures 8 | */ 9 | ALIGNED8 union_D_802BFB80 D_802BFB80; 10 | ALIGNED8 struct_D_802DFB80 gEncodedKartTexture[2][2][8]; 11 | #ifdef AVOID_UB 12 | ALIGNED8 struct_D_802F1F80 gPlayerPalettesList[2][4][8]; 13 | #else 14 | ALIGNED8 u16 gPlayerPalettesList[2][4][0x100 * 8]; 15 | #endif 16 | 17 | ALIGNED8 u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT]; 18 | 19 | #ifdef AVOID_UB 20 | ALIGNED8 u16 gFramebuffers[3][SCREEN_WIDTH * SCREEN_HEIGHT]; 21 | #else 22 | u16 gFramebuffer0[SCREEN_WIDTH * SCREEN_HEIGHT]; 23 | u16 gFramebuffer1[SCREEN_WIDTH * SCREEN_HEIGHT]; 24 | u16 gFramebuffer2[SCREEN_WIDTH * SCREEN_HEIGHT]; 25 | #endif 26 | -------------------------------------------------------------------------------- /src/buffers/gfx_output_buffer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "gfx_output_buffer.h" 4 | 5 | ALIGNED8 u64 gGfxSPTaskOutputBuffer[GFX_OUTPUT_BUFFER_SIZE]; 6 | 7 | u32 gGfxSPTaskOutputBufferSize; 8 | -------------------------------------------------------------------------------- /src/buffers/gfx_output_buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef GFX_OUTPUT_BUFFER_H 2 | #define GFX_OUTPUT_BUFFER_H 3 | 4 | #include 5 | 6 | // 0x1f000 bytes, aligned to a 0x1000-byte boundary through sm64.ld. (This results 7 | // in a bunch of unused space: ~0x100 in JP, ~0x300 in US.) 8 | #define GFX_OUTPUT_BUFFER_SIZE 0x3f00 9 | 10 | // 0x3F00 11 | extern u64 gGfxSPTaskOutputBuffer[GFX_OUTPUT_BUFFER_SIZE]; 12 | 13 | #endif // GFX_OUTPUT_BUFFER_H 14 | -------------------------------------------------------------------------------- /src/buffers/memory_pool.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define MEMORY_POOL_SIZE 0xAB630 6 | 7 | /** 8 | * Memory pool variable prevents code segments flowing into the memory pool 9 | * for easier portability. 10 | * @warning should not really be used. 11 | */ 12 | u8 sMemoryPool[MEMORY_POOL_SIZE]; 13 | -------------------------------------------------------------------------------- /src/buffers/random.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | u16 gRandomSeed16; 4 | 5 | #ifdef VERSION_EU 6 | u8 randomSeedPadding[16]; 7 | #else 8 | u8 randomSeedPadding[216]; 9 | #endif 10 | -------------------------------------------------------------------------------- /src/buffers/random.h: -------------------------------------------------------------------------------- 1 | #ifndef RANDOM_H 2 | #define RANDOM_H 3 | 4 | #include 5 | 6 | extern u16 gRandomSeed16; 7 | extern u8 randomSeedPadding[]; 8 | 9 | #endif // RANDOM_H 10 | -------------------------------------------------------------------------------- /src/buffers/trig_tables.h: -------------------------------------------------------------------------------- 1 | #ifndef TRIG_TABLES_H 2 | #define TRIG_TABLES_H 3 | 4 | /* 5 | * The sine and cosine tables overlap, but "#define gCosineTable (gSineTable + 6 | * 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to 7 | * be different symbols for code to match. Most likely the tables were placed 8 | * adjacent to each other, and gSineTable cut short, such that reads overflow 9 | * into gCosineTable. 10 | * 11 | * These kinds of out of bounds reads are undefined behavior, and break on 12 | * e.g. GCC (which doesn't place the tables next to each other, and probably 13 | * exploits array sizes for range analysis-based optimizations as well). 14 | * Thus, for non-IDO compilers we use the standard-compliant version. 15 | */ 16 | extern f32 gSineTable[]; 17 | #ifdef AVOID_UB 18 | #define gCosineTable (gSineTable + 0x400) 19 | #else 20 | extern f32 gCosineTable[]; 21 | #endif 22 | 23 | extern s16 gArctanTable[]; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /src/buffers/trig_tables_bss.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * Trig tables get loaded into memory at this location. 6 | * See trig_tables.c for the real file. 7 | */ 8 | 9 | ALIGNED8 u8 trigTablesPadding[0x5810]; 10 | -------------------------------------------------------------------------------- /src/camera_junk.h: -------------------------------------------------------------------------------- 1 | #ifndef CAMERA_JUNK_H 2 | #define CAMERA_JUNK_H 3 | 4 | /* Function Prototypes */ 5 | 6 | void update_camera_podium_ceremony(void); 7 | void init_camera_podium_ceremony(void); 8 | 9 | // guPerspective params 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/code_8003DC40.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_8003DC40_H 2 | #define CODE_8003DC40_H 3 | 4 | #include 5 | 6 | /* Function Prototypes */ 7 | 8 | void func_8003DC40(Player*); 9 | void func_8003DC50(Player*, Vec3f); 10 | void func_8003DE4C(Player*, Vec3f); 11 | void func_8003E048(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 12 | void func_8003E37C(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 13 | void func_8003E6EC(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 14 | void func_8003E9EC(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 15 | void func_8003EE2C(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 16 | void func_8003F138(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 17 | void func_8003F46C(Player*, Vec3f, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 18 | void func_8003F734(Player*, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 19 | void func_8003FBAC(Player*, Vec3f, Vec3f, f32*, f32*, f32*, f32*); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /src/code_8006E9C0.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_8006E9C0_H 2 | #define CODE_8006E9C0_H 3 | 4 | #include 5 | #include "update_objects.h" 6 | 7 | void init_hud(void); 8 | void reset_object_variable(void); 9 | void func_8006EB10(void); 10 | void clear_object_list(void); 11 | u8* dma_copy_base_misc_textures(u8*, u8*, u32, u32); 12 | void load_mario_kart_64_logo(void); 13 | void init_item_window(s32); 14 | void func_8006EEE8(s32); 15 | void func_8006EF60(void); 16 | void track_minimap_settings(void); 17 | void func_8006F824(s32); 18 | void func_8006F8CC(void); 19 | void func_8006FA94(void); 20 | void func_80070148(void); 21 | void init_object_list_index(void); 22 | void init_cloud_object(s32, s32, CloudData*); 23 | void init_clouds(CloudData*); 24 | void init_star_object(s32, s32, StarData*); 25 | void init_stars(StarData*); 26 | void course_init_cloud(void); 27 | void func_80070714(void); 28 | void init_course_objects(void); 29 | void init_hud_one_player(void); 30 | void init_hud_two_player_vertical(void); 31 | void init_hud_three_four_player(void); 32 | void init_hud_two_player_horizontal(void); 33 | 34 | extern s16 D_800E5520[]; 35 | extern s16 D_800E5548[]; 36 | extern u8* gCourseOutlineTextures[0x14]; // 800e54d0 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/code_80091440.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_80091440_H 2 | #define CODE_80091440_H 3 | 4 | #include 5 | 6 | void func_80091440(s8); 7 | void func_800914A0(void); 8 | void func_800914E0(void); 9 | 10 | #endif // CODE_80091440_H 11 | -------------------------------------------------------------------------------- /src/code_800AF9B0.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_800AF9B0_H 2 | #define CODE_800AF9B0_H 3 | 4 | #include 5 | 6 | /* Function Prototypes */ 7 | void func_800AF9B0(void); 8 | void func_800B0004(void); 9 | void func_800AFC54(Vtx* vtx, s32 a, s32 b, s32 c, Vec3s out); 10 | 11 | #endif /* CODE_800AF9B0_H */ 12 | -------------------------------------------------------------------------------- /src/crash_screen.h: -------------------------------------------------------------------------------- 1 | #ifndef CRASH_SCREEN_H 2 | #define CRASH_SCREEN_H 3 | 4 | #include 5 | #include 6 | 7 | extern u16* pFramebuffer; 8 | 9 | void crash_screen_set_framebuffer(u16*); 10 | 11 | #endif // CRASH_SCREEN_H 12 | -------------------------------------------------------------------------------- /src/data/path_spawn_metadata.h: -------------------------------------------------------------------------------- 1 | #ifndef PATH_SPAWN_METADATA_H 2 | #define PATH_SPAWN_METADATA_H 3 | 4 | #include "path.h" 5 | #include 6 | #include 7 | #include "include/bomb_kart.h" 8 | 9 | extern TrackPathPoint nullPath; 10 | extern s16 D_800DCAF4[]; 11 | extern s16 D_800DCB34[]; 12 | extern BombKartSpawn gBombKartSpawns[][NUM_BOMB_KARTS_MAX]; 13 | extern s32 D_800DDB20; 14 | extern s32 D_800DDB24; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/debug/debug.inc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "all_variables.h" 4 | 5 | #if DVDL 6 | 7 | extern s32 gGlobalTimer; 8 | 9 | /** 10 | * Edit this to edit what displays on the screen while the DVDL is active. 11 | * The Size of the structure array is calculated at compile time. 12 | */ 13 | variableWatchAttributes gMainVariableWatchList[] = { 14 | { "Global Timer: ", &gGlobalTimer, sizeof(gGlobalTimer), DISPLAY_DECIMAL_NUMBER | DISPLAY_SIGNED_NUMBER, 0, 0 }, 15 | { "Actors: ", &gNumActors, sizeof(gNumActors), DISPLAY_DECIMAL_NUMBER, 0, 0 }, 16 | { "Player Type: ", &gPlayers[0].type, sizeof(gPlayerOne->type), DISPLAY_HEXIDECIMAL_NUMBER, 0, 0 }, 17 | { "X ", &gPlayers[0].pos[0], sizeof(gPlayerOne->pos[0]), DISPLAY_FLOAT_NUMBER, 0, 0 }, 18 | { "Y ", &gPlayers[0].pos[1], sizeof(gPlayerOne->pos[1]), DISPLAY_FLOAT_NUMBER, 0, 0 }, 19 | { "Z ", &gPlayers[0].pos[2], sizeof(gPlayerOne->pos[2]), DISPLAY_FLOAT_NUMBER, 0, 0 }, 20 | { "Torque 9C: ", &gPlayers[0].currentSpeed, sizeof(gPlayerOne->currentSpeed), DISPLAY_FLOAT_NUMBER, 0, 0 }, 21 | { "Top Speed 214: ", &gPlayers[0].topSpeed, sizeof(gPlayerOne->topSpeed), DISPLAY_FLOAT_NUMBER, 0, 0 }, 22 | { "Accel Offset C4: ", &gPlayers[0].slopeAccel, sizeof(gPlayerOne->slopeAccel), DISPLAY_SIGNED_NUMBER, 0, 0 }, 23 | 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/ending/camera_junk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "camera_junk.h" 7 | #include "camera.h" 8 | #include "math_util.h" 9 | #include "ceremony_and_credits.h" 10 | #include "main.h" 11 | 12 | void update_camera_podium_ceremony(void) { 13 | Camera* camera; 14 | f32 x_dist; 15 | f32 y_dist; 16 | f32 z_dist; 17 | 18 | camera = &cameras[0]; 19 | func_80283648(camera); 20 | 21 | x_dist = camera->lookAt[0] - camera->pos[0]; 22 | y_dist = camera->lookAt[1] - camera->pos[1]; 23 | z_dist = camera->lookAt[2] - camera->pos[2]; 24 | camera->rot[1] = atan2s(x_dist, z_dist); 25 | camera->rot[0] = atan2s(sqrtf((x_dist * x_dist) + (z_dist * z_dist)), y_dist); 26 | camera->rot[2] = 0; 27 | } 28 | 29 | // GP podium ceremony camera settings? 30 | void init_camera_podium_ceremony(void) { 31 | cameras[0].pos[0] = -3133.0f; 32 | cameras[0].pos[1] = 19.0f; 33 | cameras[0].pos[2] = -467.0f; 34 | cameras[0].lookAt[0] = -3478.0f; 35 | cameras[0].lookAt[1] = 21.0f; 36 | cameras[0].lookAt[2] = -528.0f; 37 | cameras[0].up[0] = 0.0f; 38 | cameras[0].up[1] = 1.0f; 39 | cameras[0].up[2] = 0.0f; 40 | gCameraZoom[0] = 40.0f; 41 | gScreenAspect = 1.33333333f; 42 | gCourseNearPersp = 3.0f; 43 | gCourseFarPersp = 6800.0f; 44 | init_cinematic_camera(); 45 | } 46 | -------------------------------------------------------------------------------- /src/ending/code_80280000.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_80280000_H 2 | #define CODE_80280000_H 3 | 4 | #include 5 | 6 | /* Function Prototypes */ 7 | 8 | void func_80280000(void); 9 | void func_80280038(void); 10 | void func_80280268(s32 arg0); 11 | void credits_loop(void); 12 | void load_credits(void); 13 | 14 | extern s32 D_802874A0; 15 | 16 | extern u16 D_80164714, D_80164716, D_80164718; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /src/ending/code_80281780.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_80281780_H 2 | #define CODE_80281780_H 3 | 4 | /* Function Prototypes */ 5 | 6 | void debug_switch_character_ceremony_cutscene(void); 7 | s32 func_80281880(s32 arg0); 8 | void func_802818BC(void); 9 | void load_ceremony_cutscene(void); 10 | 11 | extern s32 D_80287554; 12 | extern f32 D_801647A4; 13 | 14 | extern s32 D_8015F5A0; 15 | 16 | extern s32 D_00821D10; 17 | extern s32 D_00825800; 18 | extern s32 D_00831DC0; 19 | extern s32 D_00835BA0; 20 | 21 | extern u8 defaultCharacterIds[]; 22 | extern s8 gGPOverallRanks[8]; 23 | 24 | extern s32 _course_banshee_boardwalk_dl_mio0SegmentRomStart; 25 | extern s32 _course_yoshi_valley_dl_mio0SegmentRomStart; 26 | 27 | #endif // CODE_80281780_H 28 | -------------------------------------------------------------------------------- /src/ending/code_80281C40.h: -------------------------------------------------------------------------------- 1 | #ifndef CODE_80281C40_H 2 | #define CODE_80281C40_H 3 | 4 | /* Function Prototypes */ 5 | 6 | void func_80281C40(void); 7 | void func_80281CB4(s32, s32, s32, s32); 8 | void render_podium_ceremony(void); 9 | 10 | extern s32 gGotoMenu; 11 | extern u16 gIsInQuitToMenuTransition; 12 | extern Gfx D_00284F70[]; 13 | extern Gfx D_00284EE0[]; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /src/ending/credits.h: -------------------------------------------------------------------------------- 1 | #ifndef CREDITS_H 2 | #define CREDITS_H 3 | 4 | #include 5 | 6 | #define SLIDE_RIGHT 0 7 | #define SLIDE_LEFT 1 8 | 9 | // In some way dictates how the text is written during the credit sequence 10 | typedef struct { 11 | // Scaling factor that affects the x/y scaling and tracking of printed text 12 | /* 0x00 */ f32 textScaling; 13 | // Column to start sliding in from 14 | /* 0x04 */ s16 startingColumn; 15 | /* 0x06 */ s16 row; 16 | // Extra distance added to the destination column 17 | /* 0x08 */ s16 columnExtra; 18 | /* 0x0A */ s16 unknown; // No idea what this is for, has a value but never seems to be read 19 | /* 0x0C */ s8 slideDirection; // 0 for slide right, 1 for slide left. May have other uses/effects 20 | /* 0x0D */ s8 textColor; 21 | /* 0x0E */ s16 padding; // Always seems to be 0, never read (that I can see) 22 | } CreditsRenderInfo; // size = 0x10 23 | 24 | extern CreditsRenderInfo gCreditsTextRenderInfo[]; // gCreditsTextRenderInfo 25 | extern char* gCreditsText[]; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/gbiMacro.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "main.h" 5 | #include 6 | 7 | extern s16 D_800E43A8; 8 | extern Mtx D_0D008E98; 9 | 10 | // rsp init 11 | UNUSED void gfx_func_80040D00(void) { 12 | D_800E43A8 = 0; 13 | 14 | gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE); 15 | gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); 16 | gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING); 17 | guOrtho(&gGfxPool->mtxScreen, 0.0f, SCREEN_WIDTH, 0.0f, SCREEN_HEIGHT, -1.0f, 1.0f, 1.0f); 18 | gSPPerspNormalize(gDisplayListHead++, 0xFFFF); 19 | gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(gGfxPool), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); 20 | gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_0D008E98), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); 21 | } 22 | -------------------------------------------------------------------------------- /src/os/NaN.c: -------------------------------------------------------------------------------- 1 | typedef union { 2 | int i; 3 | float f; 4 | } fu; 5 | const fu NAN = { 0x7f810000 }; 6 | -------------------------------------------------------------------------------- /src/os/__osAiDeviceBusy.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osAiDeviceBusy(void) { 5 | register s32 status = HW_REG(AI_STATUS_REG, u32); 6 | if ((status & AI_STATUS_AI_FULL) != 0) { 7 | return 1; 8 | } else { 9 | return 0; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/os/__osAtomicDec.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | s32 __osAtomicDec(u32* a0) { 4 | s32 sp1c; 5 | s32 sp18; 6 | sp1c = __osDisableInt(); 7 | 8 | if (*a0 != 0) { 9 | (*a0)--; 10 | sp18 = 1; 11 | } else { 12 | sp18 = 0; 13 | } 14 | 15 | __osRestoreInt(sp1c); 16 | return sp18; 17 | } 18 | -------------------------------------------------------------------------------- /src/os/__osDequeueThread.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | struct __osThreadTail __osThreadTail = { NULL, -1 }; 4 | OSThread* __osRunQueue = (OSThread*) &__osThreadTail; 5 | OSThread* __osActiveQueue = (OSThread*) &__osThreadTail; 6 | OSThread* __osRunningThread = { 0 }; 7 | OSThread* __osFaultedThread = { 0 }; 8 | 9 | void __osDequeueThread(register OSThread** queue, register OSThread* t) { 10 | register OSThread* pred; 11 | register OSThread* succ; 12 | 13 | pred = (OSThread*) queue; 14 | succ = pred->next; 15 | 16 | while (succ != NULL) { 17 | if (succ == t) { 18 | pred->next = t->next; 19 | return; 20 | } 21 | pred = succ; 22 | succ = pred->next; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/os/__osEPiRawReadIo.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osEPiRawReadIo(OSPiHandle* arg0, u32 devAddr, u32* data) { 5 | register s32 stat; 6 | while (stat = HW_REG(PI_STATUS_REG, s32), stat & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) { 7 | ; 8 | } 9 | *data = HW_REG(arg0->baseAddress | devAddr, s32); 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /src/os/__osEPiRawWriteIo.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osEPiRawWriteIo(OSPiHandle* a0, u32 a1, u32 a2) { 5 | register u32 a3 = HW_REG(PI_STATUS_REG, u32); 6 | while (a3 & PI_STATUS_ERROR) { 7 | a3 = HW_REG(PI_STATUS_REG, u32); 8 | } 9 | HW_REG(a0->baseAddress | a1, u32) = a2; 10 | return 0; 11 | } 12 | /* 13 | / 0B69A0 802F71A0 3C0EA460 / lui $t6, %hi(PI_STATUS_REG) # $t6, 0xa460 14 | / 0B69A4 802F71A4 8DC70010 / lw $a3, %lo(PI_STATUS_REG)($t6) 15 | / 0B69A8 802F71A8 27BDFFF8 / addiu $sp, $sp, -8 16 | / 0B69AC 802F71AC 30EF0003 / andi $t7, $a3, 3 17 | 18 | / 0B69B0 802F71B0 11E00006 / beqz $t7, .L802F71CC 19 | / 0B69B4 802F71B4 00000000 / nop 20 | .L802F71B8: 21 | / 0B69B8 802F71B8 3C18A460 / lui $t8, %hi(PI_STATUS_REG) # $t8, 0xa460 22 | / 0B69BC 802F71BC 8F070010 / lw $a3, %lo(PI_STATUS_REG)($t8) 23 | / 0B69C0 802F71C0 30F90003 / andi $t9, $a3, 3 24 | / 0B69C4 802F71C4 1720FFFC / bnez $t9, .L802F71B8 25 | / 0B69C8 802F71C8 00000000 / nop 26 | .L802F71CC: 27 | / 0B69CC 802F71CC 8C88000C / lw $t0, 0xc($a0) 28 | / 0B69D0 802F71D0 3C01A000 / lui $at, 0xa000 29 | / 0B69D4 802F71D4 27BD0008 / addiu $sp, $sp, 8 30 | / 0B69D8 802F71D8 01054825 / or $t1, $t0, $a1 31 | / 0B69DC 802F71DC 01215025 / or $t2, $t1, $at 32 | / 0B69E0 802F71E0 AD460000 / sw $a2, ($t2) 33 | / 0B69E4 802F71E4 03E00008 / jr $ra 34 | / 0B69E8 802F71E8 00001025 / move $v0, $zero 35 | 36 | / 0B69EC 802F71EC 00000000 / nop */ 37 | -------------------------------------------------------------------------------- /src/os/__osGetCurrFaultedThread.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | OSThread* __osGetCurrFaultedThread() { 4 | return __osActiveQueue; // 80302efc 5 | } 6 | -------------------------------------------------------------------------------- /src/os/__osPiCreateAccessQueue.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | #define PIAccessQueueSize 2 4 | 5 | OSMesg osPiMesgBuff[PIAccessQueueSize]; 6 | OSMesgQueue gOsPiMessageQueue; 7 | u32 gOsPiAccessQueueCreated = 0; 8 | 9 | void __osPiCreateAccessQueue(void) { 10 | gOsPiAccessQueueCreated = 1; 11 | osCreateMesgQueue(&gOsPiMessageQueue, &osPiMesgBuff[0], PIAccessQueueSize - 1); 12 | osSendMesg(&gOsPiMessageQueue, NULL, OS_MESG_NOBLOCK); 13 | } 14 | 15 | void __osPiGetAccess(void) { 16 | OSMesg sp1c; 17 | if (!gOsPiAccessQueueCreated) { 18 | __osPiCreateAccessQueue(); 19 | } 20 | osRecvMesg(&gOsPiMessageQueue, &sp1c, OS_MESG_BLOCK); 21 | } 22 | 23 | void __osPiRelAccess(void) { 24 | osSendMesg(&gOsPiMessageQueue, NULL, OS_MESG_NOBLOCK); 25 | } 26 | -------------------------------------------------------------------------------- /src/os/__osResetGlobalIntMask.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "new_func.h" 3 | 4 | void __osResetGlobalIntMask(u32 mask) { 5 | register u32 prev; 6 | prev = __osDisableInt(); 7 | __OSGlobalIntMask &= ~(-0x402 & mask); 8 | __osRestoreInt(prev); 9 | } 10 | -------------------------------------------------------------------------------- /src/os/__osSetGlobalIntMask.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | #include "new_func.h" 4 | 5 | void __osSetGlobalIntMask(s32 arg0) { 6 | register u32 prev = __osDisableInt(); 7 | __OSGlobalIntMask |= arg0; 8 | __osRestoreInt(prev); 9 | } 10 | -------------------------------------------------------------------------------- /src/os/__osSetHWIntrRoutine.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | // Its not clear how big this array should be. 4 | // In order for file alignment to be correct, it needs to be 5 | // at least 5 but no more than 8. Beyond that its not clear 6 | // what its size should be 7 | s32 (*__osHwIntTable[5])(void) = { NULL }; 8 | void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void)) { 9 | register u32 saveMask; 10 | saveMask = __osDisableInt(); 11 | __osHwIntTable[interrupt] = handler; 12 | __osRestoreInt(saveMask); 13 | } 14 | -------------------------------------------------------------------------------- /src/os/__osSiCreateAccessQueue.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | #define SIAccessQueueSize 2 4 | 5 | OSMesg osSiMesgBuff[SIAccessQueueSize]; 6 | OSMesgQueue gOsSiMessageQueue; 7 | u32 gOsSiAccessQueueCreated = 0; 8 | 9 | void __osSiCreateAccessQueue() { 10 | gOsSiAccessQueueCreated = 1; 11 | osCreateMesgQueue(&gOsSiMessageQueue, &osSiMesgBuff[0], SIAccessQueueSize - 1); 12 | osSendMesg(&gOsSiMessageQueue, NULL, OS_MESG_NOBLOCK); 13 | } 14 | 15 | void __osSiGetAccess(void) { 16 | OSMesg sp1c; 17 | if (!gOsSiAccessQueueCreated) { 18 | __osSiCreateAccessQueue(); 19 | } 20 | osRecvMesg(&gOsSiMessageQueue, &sp1c, OS_MESG_BLOCK); 21 | } 22 | 23 | void __osSiRelAccess(void) { 24 | osSendMesg(&gOsSiMessageQueue, NULL, OS_MESG_NOBLOCK); 25 | } 26 | -------------------------------------------------------------------------------- /src/os/__osSiDeviceBusy.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSiDeviceBusy() { 5 | register u32 status; 6 | status = HW_REG(SI_STATUS_REG, u32); 7 | if (status & (SI_STATUS_DMA_BUSY | SI_STATUS_IO_READ_BUSY)) { 8 | return 1; 9 | } else { 10 | return 0; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/os/__osSiRawReadIo.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSiRawReadIo(void* a0, u32* a1) { 5 | if (__osSiDeviceBusy()) { 6 | return -1; 7 | } 8 | *a1 = HW_REG((uintptr_t) a0, u32); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/os/__osSiRawStartDma.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSiRawStartDma(s32 dir, void* addr) { 5 | if (__osSiDeviceBusy()) { 6 | return -1; 7 | } 8 | 9 | if (dir == OS_WRITE) { 10 | osWritebackDCache(addr, 64); 11 | } 12 | 13 | HW_REG(SI_DRAM_ADDR_REG, void*) = (void*) osVirtualToPhysical(addr); 14 | 15 | if (dir == OS_READ) { 16 | HW_REG(SI_PIF_ADDR_RD64B_REG, u32) = 0x1FC007C0; 17 | } else { 18 | HW_REG(SI_PIF_ADDR_WR64B_REG, u32) = 0x1FC007C0; 19 | } 20 | 21 | if (dir == OS_READ) { 22 | osInvalDCache(addr, 64); 23 | } 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /src/os/__osSiRawWriteIo.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSiRawWriteIo(void* a0, u32 a1) { 5 | if (__osSiDeviceBusy()) { 6 | return -1; 7 | } 8 | HW_REG((uintptr_t) a0, u32) = a1; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/os/__osSpDeviceBusy.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSpDeviceBusy() { 5 | register u32 status = HW_REG(SP_STATUS_REG, u32); 6 | if (status & (SPSTATUS_IO_FULL | SPSTATUS_DMA_FULL | SPSTATUS_DMA_BUSY)) { 7 | return 1; 8 | } 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /src/os/__osSpGetStatus.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | u32 __osSpGetStatus() { 5 | return HW_REG(SP_STATUS_REG, u32); 6 | } 7 | -------------------------------------------------------------------------------- /src/os/__osSpRawStartDma.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSpRawStartDma(u32 dir, void* sp_ptr, void* dram_ptr, size_t size) { 5 | if (__osSpDeviceBusy()) { 6 | return -1; 7 | } 8 | HW_REG(SP_MEM_ADDR_REG, void*) = sp_ptr; 9 | HW_REG(SP_DRAM_ADDR_REG, void*) = (void*) osVirtualToPhysical(dram_ptr); 10 | if (dir == 0) { 11 | HW_REG(SP_WR_LEN_REG, u32) = size - 1; 12 | } else { 13 | HW_REG(SP_RD_LEN_REG, u32) = size - 1; 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /src/os/__osSpSetPc.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | s32 __osSpSetPc(void* pc) { 5 | register u32 status = HW_REG(SP_STATUS_REG, u32); 6 | if (!(status & SPSTATUS_HALT)) { 7 | return -1; 8 | } else { 9 | HW_REG(SP_PC_REG, void*) = pc; 10 | return 0; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/os/__osSpSetStatus.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | void __osSpSetStatus(u32 status) { 5 | HW_REG(SP_STATUS_REG, u32) = status; 6 | } 7 | -------------------------------------------------------------------------------- /src/os/__osSyncPutChars.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | typedef struct { 4 | u8 unk00 : 2; 5 | u8 pad : 4; 6 | u8 unk01 : 2; 7 | u8 unk2[3]; 8 | } unkStruct; 9 | 10 | u32 D_80334A40 = 0; 11 | u32 D_80334A44 = 1; 12 | 13 | void __osSyncPutChars(s32 a0, s32 a1, u8* a2) { 14 | unkStruct sp24; 15 | s32 sp20; 16 | u32 sp1c; 17 | sp24.unk00 = a0; 18 | sp24.unk01 = a1; 19 | 20 | for (sp20 = 0; sp20 < a1; sp20++) { 21 | sp24.unk2[sp20] = a2[sp20]; 22 | } 23 | 24 | while (!__osAtomicDec(&D_80334A44)) { 25 | ; 26 | } 27 | 28 | sp1c = __osDisableInt(); 29 | 30 | *(u32*) 0xC0000000 = *(u32*) &sp24; 31 | while (!(__osGetCause() & 0x2000)) { 32 | ; 33 | } 34 | *(u32*) 0xC000000C = 0; 35 | D_80334A44++; 36 | 37 | __osRestoreInt(sp1c); 38 | } 39 | -------------------------------------------------------------------------------- /src/os/__osViGetCurrentContext.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSViContext* __osViCurr; 4 | 5 | OSViContext* __osViGetCurrentContext() { 6 | return __osViCurr; 7 | } 8 | -------------------------------------------------------------------------------- /src/os/__osViInit.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | extern u32 osTvType; 5 | 6 | OSViContext sViContexts[2] = { 0 }; 7 | OSViContext* __osViCurr = &sViContexts[0]; 8 | OSViContext* __osViNext = &sViContexts[1]; 9 | 10 | u32 osViClock = 0x02E6D354; // used for audio frequency calculations 11 | 12 | extern OSViMode osViModePalLan1; 13 | extern OSViMode osViModeMpalLan1; 14 | extern OSViMode osViModeNtscLan1; 15 | 16 | void __osViInit(void) { 17 | bzero(sViContexts, sizeof(sViContexts)); 18 | __osViCurr = &sViContexts[0]; 19 | __osViNext = &sViContexts[1]; 20 | __osViNext->retraceCount = 1; 21 | __osViCurr->retraceCount = 1; 22 | 23 | if (osTvType == TV_TYPE_PAL) { 24 | __osViNext->modep = &osViModePalLan1; 25 | osViClock = 0x02F5B2D2; 26 | } else if (osTvType == TV_TYPE_MPAL) { 27 | __osViNext->modep = &osViModeMpalLan1; 28 | osViClock = 0x02E6025C; 29 | } else { 30 | __osViNext->modep = &osViModeNtscLan1; 31 | osViClock = 0x02E6D354; 32 | } 33 | 34 | __osViNext->unk00 = 0x20; 35 | __osViNext->features = __osViNext->modep->comRegs.ctrl; 36 | while (HW_REG(VI_CURRENT_REG, u32) > 0xa) { 37 | ; 38 | } 39 | HW_REG(VI_STATUS_REG, u32) = 0; 40 | __osViSwapContext(); 41 | } 42 | -------------------------------------------------------------------------------- /src/os/bstring.h: -------------------------------------------------------------------------------- 1 | #ifndef __BSTRING_H__ 2 | #define __BSTRING_H__ 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | /* 8 | * bstring(3C) -- byte string operations 9 | * 10 | * Copyright 1990, Silicon Graphics, Inc. 11 | * All Rights Reserved. 12 | * 13 | * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; 14 | * the contents of this file may not be disclosed to third parties, copied or 15 | * duplicated in any form, in whole or in part, without the prior written 16 | * permission of Silicon Graphics, Inc. 17 | * 18 | * RESTRICTED RIGHTS LEGEND: 19 | * Use, duplication or disclosure by the Government is subject to restrictions 20 | * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data 21 | * and Computer Software clause at DFARS 252.227-7013, and/or in similar or 22 | * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - 23 | * rights reserved under the Copyright Laws of the United States. 24 | */ 25 | 26 | // Causes issues when using m2ctx, not really necessary for our purposes 27 | // #ident "$Revision: 1.4 $" 28 | 29 | extern void bcopy(const void*, void*, size_t); 30 | extern int bcmp(const void*, const void*, int); 31 | extern void bzero(void*, size_t); 32 | extern void blkclr(void*, int); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif /* !__BSTRING_H__ */ 38 | -------------------------------------------------------------------------------- /src/os/crc.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | u8 __osContAddressCrc(u16 addr) { 4 | u8 temp; 5 | u8 temp2; 6 | int i; 7 | temp = 0; 8 | for (i = 0; i < 16; i++) { 9 | if (temp & 0x10) { 10 | temp2 = 21; 11 | } else { 12 | temp2 = 0; 13 | } 14 | 15 | temp <<= 1; 16 | temp |= (u8) ((addr & 0x400) ? 1 : 0); 17 | addr <<= 1; 18 | temp ^= temp2; 19 | } 20 | return temp & 0x1f; 21 | } 22 | 23 | u8 __osContDataCrc(u8* data) { 24 | u8 temp; 25 | u8 temp2; 26 | int i; 27 | int j; 28 | temp = 0; 29 | for (i = 0; i <= 32; i++, data++) { 30 | for (j = 7; j >= 0; j--) { 31 | if (temp & 0x80) { 32 | temp2 = 133; 33 | } else { 34 | temp2 = 0; 35 | } 36 | temp <<= 1; 37 | if (i == 32) { 38 | temp &= -1; 39 | } else { 40 | temp |= ((*data & (1 << j)) ? 1 : 0); 41 | } 42 | temp ^= temp2; 43 | } 44 | } 45 | return temp; 46 | } 47 | -------------------------------------------------------------------------------- /src/os/epidma.c: -------------------------------------------------------------------------------- 1 | #ifdef VERSION_SH 2 | 3 | #include 4 | #include "piint.h" 5 | 6 | s32 osEPiStartDma(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { 7 | register s32 ret; 8 | 9 | if (!__osPiDevMgr.active) { 10 | return -1; 11 | } 12 | mb->piHandle = pihandle; 13 | if (direction == OS_READ) { 14 | mb->hdr.type = OS_MESG_TYPE_EDMAREAD; 15 | } else { 16 | mb->hdr.type = OS_MESG_TYPE_EDMAWRITE; 17 | } 18 | if (mb->hdr.pri == OS_MESG_PRI_HIGH) { 19 | ret = osJamMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK); 20 | } else { 21 | ret = osSendMesg(osPiGetCmdQueue(), mb, OS_MESG_NOBLOCK); 22 | } 23 | return ret; 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/os/guNormalize.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void guNormalize(f32* x, f32* y, f32* z) { 4 | f32 tmp = 1.0f / sqrtf(*x * *x + *y * *y + *z * *z); 5 | *x = *x * tmp; 6 | *y = *y * tmp; 7 | *z = *z * tmp; 8 | } 9 | -------------------------------------------------------------------------------- /src/os/guOrthoF.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void guOrthoF(float m[4][4], float left, float right, float bottom, float top, float near, float far, float scale) { 4 | int row; 5 | int col; 6 | guMtxIdentF(m); 7 | m[0][0] = 2 / (right - left); 8 | m[1][1] = 2 / (top - bottom); 9 | m[2][2] = -2 / (far - near); 10 | m[3][0] = -(right + left) / (right - left); 11 | m[3][1] = -(top + bottom) / (top - bottom); 12 | m[3][2] = -(far + near) / (far - near); 13 | m[3][3] = 1; 14 | for (row = 0; row < 4; row++) { 15 | for (col = 0; col < 4; col++) { 16 | m[row][col] *= scale; 17 | } 18 | } 19 | } 20 | 21 | void guOrtho(Mtx* m, float left, float right, float bottom, float top, float near, float far, float scale) { 22 | float sp28[4][4]; 23 | guOrthoF(sp28, left, right, bottom, top, near, far, scale); 24 | guMtxF2L(sp28, m); 25 | } 26 | -------------------------------------------------------------------------------- /src/os/guPerspectiveF.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void guPerspectiveF(float mf[4][4], u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { 4 | float yscale; 5 | int row; 6 | int col; 7 | guMtxIdentF(mf); 8 | fovy *= GU_PI / 180.0; 9 | yscale = cosf(fovy / 2) / sinf(fovy / 2); 10 | mf[0][0] = yscale / aspect; 11 | mf[1][1] = yscale; 12 | mf[2][2] = (near + far) / (near - far); 13 | mf[2][3] = -1; 14 | mf[3][2] = 2 * near * far / (near - far); 15 | mf[3][3] = 0.0f; 16 | for (row = 0; row < 4; row++) { 17 | for (col = 0; col < 4; col++) { 18 | mf[row][col] *= scale; 19 | } 20 | } 21 | if (perspNorm != NULL) { 22 | if (near + far <= 2.0) { 23 | *perspNorm = 65535; 24 | } else { 25 | *perspNorm = (double) (1 << 17) / (near + far); 26 | if (*perspNorm <= 0) { 27 | *perspNorm = 1; 28 | } 29 | } 30 | } 31 | } 32 | 33 | void guPerspective(Mtx* m, u16* perspNorm, float fovy, float aspect, float near, float far, float scale) { 34 | float mat[4][4]; 35 | guPerspectiveF(mat, perspNorm, fovy, aspect, near, far, scale); 36 | guMtxF2L(mat, m); 37 | } 38 | -------------------------------------------------------------------------------- /src/os/guRotateF.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void guRotateF(float m[4][4], float a, float x, float y, float z) { 4 | float sin_a; 5 | float cos_a; 6 | float sp2c; 7 | float sp28; 8 | float sp24; 9 | float xx, yy, zz; 10 | static float D_80365D70 = GU_PI / 180; 11 | 12 | guNormalize(&x, &y, &z); 13 | 14 | a = a * D_80365D70; 15 | 16 | sin_a = sinf(a); 17 | cos_a = cosf(a); 18 | 19 | sp2c = x * y * (1 - cos_a); 20 | sp28 = y * z * (1 - cos_a); 21 | sp24 = z * x * (1 - cos_a); 22 | 23 | guMtxIdentF(m); 24 | xx = x * x; 25 | m[0][0] = (1 - xx) * cos_a + xx; 26 | m[2][1] = sp28 - x * sin_a; 27 | m[1][2] = sp28 + x * sin_a; 28 | yy = y * y; 29 | m[1][1] = (1 - yy) * cos_a + yy; 30 | m[2][0] = sp24 + y * sin_a; 31 | m[0][2] = sp24 - y * sin_a; 32 | zz = z * z; 33 | m[2][2] = (1 - zz) * cos_a + zz; 34 | m[1][0] = sp2c - z * sin_a; 35 | m[0][1] = sp2c + z * sin_a; 36 | } 37 | 38 | void guRotate(Mtx* m, float a, float x, float y, float z) { 39 | float mf[4][4]; 40 | guRotateF(mf, a, x, y, z); 41 | guMtxF2L(mf, m); 42 | } 43 | -------------------------------------------------------------------------------- /src/os/guScaleF.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void guScaleF(float mf[4][4], float x, float y, float z) { 4 | guMtxIdentF(mf); 5 | mf[0][0] = x; 6 | mf[1][1] = y; 7 | mf[2][2] = z; 8 | mf[3][3] = 1.0; 9 | } 10 | 11 | void guScale(Mtx* m, float x, float y, float z) { 12 | float mf[4][4]; 13 | guScaleF(mf, x, y, z); 14 | guMtxF2L(mf, m); 15 | } 16 | -------------------------------------------------------------------------------- /src/os/guTranslateF.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void guTranslateF(float m[4][4], float x, float y, float z) { 4 | guMtxIdentF(m); 5 | m[3][0] = x; 6 | m[3][1] = y; 7 | m[3][2] = z; 8 | } 9 | 10 | void guTranslate(Mtx* m, float x, float y, float z) { 11 | float mf[4][4]; 12 | guTranslateF(mf, x, y, z); 13 | guMtxF2L(mf, m); 14 | } 15 | -------------------------------------------------------------------------------- /src/os/ldiv.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include 3 | 4 | lldiv_t lldiv(long long num, long long denom) { 5 | lldiv_t ret; 6 | 7 | ret.quot = num / denom; 8 | ret.rem = num - denom * ret.quot; 9 | if (ret.quot < 0 && ret.rem > 0) { 10 | ret.quot++; 11 | ret.rem -= denom; 12 | } 13 | 14 | return ret; 15 | } 16 | 17 | ldiv_t ldiv(long num, long denom) { 18 | ldiv_t ret; 19 | 20 | ret.quot = num / denom; 21 | ret.rem = num - denom * ret.quot; 22 | if (ret.quot < 0 && ret.rem > 0) { 23 | ret.quot++; 24 | ret.rem -= denom; 25 | } 26 | 27 | return ret; 28 | } 29 | -------------------------------------------------------------------------------- /src/os/math/llconv.c: -------------------------------------------------------------------------------- 1 | typedef signed long long int s64; 2 | typedef unsigned long long int u64; 3 | s64 __d_to_ll(double d) { 4 | return d; 5 | } 6 | s64 __f_to_ll(float f) { 7 | return f; 8 | } 9 | u64 __d_to_ull(double d) { 10 | return d; 11 | } 12 | u64 __f_to_ull(float f) { 13 | return f; 14 | } 15 | double __ll_to_d(s64 s) { 16 | return s; 17 | } 18 | float __ll_to_f(s64 s) { 19 | return s; 20 | } 21 | double __ull_to_d(u64 u) { 22 | return u; 23 | } 24 | float __ull_to_f(u64 u) { 25 | return u; 26 | } 27 | -------------------------------------------------------------------------------- /src/os/math/llmuldiv.c: -------------------------------------------------------------------------------- 1 | unsigned long long __ull_rshift(unsigned long long a0, unsigned long long a1) { 2 | return a0 >> a1; 3 | } 4 | unsigned long long __ull_rem(unsigned long long a0, unsigned long long a1) { 5 | return a0 % a1; 6 | } 7 | unsigned long long __ull_div(unsigned long long a0, unsigned long long a1) { 8 | return a0 / a1; 9 | } 10 | 11 | unsigned long long __ll_lshift(unsigned long long a0, unsigned long long a1) { 12 | return a0 << a1; 13 | } 14 | 15 | long long __ll_rem(unsigned long long a0, long long a1) { 16 | return a0 % a1; 17 | } 18 | 19 | long long __ll_div(long long a0, long long a1) { 20 | return a0 / a1; 21 | } 22 | 23 | unsigned long long __ll_mul(unsigned long long a0, unsigned long long a1) { 24 | return a0 * a1; 25 | } 26 | 27 | void __ull_divremi(unsigned long long* div, unsigned long long* rem, unsigned long long a2, unsigned short a3) { 28 | *div = a2 / a3; 29 | *rem = a2 % a3; 30 | } 31 | long long __ll_mod(long long a0, long long a1) { 32 | long long tmp = a0 % a1; 33 | if ((tmp < 0 && a1 > 0) || (tmp > 0 && a1 < 0)) { 34 | 35 | tmp += a1; 36 | } 37 | return tmp; 38 | } 39 | 40 | long long __ll_rshift(long long a0, long long a1) { 41 | return a0 >> a1; 42 | } 43 | -------------------------------------------------------------------------------- /src/os/new_func.h: -------------------------------------------------------------------------------- 1 | #ifndef NEW_FUNC_H 2 | #define NEW_FUNC_H 3 | 4 | #include "libultra_internal.h" 5 | #include "hardware.h" 6 | 7 | #define WAIT_ON_IOBUSY(var) \ 8 | var = HW_REG(PI_STATUS_REG, u32); \ 9 | while (var & PI_STATUS_IOBUSY) \ 10 | var = HW_REG(PI_STATUS_REG, u32); 11 | 12 | extern u32 EU_D_80302090; 13 | 14 | extern OSPiHandle* __osDiskHandle; // possibly __osPiTable 15 | 16 | extern volatile u32 __OSGlobalIntMask; 17 | s32 osEPiRawStartDma(OSPiHandle* arg0, s32 dir, u32 cart_addr, void* dram_addr, u32 size); 18 | void func_802F4B08(void); 19 | void func_802F4A20(void); 20 | void __osResetGlobalIntMask(u32 mask); 21 | void __osEPiRawWriteIo(OSPiHandle*, u32, u32); 22 | void func_802F71F0(void); 23 | #ifdef VERSION_SH 24 | void __osSetGlobalIntMask(s32 arg0); 25 | s32 __osEPiRawReadIo(OSPiHandle* arg0, u32 devAddr, u32* arg2); 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/os/osAi.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSAI_H_ 2 | #define _OSAI_H_ 3 | 4 | s32 osAiSetFrequency(u32); 5 | s32 osAiSetNextBuffer(void*, u32); 6 | u32 osAiGetLength(void); 7 | #endif 8 | -------------------------------------------------------------------------------- /src/os/osAiGetLength.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "osAi.h" 3 | #include "hardware.h" 4 | 5 | u32 osAiGetLength() { 6 | return HW_REG(AI_LEN_REG, u32); 7 | } 8 | -------------------------------------------------------------------------------- /src/os/osAiSetFrequency.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "osAi.h" 3 | #include "hardware.h" 4 | 5 | extern s32 osViClock; 6 | 7 | s32 osAiSetFrequency(u32 freq) { 8 | register u32 a1; 9 | register s32 a2; 10 | register float ftmp; 11 | ftmp = osViClock / (float) freq + .5f; 12 | 13 | a1 = ftmp; 14 | 15 | if (a1 < 0x84) { 16 | return -1; 17 | } 18 | 19 | a2 = (a1 / 66) & 0xff; 20 | if (a2 > 16) { 21 | a2 = 16; 22 | } 23 | 24 | HW_REG(AI_DACRATE_REG, u32) = a1 - 1; 25 | HW_REG(AI_BITRATE_REG, u32) = a2 - 1; 26 | HW_REG(AI_CONTROL_REG, u32) = 1; // enable dma 27 | return osViClock / (s32) a1; 28 | } 29 | -------------------------------------------------------------------------------- /src/os/osAiSetNextBuffer.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "osAi.h" 3 | #include "hardware.h" 4 | 5 | u8 hdwrBugFlag = 0; 6 | 7 | /** 8 | * It is worth noting that a previous hardware bug has been fixed by a software 9 | * patch in osAiSetNextBuffer. This bug occurred when the address of the end of the 10 | * buffer specified by osAiSetNextBuffer was at a specific value. This value 11 | * occurred when the following was true: 12 | * 13 | * (vaddr + nbytes) & 0x00003FFF == 0x00002000 14 | * 15 | * (when the buffer ends with address of lower 14 bits 0x2000) In this case, the 16 | * DMA transfer does not complete successfully. This can cause clicks and pops in 17 | * the audio output. This bug no longer requires special handling by the application 18 | * because it is now patched by osAiSetNextBuffer. 19 | */ 20 | 21 | s32 osAiSetNextBuffer(void* buff, u32 len) { 22 | u8* sp1c = buff; 23 | if (hdwrBugFlag != 0) { 24 | sp1c -= 0x2000; 25 | } 26 | 27 | if ((((uintptr_t) buff + len) & 0x3fff) == 0x2000) { 28 | hdwrBugFlag = 1; 29 | } else { 30 | hdwrBugFlag = 0; 31 | } 32 | 33 | if (__osAiDeviceBusy()) { 34 | return -1; 35 | } 36 | 37 | HW_REG(AI_DRAM_ADDR_REG, void*) = (void*) osVirtualToPhysical(sp1c); 38 | HW_REG(AI_LEN_REG, u32) = len; 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /src/os/osCartRomInit.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | OSPiHandle CartRomHandle; 11 | 12 | OSPiHandle* osCartRomInit(void) { 13 | u32 domain; 14 | u32 saveMask; 15 | 16 | domain = 0; 17 | 18 | if (CartRomHandle.baseAddress == PHYS_TO_K1(PI_DOM1_ADDR2)) { 19 | return &CartRomHandle; 20 | } 21 | 22 | CartRomHandle.type = DEVICE_TYPE_CART; 23 | CartRomHandle.baseAddress = PHYS_TO_K1(PI_DOM1_ADDR2); 24 | osPiRawReadIo(0, &domain); 25 | CartRomHandle.latency = domain & 0xff; 26 | CartRomHandle.pulse = (domain >> 8) & 0xff; 27 | CartRomHandle.pageSize = (domain >> 0x10) & 0xf; 28 | CartRomHandle.relDuration = (domain >> 0x14) & 0xf; 29 | CartRomHandle.domain = PI_DOMAIN1; 30 | // CartRomHandle.speed = 0; 31 | 32 | bzero(&CartRomHandle.transferInfo, sizeof(__OSTranxInfo)); 33 | 34 | saveMask = __osDisableInt(); 35 | CartRomHandle.next = __osPiTable; 36 | __osPiTable = &CartRomHandle; 37 | __osRestoreInt(saveMask); 38 | 39 | return &CartRomHandle; 40 | } 41 | -------------------------------------------------------------------------------- /src/os/osCreateMesgQueue.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void osCreateMesgQueue(OSMesgQueue* mq, OSMesg* msgBuf, s32 count) { 4 | mq->mtqueue = (OSThread*) &__osThreadTail.next; 5 | mq->fullqueue = (OSThread*) &__osThreadTail.next; 6 | mq->validCount = 0; 7 | mq->first = 0; 8 | mq->msgCount = count; 9 | mq->msg = msgBuf; 10 | } 11 | -------------------------------------------------------------------------------- /src/os/osCreateThread.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void __osCleanupThread(void); 4 | 5 | // Don't warn about pointer->u64 cast 6 | #pragma GCC diagnostic push 7 | #pragma GCC diagnostic ignored "-Wpointer-to-int-cast" 8 | 9 | void osCreateThread(OSThread* thread, OSId id, void (*entry)(void*), void* arg, void* sp, OSPri pri) { 10 | register u32 int_disabled; 11 | u32 tmp; 12 | thread->id = id; 13 | thread->priority = pri; 14 | thread->next = NULL; 15 | thread->queue = NULL; 16 | thread->context.pc = (u32) entry; 17 | thread->context.a0 = (u64) arg; 18 | thread->context.sp = (u64) sp - 16; 19 | thread->context.ra = (u64) __osCleanupThread; 20 | tmp = OS_IM_ALL; 21 | thread->context.sr = 65283; 22 | thread->context.rcp = (tmp & 0x3f0000) >> 16; 23 | thread->context.fpcsr = (u32) 0x01000800; 24 | thread->fp = 0; 25 | thread->state = OS_STATE_STOPPED; 26 | thread->flags = 0; 27 | int_disabled = __osDisableInt(); 28 | thread->tlnext = __osActiveQueue; 29 | 30 | __osActiveQueue = thread; 31 | __osRestoreInt(int_disabled); 32 | } 33 | 34 | #pragma GCC diagnostic pop 35 | -------------------------------------------------------------------------------- /src/os/osDestroyThread.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void osDestroyThread(OSThread* thread) { 4 | register s32 int_disabled; 5 | register OSThread* s1; 6 | register OSThread* s2; 7 | 8 | int_disabled = __osDisableInt(); 9 | 10 | if (thread == NULL) { 11 | thread = __osRunningThread; 12 | } else if (thread->state != OS_STATE_STOPPED) { 13 | __osDequeueThread(thread->queue, thread); 14 | } 15 | 16 | if (__osActiveQueue == thread) { 17 | __osActiveQueue = __osActiveQueue->tlnext; 18 | } else { 19 | s1 = __osActiveQueue; 20 | s2 = s1->tlnext; 21 | while (s2 != NULL) { 22 | if (s2 == thread) { 23 | s1->tlnext = thread->tlnext; 24 | break; 25 | } else { 26 | s1 = s2; 27 | s2 = s1->tlnext; 28 | } 29 | } 30 | } 31 | 32 | if (thread == __osRunningThread) { 33 | __osDispatchThread(); 34 | } 35 | 36 | __osRestoreInt(int_disabled); 37 | } 38 | -------------------------------------------------------------------------------- /src/os/osEPiRawStartDma.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | #include "new_func.h" 4 | #include 5 | //! @todo This define is from piint.h, but including that causes problems... 6 | #define UPDATE_REG(reg, var) \ 7 | if (cHandle->var != pihandle->var) \ 8 | IO_WRITE(reg, pihandle->var); 9 | //! @todo This define is from os.h, but including that causes problems... 10 | #define PI_DOMAIN1 0 11 | //! @todo These defines are from PR/rcp.h, but including that causes problems... 12 | #define IO_WRITE(addr, data) (*(vu32*) PHYS_TO_K1(addr) = (u32) (data)) 13 | 14 | s32 osEPiRawStartDma(OSPiHandle* pihandle, s32 dir, u32 cart_addr, void* dram_addr, u32 size) { 15 | register int status; 16 | 17 | status = HW_REG(PI_STATUS_REG, u32); 18 | while (status & PI_STATUS_ERROR) { 19 | status = HW_REG(PI_STATUS_REG, u32); 20 | } 21 | 22 | HW_REG(PI_DRAM_ADDR_REG, void*) = (void*) osVirtualToPhysical(dram_addr); 23 | HW_REG(PI_CART_ADDR_REG, void*) = (void*) (((uintptr_t) pihandle->baseAddress | cart_addr) & 0x1fffffff); 24 | 25 | switch (dir) { 26 | case OS_READ: 27 | HW_REG(PI_WR_LEN_REG, u32) = size - 1; 28 | break; 29 | case OS_WRITE: 30 | HW_REG(PI_RD_LEN_REG, u32) = size - 1; 31 | break; 32 | default: 33 | return -1; 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /src/os/osEepromLongRead.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern u64 osClockRate; 4 | extern u8 D_80365D20; 5 | extern u8 _osContNumControllers; 6 | extern OSTimer D_80196548; // not sure what this is yet 7 | extern OSMesgQueue _osContMesgQueue; 8 | extern OSMesg _osContMesgBuff[4]; 9 | 10 | s32 osEepromLongRead(OSMesgQueue* mq, u8 address, u8* buffer, s32 nbytes) { 11 | s32 status = 0; 12 | if (address > 0x40) { 13 | return -1; 14 | } 15 | 16 | while (nbytes > 0) { 17 | status = osEepromRead(mq, address, buffer); 18 | if (status != 0) { 19 | return status; 20 | } 21 | 22 | nbytes -= EEPROM_BLOCK_SIZE; 23 | address++; 24 | buffer += EEPROM_BLOCK_SIZE; 25 | osSetTimer(&D_80196548, 12000 * osClockRate / 1000000, 0, &_osContMesgQueue, _osContMesgBuff); 26 | osRecvMesg(&_osContMesgQueue, NULL, OS_MESG_BLOCK); 27 | } 28 | 29 | return status; 30 | } 31 | -------------------------------------------------------------------------------- /src/os/osEepromLongWrite.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "controller.h" 3 | 4 | extern u8 D_80365D20; 5 | extern OSTimer D_80196548; 6 | extern OSMesgQueue _osContMesgQueue; 7 | extern OSMesg _osContMesgBuff[4]; 8 | 9 | // exactly the same as osEepromLongRead except for osEepromWrite call 10 | s32 osEepromLongWrite(OSMesgQueue* mq, u8 address, u8* buffer, s32 nbytes) { 11 | s32 result = 0; 12 | if (address > 0x40) { 13 | return -1; 14 | } 15 | 16 | while (nbytes > 0) { 17 | result = osEepromWrite(mq, address, buffer); 18 | if (result != 0) { 19 | return result; 20 | } 21 | 22 | nbytes -= EEPROM_BLOCK_SIZE; 23 | address++; 24 | buffer += EEPROM_BLOCK_SIZE; 25 | osSetTimer(&D_80196548, 12000 * osClockRate / 1000000, 0, &_osContMesgQueue, _osContMesgBuff); 26 | osRecvMesg(&_osContMesgQueue, NULL, OS_MESG_BLOCK); 27 | } 28 | 29 | return result; 30 | } 31 | -------------------------------------------------------------------------------- /src/os/osEepromProbe.c: -------------------------------------------------------------------------------- 1 | #include "macros.h" 2 | #include "libultra_internal.h" 3 | #include "controller.h" 4 | 5 | s32 __osEepStatus(OSMesgQueue*, OSContStatus*); 6 | s32 osEepromProbe(OSMesgQueue* mq) { 7 | s32 ret = 0; 8 | OSContStatus status; 9 | 10 | __osSiGetAccess(); 11 | ret = __osEepStatus(mq, &status); 12 | ret = (ret == 0 && (status.type & CONT_EEPROM) != 0) ? EEPROM_TYPE_4K : 0; 13 | __osSiRelAccess(); 14 | return ret; 15 | } 16 | -------------------------------------------------------------------------------- /src/os/osGetThreadPri.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | OSPri osGetThreadPri(OSThread* thread) { 4 | if (thread == NULL) { 5 | thread = __osRunningThread; 6 | } 7 | return thread->priority; 8 | } 9 | -------------------------------------------------------------------------------- /src/os/osGetTime.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSTime __osCurrentTime; 4 | extern u32 __osBaseCounter; 5 | 6 | OSTime osGetTime() { 7 | u32 tmptime; 8 | u32 elapseCount; 9 | OSTime currentCount; 10 | register u32 saveMask; 11 | saveMask = __osDisableInt(); 12 | tmptime = osGetCount(); 13 | elapseCount = tmptime - __osBaseCounter; 14 | currentCount = __osCurrentTime; 15 | __osRestoreInt(saveMask); 16 | return currentCount + elapseCount; 17 | } 18 | -------------------------------------------------------------------------------- /src/os/osJamMesg.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { 4 | register s32 int_disabled; 5 | int_disabled = __osDisableInt(); 6 | while (mq->validCount >= mq->msgCount) { 7 | if (flag == OS_MESG_BLOCK) { 8 | __osRunningThread->state = OS_STATE_WAITING; 9 | __osEnqueueAndYield(&mq->fullqueue); 10 | } else { 11 | __osRestoreInt(int_disabled); 12 | return -1; 13 | } 14 | } 15 | 16 | mq->first = (mq->first + mq->msgCount - 1) % mq->msgCount; 17 | mq->msg[mq->first] = msg; 18 | mq->validCount++; 19 | if (mq->mtqueue->next != NULL) { 20 | osStartThread(__osPopThread(&mq->mtqueue)); 21 | } 22 | __osRestoreInt(int_disabled); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /src/os/osLeoDiskInit.c: -------------------------------------------------------------------------------- 1 | #define MK64 2 | 3 | #include "libultra_internal.h" 4 | #include "hardware.h" 5 | 6 | // this file must include some globally referenced data because it is not called anywhere 7 | // data, comes shortly before _Ldtob I think, before crash_screen 8 | 9 | extern OSPiHandle* __osPiTable; 10 | // bss 11 | OSPiHandle LeoDiskHandle; 12 | OSPiHandle* __osDiskHandle; 13 | 14 | OSPiHandle* osLeoDiskInit(void) { 15 | s32 sp1c; 16 | LeoDiskHandle.type = 2; 17 | LeoDiskHandle.baseAddress = (0xa0000000 | 0x05000000); 18 | LeoDiskHandle.latency = 3; 19 | LeoDiskHandle.pulse = 6; 20 | LeoDiskHandle.pageSize = 6; 21 | LeoDiskHandle.relDuration = 2; 22 | #ifdef VERSION_SH 23 | LeoDiskHandle.domain = 1; 24 | #endif 25 | HW_REG(PI_BSD_DOM2_LAT_REG, u32) = LeoDiskHandle.latency; 26 | HW_REG(PI_BSD_DOM2_PWD_REG, u32) = LeoDiskHandle.pulse; 27 | HW_REG(PI_BSD_DOM2_PGS_REG, u32) = LeoDiskHandle.pageSize; 28 | HW_REG(PI_BSD_DOM2_RLS_REG, u32) = LeoDiskHandle.relDuration; 29 | bzero(&LeoDiskHandle.transferInfo, sizeof(__OSTranxInfo)); 30 | sp1c = __osDisableInt(); 31 | LeoDiskHandle.next = __osPiTable; 32 | __osPiTable = &LeoDiskHandle; 33 | __osDiskHandle = &LeoDiskHandle; 34 | __osRestoreInt(sp1c); 35 | return &LeoDiskHandle; 36 | } 37 | 38 | #undef MK64 39 | -------------------------------------------------------------------------------- /src/os/osPfsFreeBlocks.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "controller.h" 3 | 4 | s32 osPfsFreeBlocks(OSPfs* pfs, s32* bytes_not_used) { 5 | int j; 6 | int pages; 7 | __OSInode inode; 8 | s32 ret; 9 | u8 bank; 10 | int offset; 11 | pages = 0; 12 | ret = 0; 13 | PFS_CHECK_STATUS; 14 | PFS_CHECK_ID; 15 | for (bank = 0; bank < pfs->banks; bank++) { 16 | ERRCK(__osPfsRWInode(pfs, &inode, OS_READ, bank)); 17 | if (bank > 0) { 18 | offset = 1; 19 | } else { 20 | offset = pfs->inode_start_page; 21 | } 22 | for (j = offset; j < ARRLEN(inode.inode_page); j++) { 23 | if (inode.inode_page[j].ipage == 3) { 24 | pages++; 25 | } 26 | } 27 | } 28 | *bytes_not_used = pages * PFS_ONE_PAGE * BLOCKSIZE; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /src/os/osPfsNumFiles.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include 3 | #include "controller.h" 4 | 5 | s32 osPfsNumFiles(OSPfs* pfs, s32* max_files, s32* files_used) { 6 | int j; 7 | s32 ret; 8 | __OSDir dir; 9 | int files; 10 | files = 0; 11 | PFS_CHECK_STATUS; 12 | PFS_CHECK_ID; 13 | SET_ACTIVEBANK_TO_ZERO; 14 | for (j = 0; j < pfs->dir_size; j++) { 15 | ERRCK(__osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*) &dir)); 16 | if (dir.company_code != 0 && dir.game_code != 0) { 17 | files++; 18 | } 19 | } 20 | *files_used = files; 21 | *max_files = pfs->dir_size; 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /src/os/osPfsSearchFile.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "controller.h" 3 | 4 | s32 osPfsFindFile(OSPfs* pfs, u16 company_code, u32 game_code, u8* game_name, u8* ext_name, s32* file_no) { 5 | s32 j; 6 | int i; 7 | __OSDir dir; 8 | s32 ret; 9 | int fail; 10 | ret = 0; 11 | PFS_CHECK_ID; 12 | for (j = 0; j < pfs->dir_size; j++) { 13 | ERRCK(__osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + j, (u8*) &dir)); 14 | if ((dir.company_code == company_code) && dir.game_code == game_code) { 15 | fail = false; 16 | if (game_name != NULL) { 17 | for (i = 0; i < ARRLEN(dir.game_name); i++) { 18 | if (dir.game_name[i] != game_name[i]) { 19 | fail = true; 20 | break; 21 | } 22 | } 23 | } 24 | if (ext_name != NULL && !fail) { 25 | 26 | for (i = 0; i < ARRLEN(dir.ext_name); i++) { 27 | if (dir.ext_name[i] != ext_name[i]) { 28 | fail = true; 29 | break; 30 | } 31 | } 32 | } 33 | if (!fail) { 34 | *file_no = j; 35 | return ret; 36 | } 37 | } 38 | } 39 | *file_no = -1; 40 | return PFS_ERR_INVALID; 41 | } 42 | -------------------------------------------------------------------------------- /src/os/osPiGetCmdQueue.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSMgrArgs __osPiDevMgr; 4 | 5 | OSMesgQueue* osPiGetCmdQueue(void) { 6 | if (!__osPiDevMgr.initialized) { 7 | return NULL; 8 | } 9 | return __osPiDevMgr.cmdQueue; 10 | } 11 | -------------------------------------------------------------------------------- /src/os/osPiRawReadIo.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "hardware.h" 3 | 4 | extern u32 osRomBase; 5 | 6 | s32 osPiRawReadIo(u32 a0, u32* a1) { 7 | register int status; 8 | status = HW_REG(PI_STATUS_REG, u32); 9 | while (status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) { 10 | status = HW_REG(PI_STATUS_REG, u32); 11 | } 12 | *a1 = HW_REG(osRomBase | a0, u32); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /src/os/osPiStartDma.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSMgrArgs __osPiDevMgr; 4 | 5 | s32 osPiStartDma(OSIoMesg* mb, s32 priority, s32 direction, uintptr_t devAddr, void* vAddr, size_t nbytes, 6 | OSMesgQueue* mq) { 7 | register s32 result; 8 | register OSMesgQueue* cmdQueue; 9 | if (!__osPiDevMgr.initialized) { 10 | return -1; 11 | } 12 | 13 | //! @todo name magic constants 14 | if (direction == OS_READ) { 15 | mb->hdr.type = 11; 16 | } else { 17 | mb->hdr.type = 12; 18 | } 19 | 20 | mb->hdr.pri = priority; 21 | mb->hdr.retQueue = mq; 22 | mb->dramAddr = vAddr; 23 | mb->devAddr = devAddr; 24 | mb->size = nbytes; 25 | mb->piHandle = NULL; 26 | 27 | if (priority == OS_MESG_PRI_HIGH) { 28 | cmdQueue = osPiGetCmdQueue(); 29 | result = osJamMesg(cmdQueue, mb, OS_MESG_NOBLOCK); 30 | } else { 31 | cmdQueue = osPiGetCmdQueue(); 32 | result = osSendMesg(cmdQueue, mb, OS_MESG_NOBLOCK); 33 | } 34 | return result; 35 | } 36 | -------------------------------------------------------------------------------- /src/os/osRecvMesg.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag) { 4 | register u32 int_disabled; 5 | register OSThread* thread; 6 | int_disabled = __osDisableInt(); 7 | 8 | while (!mq->validCount) { 9 | if (!flag) { 10 | __osRestoreInt(int_disabled); 11 | return -1; 12 | } 13 | __osRunningThread->state = OS_STATE_WAITING; 14 | __osEnqueueAndYield(&mq->mtqueue); 15 | } 16 | 17 | if (msg != NULL) { 18 | *msg = *(mq->first + mq->msg); 19 | } 20 | 21 | mq->first = (mq->first + 1) % mq->msgCount; 22 | mq->validCount--; 23 | 24 | if (mq->fullqueue->next != NULL) { 25 | thread = __osPopThread(&mq->fullqueue); 26 | osStartThread(thread); 27 | } 28 | 29 | __osRestoreInt(int_disabled); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /src/os/osSendMesg.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | s32 osSendMesg(OSMesgQueue* mq, OSMesg msg, s32 flag) { 4 | register u32 int_disabled; 5 | register s32 index; 6 | register OSThread* s2; 7 | int_disabled = __osDisableInt(); 8 | 9 | while (mq->validCount >= mq->msgCount) { 10 | if (flag == OS_MESG_BLOCK) { 11 | __osRunningThread->state = 8; 12 | __osEnqueueAndYield(&mq->fullqueue); 13 | } else { 14 | __osRestoreInt(int_disabled); 15 | return -1; 16 | } 17 | } 18 | 19 | index = (mq->first + mq->validCount) % mq->msgCount; 20 | mq->msg[index] = msg; 21 | mq->validCount++; 22 | 23 | if (mq->mtqueue->next != NULL) { 24 | s2 = __osPopThread(&mq->mtqueue); 25 | osStartThread(s2); 26 | } 27 | 28 | __osRestoreInt(int_disabled); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /src/os/osSetEventMesg.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | typedef struct OSEventMessageStruct_0_s { 4 | OSMesgQueue* queue; 5 | OSMesg msg; 6 | } OSEventMessageStruct_0; 7 | 8 | OSEventMessageStruct_0 __osEventStateTab[16]; 9 | 10 | void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg msg) { 11 | register u32 int_disabled; 12 | OSEventMessageStruct_0* msgs; 13 | int_disabled = __osDisableInt(); 14 | msgs = __osEventStateTab + e; 15 | msgs->queue = mq; 16 | msgs->msg = msg; 17 | __osRestoreInt(int_disabled); 18 | } 19 | -------------------------------------------------------------------------------- /src/os/osSetThreadPri.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void osSetThreadPri(OSThread* thread, OSPri pri) { 4 | register u32 int_disabled = __osDisableInt(); 5 | if (thread == NULL) { 6 | thread = __osRunningThread; 7 | } 8 | 9 | if (thread->priority != pri) { 10 | thread->priority = pri; 11 | if (thread != __osRunningThread) { 12 | if (thread->state != OS_STATE_STOPPED) { 13 | __osDequeueThread(thread->queue, thread); 14 | __osEnqueueThread(thread->queue, thread); 15 | } 16 | } 17 | if (__osRunningThread->priority < __osRunQueue->priority) { 18 | __osRunningThread->state = OS_STATE_RUNNABLE; 19 | __osEnqueueAndYield(&__osRunQueue); 20 | } 21 | } 22 | 23 | __osRestoreInt(int_disabled); 24 | } 25 | -------------------------------------------------------------------------------- /src/os/osSetTime.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSTime __osCurrentTime; 4 | 5 | void osSetTime(OSTime time) { 6 | __osCurrentTime = time; 7 | } 8 | -------------------------------------------------------------------------------- /src/os/osSetTimer.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSTimer* __osTimerList; 4 | extern u64 __osInsertTimer(OSTimer*); 5 | 6 | u32 osSetTimer(OSTimer* a0, OSTime a1, u64 a2, OSMesgQueue* a3, OSMesg a4) { 7 | u64 sp18; 8 | a0->next = NULL; 9 | a0->prev = NULL; 10 | a0->interval = a2; 11 | if (a1 != 0) { 12 | a0->remaining = a1; 13 | } else { 14 | a0->remaining = a2; 15 | } 16 | a0->mq = a3; 17 | a0->msg = a4; 18 | sp18 = __osInsertTimer(a0); 19 | if (__osTimerList->next == a0) { 20 | __osSetTimerIntr(sp18); 21 | } 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /src/os/osSpTaskYield.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void osSpTaskYield(void) { 4 | __osSpSetStatus(SPSTATUS_SET_SIGNAL0); 5 | } 6 | -------------------------------------------------------------------------------- /src/os/osSpTaskYielded.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | OSYieldResult osSpTaskYielded(OSTask* task) { 4 | s32 status; 5 | u32 int_disabledult; 6 | status = __osSpGetStatus(); 7 | if (status & SPSTATUS_SIGNAL1_SET) { 8 | int_disabledult = 1; 9 | } else { 10 | int_disabledult = 0; 11 | } 12 | if (status & SPSTATUS_SIGNAL0_SET) { 13 | task->t.flags |= int_disabledult; 14 | task->t.flags &= ~(M_TASK_FLAG1); 15 | } 16 | return int_disabledult; 17 | } 18 | -------------------------------------------------------------------------------- /src/os/osStartThread.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | void osStartThread(OSThread* thread) { 4 | register u32 int_disabled; 5 | register uintptr_t state; 6 | int_disabled = __osDisableInt(); 7 | state = thread->state; 8 | 9 | if (state != OS_STATE_STOPPED) { 10 | if (state == OS_STATE_WAITING) { 11 | do { 12 | } while (0); 13 | thread->state = OS_STATE_RUNNABLE; 14 | __osEnqueueThread(&__osRunQueue, thread); 15 | } 16 | } else { 17 | if (thread->queue == NULL || thread->queue == &__osRunQueue) { 18 | thread->state = OS_STATE_RUNNABLE; 19 | 20 | __osEnqueueThread(&__osRunQueue, thread); 21 | } else { 22 | thread->state = OS_STATE_WAITING; 23 | __osEnqueueThread(thread->queue, thread); 24 | state = (uintptr_t) __osPopThread(thread->queue); 25 | __osEnqueueThread(&__osRunQueue, (OSThread*) state); 26 | } 27 | } 28 | if (__osRunningThread == NULL) { 29 | __osDispatchThread(); 30 | } else { 31 | if (__osRunningThread->priority < __osRunQueue->priority) { 32 | __osRunningThread->state = OS_STATE_RUNNABLE; 33 | __osEnqueueAndYield(&__osRunQueue); 34 | } 35 | } 36 | __osRestoreInt(int_disabled); 37 | } 38 | -------------------------------------------------------------------------------- /src/os/osSyncPrintf.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "libc/stdarg.h" 3 | #include "printf.h" 4 | 5 | // These funcs defined in is_debug.c 6 | #ifndef DEBUG 7 | 8 | char* osSyncPrintf(UNUSED char* arg0, UNUSED const char* arg1, UNUSED size_t size) { 9 | // ifdef'd formatting code? 10 | return (char*) (1); 11 | } 12 | 13 | void rmonPrintf(const char* fmt, ...) { 14 | va_list args; 15 | va_start(args, fmt); 16 | _Printf(osSyncPrintf, NULL, fmt, args); 17 | va_end(args); 18 | } 19 | 20 | #endif // DEBUG 21 | -------------------------------------------------------------------------------- /src/os/osViBlack.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSViContext* __osViNext; 4 | 5 | //! @todo name magic constants 6 | void osViBlack(u8 active) { 7 | register u32 int_disabled = __osDisableInt(); 8 | if (active) { 9 | __osViNext->unk00 |= 0x20; 10 | } else { 11 | __osViNext->unk00 &= ~0x20; 12 | } 13 | __osRestoreInt(int_disabled); 14 | } 15 | -------------------------------------------------------------------------------- /src/os/osViSetEvent.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSViContext* __osViNext; 4 | 5 | void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount) { 6 | register u32 int_disabled = __osDisableInt(); 7 | (__osViNext)->mq = mq; 8 | (__osViNext)->msg = msg; 9 | (__osViNext)->retraceCount = retraceCount; 10 | __osRestoreInt(int_disabled); 11 | } 12 | -------------------------------------------------------------------------------- /src/os/osViSetMode.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSViContext* __osViNext; 4 | 5 | void osViSetMode(OSViMode* mode) { 6 | register u32 int_disabled = __osDisableInt(); 7 | __osViNext->modep = mode; 8 | __osViNext->unk00 = 1; 9 | __osViNext->features = __osViNext->modep->comRegs.ctrl; 10 | __osRestoreInt(int_disabled); 11 | } 12 | -------------------------------------------------------------------------------- /src/os/osViSetSpecialFeatures.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSViContext* __osViNext; 4 | 5 | void osViSetSpecialFeatures(u32 func) { 6 | register u32 int_disabled = __osDisableInt(); 7 | if (func & OS_VI_GAMMA_ON) { 8 | __osViNext->features |= OS_VI_GAMMA; 9 | } 10 | if (func & OS_VI_GAMMA_OFF) { 11 | __osViNext->features &= ~OS_VI_GAMMA; 12 | } 13 | if (func & OS_VI_GAMMA_DITHER_ON) { 14 | __osViNext->features |= OS_VI_GAMMA_DITHER; 15 | } 16 | if (func & OS_VI_GAMMA_DITHER_OFF) { 17 | __osViNext->features &= ~OS_VI_GAMMA_DITHER; 18 | } 19 | if (func & OS_VI_DIVOT_ON) { 20 | __osViNext->features |= OS_VI_DIVOT; 21 | } 22 | if (func & OS_VI_DIVOT_OFF) { 23 | __osViNext->features &= ~OS_VI_DIVOT; 24 | } 25 | if (func & OS_VI_DITHER_FILTER_ON) { 26 | __osViNext->features |= OS_VI_DITHER_FILTER; 27 | __osViNext->features &= ~(OS_VI_UNK200 | OS_VI_UNK100); 28 | } 29 | if (func & OS_VI_DITHER_FILTER_OFF) { 30 | __osViNext->features &= ~OS_VI_DITHER_FILTER; 31 | __osViNext->features |= __osViNext->modep->comRegs.ctrl & (OS_VI_UNK200 | OS_VI_UNK100); 32 | } 33 | __osViNext->unk00 |= 8; 34 | __osRestoreInt(int_disabled); 35 | } 36 | -------------------------------------------------------------------------------- /src/os/osViSwapBuffer.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | extern OSViContext* __osViNext; 4 | 5 | void osViSwapBuffer(void* vaddr) { 6 | u32 int_disabled = __osDisableInt(); 7 | __osViNext->buffer = vaddr; 8 | //! @todo figure out what this flag means 9 | __osViNext->unk00 |= 0x10; 10 | __osRestoreInt(int_disabled); 11 | } 12 | -------------------------------------------------------------------------------- /src/os/osVirtualToPhysical.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | 3 | uintptr_t osVirtualToPhysical(void* addr) { 4 | if ((uintptr_t) addr >= 0x80000000 && (uintptr_t) addr < 0xa0000000) { 5 | return ((uintptr_t) addr & 0x1fffffff); 6 | } else if ((uintptr_t) addr >= 0xa0000000 && (uintptr_t) addr < 0xc0000000) { 7 | return ((uintptr_t) addr & 0x1fffffff); 8 | } else { 9 | return __osProbeTLB(addr); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/os/osYieldThread.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include "osint.h" 3 | 4 | void osYieldThread(void) { 5 | register u32 saveMask = __osDisableInt(); 6 | __osRunningThread->state = OS_STATE_RUNNABLE; 7 | __osEnqueueAndYield(&__osRunQueue); 8 | __osRestoreInt(saveMask); 9 | } 10 | -------------------------------------------------------------------------------- /src/os/osint.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSINT_H 2 | #define _OSINT_H 3 | #include "libultra_internal.h" 4 | #include 5 | 6 | // maybe should be in exceptasm.h? 7 | extern void __osEnqueueAndYield(OSThread**); 8 | extern void __osDequeueThread(OSThread**, OSThread*); 9 | extern void __osEnqueueThread(OSThread**, OSThread*); 10 | extern OSThread* __osPopThread(OSThread**); 11 | extern void __osDispatchThread(void); 12 | 13 | extern void __osSetTimerIntr(OSTime); 14 | extern OSTime __osInsertTimer(OSTimer*); 15 | extern void __osTimerInterrupt(void); 16 | extern u32 __osProbeTLB(void*); 17 | extern int __osSpDeviceBusy(void); 18 | 19 | extern OSThread* __osRunningThread; 20 | extern OSThread* __osActiveQueue; 21 | extern OSThread* __osFaultedThread; 22 | extern OSThread* __osRunQueue; 23 | 24 | extern OSTimer* __osTimerList; 25 | extern OSTimer __osBaseTimer; 26 | extern OSTime __osCurrentTime; 27 | extern u32 __osBaseCounter; 28 | extern u32 __osViIntrCount; 29 | extern u32 __osTimerCounter; 30 | 31 | extern __OSEventState __osEventStateTab[OS_NUM_EVENTS]; 32 | 33 | // not sure if this should be here 34 | extern s32 osViClock; 35 | extern void __osTimerServicesInit(void); 36 | extern s32 __osAiDeviceBusy(void); 37 | extern int __osDpDeviceBusy(void); 38 | #endif 39 | -------------------------------------------------------------------------------- /src/os/printf.h: -------------------------------------------------------------------------------- 1 | #ifndef _PRINTF_H_ 2 | #define _PRINTF_H_ 3 | #include 4 | 5 | typedef struct { 6 | union { 7 | /* 00 */ s64 s64; 8 | u64 u64; 9 | f64 f64; 10 | u32 u32; 11 | u16 u16; 12 | } value; 13 | /* 08 */ char* buff; 14 | /* 0c */ s32 part1_len; 15 | /* 10 */ s32 num_leading_zeros; 16 | /* 14 */ s32 part2_len; 17 | /* 18 */ s32 num_mid_zeros; 18 | /* 1c */ s32 part3_len; 19 | /* 20 */ s32 num_trailing_zeros; 20 | /* 24 */ s32 precision; 21 | /* 28 */ s32 width; 22 | /* 2c */ u32 size; 23 | /* 30 */ u32 flags; 24 | /* 34 */ u8 length; 25 | } printf_struct; 26 | 27 | #define FLAGS_SPACE 1 28 | #define FLAGS_PLUS 2 29 | #define FLAGS_MINUS 4 30 | #define FLAGS_HASH 8 31 | #define FLAGS_ZERO 16 32 | s32 _Printf(char* (*prout)(char*, const char*, size_t), char* dst, const char* fmt, va_list args); 33 | void _Litob(printf_struct* args, u8 type); 34 | void func_800D8890(printf_struct* args, u8 type); 35 | void _Ldtob(printf_struct* args, u8 type); 36 | #endif 37 | -------------------------------------------------------------------------------- /src/os/sprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libultra_internal.h" 3 | #include "printf.h" 4 | #include 5 | 6 | char* proutSprintf(char* dst, const char* src, size_t count); 7 | 8 | int sprintf(char* dst, const char* fmt, ...) { 9 | s32 written; 10 | va_list args; 11 | va_start(args, fmt); 12 | written = _Printf(proutSprintf, dst, fmt, args); 13 | if (written >= 0) { 14 | dst[written] = 0; 15 | } 16 | return written; 17 | } 18 | 19 | char* proutSprintf(char* dst, const char* src, size_t count) { 20 | return (char*) memcpy((u8*) dst, (u8*) src, count) + count; 21 | } 22 | -------------------------------------------------------------------------------- /src/os/string.c: -------------------------------------------------------------------------------- 1 | #include "libultra_internal.h" 2 | #include 3 | 4 | void* memcpy(void* dst, const void* src, size_t size) { 5 | u8* _dst = dst; 6 | const u8* _src = src; 7 | while (size > 0) { 8 | *_dst++ = *_src++; 9 | size--; 10 | } 11 | return dst; 12 | } 13 | 14 | size_t strlen(const char* str) { 15 | const u8* ptr = (const u8*) str; 16 | while (*ptr) { 17 | ptr++; 18 | } 19 | return (const char*) ptr - str; 20 | } 21 | 22 | char* strchr(const char* str, s32 ch) { 23 | u8 c = ch; 24 | while (*(u8*) str != c) { 25 | if (*(u8*) str == 0) { 26 | return NULL; 27 | } 28 | str++; 29 | } 30 | return (char*) str; 31 | } 32 | -------------------------------------------------------------------------------- /src/profiler.h: -------------------------------------------------------------------------------- 1 | #ifndef PROFILER_H 2 | #define PROFILER_H 3 | 4 | extern u64 osClockRate; 5 | 6 | struct ProfilerFrameData { 7 | /* 0x00 */ s16 numSoundTimes; 8 | /* 0x02 */ s16 numVblankTimes; 9 | // gameTimes: 10 | // 0: thread 5 start 11 | // 1: level script execution 12 | // 2: render 13 | // 3: display lists 14 | // 4: thread 4 end (0 terminated) 15 | /* 0x08 */ OSTime gameTimes[5]; 16 | // gfxTimes: 17 | // 0: processors queued 18 | // 1: rsp completed 19 | // 2: rdp completed 20 | /* 0x30 */ OSTime gfxTimes[3]; 21 | /* 0x48 */ OSTime soundTimes[8]; 22 | /* 0x88 */ OSTime vblankTimes[8]; 23 | }; 24 | 25 | // thread event IDs 26 | enum ProfilerGameEvent { THREAD5_START, LEVEL_SCRIPT_EXECUTE, BEFORE_DISPLAY_LISTS, AFTER_DISPLAY_LISTS, THREAD5_END }; 27 | 28 | enum ProfilerGfxEvent { TASKS_QUEUED, RSP_COMPLETE, RDP_COMPLETE }; 29 | 30 | void profiler_log_thread5_time(enum ProfilerGameEvent eventID); 31 | void profiler_log_thread4_time(void); 32 | void profiler_log_gfx_time(enum ProfilerGfxEvent eventID); 33 | void profiler_log_vblank_time(void); 34 | void draw_profiler(void); 35 | void resource_display(void); 36 | 37 | extern s32 gEnableResourceMeters; 38 | 39 | #endif /* PROFILER_H */ 40 | -------------------------------------------------------------------------------- /src/racing/race_logic.h: -------------------------------------------------------------------------------- 1 | #ifndef RACE_LOGIC_H 2 | #define RACE_LOGIC_H 3 | 4 | /* Function Prototypes */ 5 | 6 | void func_802903D8(Player*, Player*); 7 | void func_8028DF00(void); 8 | void func_8028DF38(void); 9 | void func_8028E028(void); 10 | void update_player_battle_status(void); 11 | void func_8028E298(void); 12 | void func_8028E3A0(void); 13 | void func_8028E438(void); 14 | void func_8028E678(void); 15 | void func_8028EC38(s32); 16 | void func_8028EC98(s32); 17 | void start_race(void); 18 | f32 func_8028EE8C(s32); 19 | void func_8028EEF0(s32); 20 | void func_8028EF28(void); 21 | void func_8028F3E8(void); 22 | void update_race_position_data(void); 23 | void func_8028F474(void); 24 | void func_8028F4E8(void); 25 | void func_8028F588(void); 26 | void func_8028F8BC(void); 27 | void func_8028F914(void); 28 | void func_8028F970(void); 29 | void func_8028FBD4(void); 30 | void end_demo_update(void); 31 | void func_8028FCBC(void); 32 | void func_80290314(void); 33 | void func_80290338(void); 34 | void func_80290360(void); 35 | void func_80290388(void); 36 | void func_802903B0(void); 37 | void func_802909F0(void); 38 | void func_80290B14(void); 39 | 40 | extern f32 gLapCompletionPercentByPlayerId[]; 41 | extern s32 gGPCurrentRaceRankByPlayerId[]; // D_801643B8 (position for each player) 42 | extern u16 D_80162DD6; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/staff_ghosts.h: -------------------------------------------------------------------------------- 1 | #ifndef STAFF_GHOSTS_H 2 | #define STAFF_GHOSTS_H 3 | 4 | #include 5 | #include 6 | 7 | void func_80005B18(void); 8 | void func_80004EF0(void); 9 | void func_80004FB0(void); 10 | void func_80004FF8(void); 11 | void set_staff_ghost(void); 12 | s32 func_800051C4(void); 13 | void func_8000522C(void); 14 | void func_800052A4(void); 15 | void func_80005310(void); 16 | void func_8000546C(void); 17 | void func_8000561C(void); 18 | void func_800057DC(void); 19 | void func_8000599C(void); 20 | void func_80005AE8(Player*); 21 | void func_80005E6C(void); 22 | void staff_ghosts_loop(void); 23 | 24 | // mi0decode 25 | 26 | extern s32 mio0encode(s32 input, s32, s32); 27 | extern s32 func_80040174(void*, s32, s32); 28 | 29 | extern s32 D_80162DC8; 30 | extern s32 D_80162DCC; 31 | extern u16 D_80162DD4; 32 | extern u16 D_80162DD6; 33 | extern u16 D_80162DD8; 34 | extern s32 D_80162E00; 35 | extern s32 D_80162DE0; 36 | extern s32 D_80162DE4; 37 | extern s32 D_80162DE8; 38 | extern s32 D_80162DF0; 39 | extern s32 D_80162DF8; 40 | 41 | #endif /* STAFF_GHOSTS_H */ 42 | -------------------------------------------------------------------------------- /test_blend.bat: -------------------------------------------------------------------------------- 1 | "c:\Program Files\Blender Foundation\Blender 4.0\blender.exe" -b --python tools/blender_extension/blender_export.py -- courses/dks_jungle_parkway/course_data.inc.c d_course_dks_jungle_parkway_dl_E058 -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | /iplfontutil 2 | /mio0 3 | /n64cksum 4 | /n64graphics 5 | /displaylist_packer 6 | /tkmk00 7 | /extract_data_for_mio 8 | /torch/cmake-build-release/* 9 | __pycache__ 10 | *.pyc 11 | -------------------------------------------------------------------------------- /tools/apply_patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # apply_patch.sh - Applies an enhancement patch 4 | # 5 | 6 | if [ "$#" -ne 1 ] 7 | then 8 | echo "Usage: $0 patch_file" 9 | echo ' Applies a patch file to the current directory' 10 | exit 1 11 | fi 12 | 13 | read -p "Do you wish to apply the patch '$1'? [Y/N] " response 14 | case "$response" in 15 | Y|y) 16 | patch -p1 < "$1" 17 | ;; 18 | N|n) 19 | echo 'Quit' 20 | exit 1 21 | ;; 22 | *) 23 | echo "Invalid response '$response'." 24 | exit 1 25 | ;; 26 | esac 27 | 28 | -------------------------------------------------------------------------------- /tools/asm_processor/prelude.inc: -------------------------------------------------------------------------------- 1 | .set noat 2 | .set noreorder 3 | .set gp=64 4 | .macro glabel label 5 | .global \label 6 | \label: 7 | .endm 8 | 9 | 10 | # Float register aliases (o32 ABI, odd ones are rarely used) 11 | 12 | .set $fv0, $f0 13 | .set $fv0f, $f1 14 | .set $fv1, $f2 15 | .set $fv1f, $f3 16 | .set $ft0, $f4 17 | .set $ft0f, $f5 18 | .set $ft1, $f6 19 | .set $ft1f, $f7 20 | .set $ft2, $f8 21 | .set $ft2f, $f9 22 | .set $ft3, $f10 23 | .set $ft3f, $f11 24 | .set $fa0, $f12 25 | .set $fa0f, $f13 26 | .set $fa1, $f14 27 | .set $fa1f, $f15 28 | .set $ft4, $f16 29 | .set $ft4f, $f17 30 | .set $ft5, $f18 31 | .set $ft5f, $f19 32 | .set $fs0, $f20 33 | .set $fs0f, $f21 34 | .set $fs1, $f22 35 | .set $fs1f, $f23 36 | .set $fs2, $f24 37 | .set $fs2f, $f25 38 | .set $fs3, $f26 39 | .set $fs3f, $f27 40 | .set $fs4, $f28 41 | .set $fs4f, $f29 42 | .set $fs5, $f30 43 | .set $fs5f, $f31 44 | -------------------------------------------------------------------------------- /tools/blender/fast64_run.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | import bpy 4 | sys.path.append('tools/blender') 5 | import fast64 6 | from fast64.fast64_internal.mk64 import MK64_Properties 7 | from fast64.fast64_internal.mk64.f3d.properties import MK64CourseDLImportSettings 8 | fast64.register() 9 | dir_path = os.path.dirname(os.path.realpath(__file__)) 10 | dir_path = dir_path.replace("\\", "/") 11 | dir_path = os.path.dirname(dir_path) 12 | dir_path = os.path.dirname(dir_path) 13 | 14 | bpy.context.scene.gameEditorMode = "MK64" 15 | mk64_settings: MK64_Properties = bpy.context.scene.fast64.mk64 16 | import_settings: MK64CourseDLImportSettings = mk64_settings.course_DL_import_settings 17 | import_settings.name = "d_course_rainbow_road_dl_D8" 18 | import_settings.path = dir_path+"/courses/rainbow_road/course_data.c" 19 | import_settings.base_path = dir_path -------------------------------------------------------------------------------- /tools/create_patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # create_patch.sh - Creates an enhancement patch based on the current Git changes 4 | # 5 | 6 | if [ "$#" -ne 1 ] 7 | then 8 | echo "Usage: $0 patch_file" 9 | echo ' Creates a patch file based on the changes made to the current directory' 10 | exit 1 11 | fi 12 | 13 | # Make sure this is a git repository 14 | if [ ! -d .git ] 15 | then 16 | echo 'Error: The current directory is not a Git repository.' 17 | exit 1 18 | fi 19 | 20 | # 'git diff' is stupid and doesn't show new untracked files, so we must add them first. 21 | git add . 22 | # Generate the patch. 23 | git diff -p --staged > "$1" 24 | # Undo the 'git add'. 25 | git reset 26 | -------------------------------------------------------------------------------- /tools/ido-recomp/linux/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/acpp -------------------------------------------------------------------------------- /tools/ido-recomp/linux/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/as0 -------------------------------------------------------------------------------- /tools/ido-recomp/linux/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/as1 -------------------------------------------------------------------------------- /tools/ido-recomp/linux/c++filt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/c++filt -------------------------------------------------------------------------------- /tools/ido-recomp/linux/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/cc -------------------------------------------------------------------------------- /tools/ido-recomp/linux/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/cfe -------------------------------------------------------------------------------- /tools/ido-recomp/linux/copt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/copt -------------------------------------------------------------------------------- /tools/ido-recomp/linux/crt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/crt1.o -------------------------------------------------------------------------------- /tools/ido-recomp/linux/crtn.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/crtn.o -------------------------------------------------------------------------------- /tools/ido-recomp/linux/ld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/ld -------------------------------------------------------------------------------- /tools/ido-recomp/linux/libc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/libc.so -------------------------------------------------------------------------------- /tools/ido-recomp/linux/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/libc.so.1 -------------------------------------------------------------------------------- /tools/ido-recomp/linux/libexc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/libexc.so -------------------------------------------------------------------------------- /tools/ido-recomp/linux/libgen.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/libgen.so -------------------------------------------------------------------------------- /tools/ido-recomp/linux/libm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/libm.so -------------------------------------------------------------------------------- /tools/ido-recomp/linux/strip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/strip -------------------------------------------------------------------------------- /tools/ido-recomp/linux/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/ugen -------------------------------------------------------------------------------- /tools/ido-recomp/linux/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/ujoin -------------------------------------------------------------------------------- /tools/ido-recomp/linux/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/uld -------------------------------------------------------------------------------- /tools/ido-recomp/linux/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/umerge -------------------------------------------------------------------------------- /tools/ido-recomp/linux/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/uopt -------------------------------------------------------------------------------- /tools/ido-recomp/linux/upas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/upas -------------------------------------------------------------------------------- /tools/ido-recomp/linux/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/linux/usplit -------------------------------------------------------------------------------- /tools/ido-recomp/macos/acpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/acpp -------------------------------------------------------------------------------- /tools/ido-recomp/macos/as0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/as0 -------------------------------------------------------------------------------- /tools/ido-recomp/macos/as1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/as1 -------------------------------------------------------------------------------- /tools/ido-recomp/macos/c++filt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/c++filt -------------------------------------------------------------------------------- /tools/ido-recomp/macos/cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/cc -------------------------------------------------------------------------------- /tools/ido-recomp/macos/cfe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/cfe -------------------------------------------------------------------------------- /tools/ido-recomp/macos/copt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/copt -------------------------------------------------------------------------------- /tools/ido-recomp/macos/crt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/crt1.o -------------------------------------------------------------------------------- /tools/ido-recomp/macos/crtn.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/crtn.o -------------------------------------------------------------------------------- /tools/ido-recomp/macos/ld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/ld -------------------------------------------------------------------------------- /tools/ido-recomp/macos/libc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/libc.so -------------------------------------------------------------------------------- /tools/ido-recomp/macos/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/libc.so.1 -------------------------------------------------------------------------------- /tools/ido-recomp/macos/libexc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/libexc.so -------------------------------------------------------------------------------- /tools/ido-recomp/macos/libgen.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/libgen.so -------------------------------------------------------------------------------- /tools/ido-recomp/macos/libm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/libm.so -------------------------------------------------------------------------------- /tools/ido-recomp/macos/strip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/strip -------------------------------------------------------------------------------- /tools/ido-recomp/macos/ugen: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/ugen -------------------------------------------------------------------------------- /tools/ido-recomp/macos/ujoin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/ujoin -------------------------------------------------------------------------------- /tools/ido-recomp/macos/uld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/uld -------------------------------------------------------------------------------- /tools/ido-recomp/macos/umerge: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/umerge -------------------------------------------------------------------------------- /tools/ido-recomp/macos/uopt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/uopt -------------------------------------------------------------------------------- /tools/ido-recomp/macos/upas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/upas -------------------------------------------------------------------------------- /tools/ido-recomp/macos/usplit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/macos/usplit -------------------------------------------------------------------------------- /tools/ido-recomp/versions.txt: -------------------------------------------------------------------------------- 1 | v1.1 -------------------------------------------------------------------------------- /tools/ido-recomp/windows/acpp.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/acpp.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/as0.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/as0.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/as1.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/as1.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/c++filt.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/c++filt.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/cc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/cc.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/cfe.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/cfe.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/copt.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/copt.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/crt1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/crt1.o -------------------------------------------------------------------------------- /tools/ido-recomp/windows/crtn.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/crtn.o -------------------------------------------------------------------------------- /tools/ido-recomp/windows/ld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/ld.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/libc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/libc.so -------------------------------------------------------------------------------- /tools/ido-recomp/windows/libc.so.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/libc.so.1 -------------------------------------------------------------------------------- /tools/ido-recomp/windows/libexc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/libexc.so -------------------------------------------------------------------------------- /tools/ido-recomp/windows/libgen.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/libgen.so -------------------------------------------------------------------------------- /tools/ido-recomp/windows/libm.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/libm.so -------------------------------------------------------------------------------- /tools/ido-recomp/windows/msys-2.0.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/msys-2.0.dll -------------------------------------------------------------------------------- /tools/ido-recomp/windows/strip.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/strip.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/ugen.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/ugen.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/ujoin.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/ujoin.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/uld.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/uld.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/umerge.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/umerge.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/uopt.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/uopt.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/upas.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/upas.exe -------------------------------------------------------------------------------- /tools/ido-recomp/windows/usplit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n64decomp/mk64/c6e40bcec0af102598499c26c514dc3d90d7c340/tools/ido-recomp/windows/usplit.exe -------------------------------------------------------------------------------- /tools/libtkmk00.h: -------------------------------------------------------------------------------- 1 | #ifndef TKMK00_H_ 2 | #define TKMK00_H_ 3 | 4 | #include 5 | 6 | // decode TKMK00 data in memory 7 | // tkmk: buffer containing TKMK00 data 8 | // tmp_buf: tempory buffer to load pixel data (must be >= width*height bytes) 9 | // rgba: buffer to output decompressed RGBA16 data (must be >= 2*width*height bytes) 10 | // alpha_color: RGBA color to set apha to 0 11 | void tkmk00_decode(uint8_t *tkmk, uint8_t *tmp_buf, uint8_t *rgba16, int32_t alpha_color); 12 | 13 | #endif // TKMK00_H_ 14 | -------------------------------------------------------------------------------- /tools/n64cksum.h: -------------------------------------------------------------------------------- 1 | #ifndef N64CKSUM_H_ 2 | #define N64CKSUM_H_ 3 | 4 | #include 5 | 6 | // compute N64 ROM checksums 7 | // buf: buffer with extended SM64 data 8 | // cksum: two element array to write CRC1 and CRC2 to 9 | void n64cksum_calc_6102(uint8_t *buf, uint32_t cksum[]); 10 | 11 | // update N64 header checksums 12 | // buf: buffer containing ROM data 13 | // checksums are written into the buffer 14 | void n64cksum_update_checksums(uint8_t *buf); 15 | 16 | #endif // N64CKSUM_H_ 17 | -------------------------------------------------------------------------------- /tools/revert_patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # revert_patch.sh - Reverts an enhancement patch 4 | # 5 | 6 | if [ "$#" -ne 1 ] 7 | then 8 | echo "Usage: $0 patch_file" 9 | echo ' Reverts the changes made by an enhancement patch' 10 | exit 1 11 | fi 12 | 13 | read -p "Do you wish to revert the patch '$1'? [Y/N] " response 14 | case "$response" in 15 | Y|y) 16 | patch -p1 -R < "$1" 17 | ;; 18 | N|n) 19 | echo 'Quit' 20 | exit 1 21 | ;; 22 | *) 23 | echo "Invalid response '$response'." 24 | exit 1 25 | ;; 26 | esac 27 | 28 | 29 | -------------------------------------------------------------------------------- /tools/set_o32abi_bit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import argparse, struct, sys 3 | 4 | if __name__ == '__main__': 5 | parser = argparse.ArgumentParser() 6 | 7 | parser.add_argument('file', help='input file') 8 | args = parser.parse_args() 9 | 10 | with open(args.file, 'r+b') as f: 11 | magic = struct.unpack('>I', f.read(4))[0] 12 | if magic != 0x7F454C46: 13 | print('Error: Not an ELF file') 14 | sys.exit(1) 15 | 16 | f.seek(36) 17 | flags = struct.unpack('>I', f.read(4))[0] 18 | # if flags & 0xF0000000 != 0x20000000: # test for mips3 19 | # print('Error: Architecture not mips3') 20 | # sys.exit(1) 21 | 22 | flags |= 0x00001000 # set EF_MIPS_ABI_O32 23 | f.seek(36) 24 | f.write(struct.pack('>I', flags)) 25 | 26 | 27 | -------------------------------------------------------------------------------- /tools/windows_build.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | bp = subprocess.Popen("tools/mingw64/w64devkit.exe", stdin=subprocess.PIPE) 4 | bp.stdin.write(b"make assets && make -j && exit\n") 5 | bp.stdin.close() 6 | exit(bp.wait()) -------------------------------------------------------------------------------- /undefined_syms.txt: -------------------------------------------------------------------------------- 1 | /* libultra OS symbols */ 2 | 3 | /* boot and osException symbols */ 4 | /* most of these should be in hardware.h */ 5 | 6 | /* exceptions */ 7 | 8 | EXCEPTION_TLB_MISS = 0x80000000; 9 | 10 | /* SP */ 11 | 12 | SP_DMEM = 0xA4000000; 13 | SP_DMEM_UNK0 = 0xA40004C0; 14 | SP_DMEM_UNK1 = 0xA4000774; 15 | SP_IMEM = 0xA4001000; 16 | 17 | /* Unknown */ 18 | 19 | D_B0000008 = 0xB0000008; 20 | D_B0000010 = 0xB0000010; 21 | D_B0000014 = 0xB0000014; 22 | D_C0000000 = 0xC0000000; 23 | D_C0000008 = 0xC0000008; 24 | D_C000000C = 0xC000000C; 25 | 26 | D_000FFF00 = 0x000FFF00; 27 | 28 | D_03004000 = 0x03004000; 29 | D_03004800 = 0x03004800; 30 | D_03005000 = 0x03005000; 31 | D_03005800 = 0x03005800; 32 | D_03006000 = 0x03006000; 33 | D_03006800 = 0x03006800; 34 | D_03007000 = 0x03007000; 35 | D_03007800 = 0x03007800; 36 | D_03008000 = 0x03008000; 37 | D_03008800 = 0x03008800; 38 | 39 | D_05FF8DB8 = 0x05FF8DB8; 40 | 41 | D_0B002A00 = 0x0B002A00; 42 | 43 | D_A5000508 = 0xA5000508; 44 | D_A5000510 = 0xA5000510; 45 | D_E6FFFFFC = 0xE6FFFFFC; 46 | D_FA00000C = 0xFA00000C; 47 | D_FA000010 = 0xFA000010; 48 | D_FA000018 = 0xFA000018; 49 | -------------------------------------------------------------------------------- /util.mk: -------------------------------------------------------------------------------- 1 | # util.mk - Miscellaneous utility functions for use in Makefiles 2 | 3 | # Throws an error if the value of the variable named by $(1) is not in the list given by $(2) 4 | define validate-option 5 | # value must be part of the list 6 | ifeq ($$(filter $($(1)),$(2)),) 7 | $$(error Value of $(1) must be one of the following: $(2)) 8 | endif 9 | # value must be a single word (no whitespace) 10 | ifneq ($$(words $($(1))),1) 11 | $$(error Value of $(1) must be one of the following: $(2)) 12 | endif 13 | endef 14 | 15 | ifeq ($(OS),Windows_NT) 16 | NULL_OUT := nul 17 | else 18 | NULL_OUT = /dev/null 19 | endif 20 | # Returns the path to the command $(1) if exists. Otherwise returns an empty string. 21 | find-command = $(shell which $(1) 2> $(NULL_OUT)) 22 | 23 | # recursive wildcard 24 | rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) 25 | -------------------------------------------------------------------------------- /yamls/courses/big_donut_metadata.yml: -------------------------------------------------------------------------------- 1 | course: 2 | type: MK64:METADATA 3 | offset: 0x0 4 | id: 19 5 | name: big donut 6 | debug_name: doughnut 7 | cup: BATTLE_CUP 8 | cup_index: 0 9 | course_length: "" 10 | cpu_behaviour_ptr: D_0D008F18 11 | cpu_maximum_separation: -1.0f 12 | cpu_minimum_separation: 0.5f 13 | D_800DCBB4: D_800DCAF4 14 | cpu_steering_sensitivity: 40 15 | bomb_kart_spawns: # 7 bomb kart spawn locations 16 | - [0x0014, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 17 | - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 18 | - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 19 | - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 20 | - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 21 | - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 22 | - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 23 | path_sizes: [0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] 24 | 25 | # unk common_textures data 26 | cpu_CurveTargetSpeed: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] 27 | cpu_NormalTargetSpeed: [3.75f, 5.1666665f, 5.75f, 6.3333334f] 28 | D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] 29 | cpu_OffTrackTargetSpeed: [3.75f, 5.1666665f, 5.75f, 6.3333334f] 30 | 31 | # Course path 32 | path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] 33 | 34 | # Unused except in podium ceremony 35 | path_table_unknown: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] 36 | 37 | sky_colors: [0, 0, 0, 0, 0, 0] 38 | sky_colors2: [0, 0, 0, 0, 0, 0] 39 | -------------------------------------------------------------------------------- /yamls/courses/skyscraper_metadata.yml: -------------------------------------------------------------------------------- 1 | course: 2 | type: MK64:METADATA 3 | offset: 0x0 4 | id: 16 5 | name: skyscraper 6 | debug_name: skyscraper 7 | cup: BATTLE_CUP 8 | cup_index: 3 9 | course_length: "" 10 | cpu_behaviour_ptr: D_0D008F18 11 | cpu_maximum_separation: -1.0f 12 | cpu_minimum_separation: 0.5f 13 | D_800DCBB4: D_800DCAF4 14 | cpu_steering_sensitivity: 53 15 | bomb_kart_spawns: # 7 bomb kart spawn locations 16 | - [0x0014, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 17 | - [0x0028, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 18 | - [0x003c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 19 | - [0x0050, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 20 | - [0x0064, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 21 | - [0x0078, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 22 | - [0x008c, 0x0000, 1.0, 0.0, 0.0, 0.0, 0.0] 23 | path_sizes: [0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0000, 0x0000, 0x0000] 24 | 25 | # unk common_textures data 26 | cpu_CurveTargetSpeed: [4.1666665f, 5.5833334f, 6.1666665f, 6.75f] 27 | cpu_NormalTargetSpeed: [3.75f, 5.1666665f, 5.75f, 6.3333334f] 28 | D_0D0096B8: [3.3333332f, 3.9166667f, 4.5f, 5.0833334f] 29 | cpu_OffTrackTargetSpeed: [3.75f, 5.1666665f, 5.75f, 6.3333334f] 30 | 31 | # Course path 32 | path_table: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] 33 | 34 | # Unused except in podium ceremony 35 | path_table_unknown: ["&nullPath", "&nullPath", "&nullPath", "&nullPath"] 36 | 37 | sky_colors: [0, 0, 0, 0, 0, 0] 38 | sky_colors2: [0, 0, 0, 0, 0, 0] 39 | -------------------------------------------------------------------------------- /yamls/us/ceremony_rsp_init_80284EE0.yml: -------------------------------------------------------------------------------- 1 | :config: 2 | vram: 3 | addr: 0x80284EE0 4 | offset: 0x128520 5 | header: 6 | code: 7 | - '#include ' 8 | - '#include ' 9 | - '#include ' 10 | - '#include "courses/royal_raceway/course_displaylists.inc.h"' 11 | D_80284EE0: 12 | symbol: D_80284EE0 13 | type: gfx 14 | offset: 0x80284EE0 15 | D_80284F70: 16 | symbol: D_80284F70 17 | type: gfx 18 | offset: 0x80284F70 -------------------------------------------------------------------------------- /yamls/us/course_metadata.yml: -------------------------------------------------------------------------------- 1 | course_metadata: 2 | type: mk64:metadata 3 | input_directory: yamls/courses 4 | out_directory: "assets/course_metadata" 5 | --------------------------------------------------------------------------------