diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e38a8c57..6b8e3da32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: run: cp -R /orig/${{matrix.version}} orig - name: Build run: | - python configure.py --map --version ${{matrix.version}} --compilers /compilers + python configure.py --version ${{matrix.version}} --compilers /compilers ninja - name: Upload progress if: github.ref == 'refs/heads/main' @@ -31,8 +31,3 @@ jobs: run: | python tools/upload_progress.py -b https://progress.deco.mp/ -p tww -v ${{matrix.version}} \ build/${{matrix.version}}/progress.json - - name: Upload maps - uses: actions/upload-artifact@v3 - with: - name: ${{matrix.version}} maps - path: build/${{matrix.version}}/**/*.MAP diff --git a/README.md b/README.md index a6665664f..23a8fbad1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ The Legend of Zelda: The Wind Waker -[![Build Status]][actions] ![Progress] ![DOL Progress] ![RELs Progress] +[![Build Status]][actions] ![Progress] ![DOL Progress] ![RELs Progress] [![Discord Badge]][discord] ============= [Build Status]: https://github.com/zeldaret/tww/actions/workflows/build.yml/badge.svg @@ -7,12 +7,18 @@ The Legend of Zelda: The Wind Waker [Progress]: https://img.shields.io/endpoint?label=Code&url=https%3A%2F%2Fprogress.deco.mp%2Fdata%2Ftww%2FGZLE01%2Fall%2F%3Fmode%3Dshield%26measure%3Dcode [DOL Progress]: https://img.shields.io/endpoint?label=DOL&url=https%3A%2F%2Fprogress.deco.mp%2Fdata%2Ftww%2FGZLE01%2Fdol%2F%3Fmode%3Dshield%26measure%3Dcode [RELs Progress]: https://img.shields.io/endpoint?label=RELs&url=https%3A%2F%2Fprogress.deco.mp%2Fdata%2Ftww%2FGZLE01%2Fmodules%2F%3Fmode%3Dshield%26measure%3Dcode +[Discord Badge]: https://img.shields.io/discord/688807550715560050?color=%237289DA&logo=discord&logoColor=%23FFFFFF +[discord]: https://discord.zelda64.dev -This repository supports the following versions: +A work-in-progress decompilation of The Legend of Zelda: The Wind Waker for GameCube. -- GZLE01 - Rev 0 (USA), Rev 48 (KOR) -- GZLP01 - Rev 0 (PAL) -- GZLJ01 - Rev 0 (JPN) +This repository does **not** contain any game assets or assembly whatsoever. An existing copy of the game is required. + +All GameCube versions are supported: + +- `GZLE01`: Rev 0 (USA), Rev 48 (KOR) +- `GZLP01`: Rev 0 (PAL) +- `GZLJ01`: Rev 0 (JPN) Dependencies ============ diff --git a/config/GZLE01/splits.txt b/config/GZLE01/splits.txt index a6009416a..76202e490 100644 --- a/config/GZLE01/splits.txt +++ b/config/GZLE01/splits.txt @@ -141,10 +141,10 @@ m_Do/m_Do_machine_exception.cpp: .rodata start:0x803396F8 end:0x803398D8 .sbss start:0x803F69B0 end:0x803F69B8 -dolphin/os/__start.o: +dolphin/os/__start.c: .init start:0x80003100 end:0x800033A8 -c/c_damagereaction.o: +c/c_damagereaction.cpp: .text start:0x8001BEDC end:0x800227A0 .ctors start:0x803386A4 end:0x803386A8 .data start:0x80371DD0 end:0x80371FD8 @@ -153,7 +153,7 @@ c/c_damagereaction.o: .sbss start:0x803F69B8 end:0x803F69C0 .sdata2 start:0x803F7E58 end:0x803F7FB0 -c/c_dylink.o: +c/c_dylink.cpp: .text start:0x800227A0 end:0x80023004 .text start:0x80023004 end:0x8002306C .rodata start:0x803398D8 end:0x8033BB90 @@ -1704,7 +1704,7 @@ d/d_wpot_water.cpp: .sbss start:0x803F7300 end:0x803F7308 .sdata2 start:0x803FBB00 end:0x803FBB20 -Runtime.PPCEABI.H/__mem.o: +Runtime.PPCEABI.H/__mem.c: .init start:0x800033A8 end:0x800034E0 DynamicLink.cpp: diff --git a/config/GZLE01/symbols.txt b/config/GZLE01/symbols.txt index 003cce896..7eb6fa99a 100644 --- a/config/GZLE01/symbols.txt +++ b/config/GZLE01/symbols.txt @@ -8122,7 +8122,7 @@ __ct__20DynamicModuleControlFPCc = .text:0x802405BC; // type:function size:0x70 mountCallback__20DynamicModuleControlFPv = .text:0x8024062C; // type:function size:0x8C scope:global align:4 initialize__20DynamicModuleControlFv = .text:0x802406B8; // type:function size:0x38 scope:global align:4 callback__20DynamicModuleControlFPv = .text:0x802406F0; // type:function size:0x2C scope:global align:4 -calcSum2__FPCUsUl = .text:0x8024071C; // type:function size:0x28 scope:global align:4 +calcSum2__FPCUsUl = .text:0x8024071C; // type:function size:0x28 scope:local align:4 do_load__20DynamicModuleControlFv = .text:0x80240744; // type:function size:0x304 scope:global align:4 do_load_async__20DynamicModuleControlFv = .text:0x80240A48; // type:function size:0xC8 scope:global align:4 do_unload__20DynamicModuleControlFv = .text:0x80240B10; // type:function size:0x48 scope:global align:4 diff --git a/config/GZLJ01/splits.txt b/config/GZLJ01/splits.txt index 2ea6bb7aa..25011b85a 100644 --- a/config/GZLJ01/splits.txt +++ b/config/GZLJ01/splits.txt @@ -140,10 +140,10 @@ m_Do/m_Do_machine_exception.cpp: .rodata start:0x80337158 end:0x80337338 .sbss start:0x803E9E90 end:0x803E9E98 -dolphin/os/__start.o: +dolphin/os/__start.c: .init start:0x80003100 end:0x800033A8 -c/c_damagereaction.o: +c/c_damagereaction.cpp: .text start:0x8001BB70 end:0x80022430 .ctors start:0x803360A0 end:0x803360A4 .data start:0x80365270 end:0x80365478 @@ -152,7 +152,7 @@ c/c_damagereaction.o: .sbss start:0x803E9E98 end:0x803E9EA0 .sdata2 start:0x803EB300 end:0x803EB458 -c/c_dylink.o: +c/c_dylink.cpp: .text start:0x80022430 end:0x80022C94 .text start:0x80022C94 end:0x80022CFC .rodata start:0x80337338 end:0x803395F0 @@ -1704,7 +1704,7 @@ d/d_wpot_water.cpp: .sbss start:0x803EA7A0 end:0x803EA7A8 .sdata2 start:0x803EEFD8 end:0x803EEFF8 -Runtime.PPCEABI.H/__mem.o: +Runtime.PPCEABI.H/__mem.c: .init start:0x800033A8 end:0x800034E0 DynamicLink.cpp: diff --git a/config/GZLJ01/symbols.txt b/config/GZLJ01/symbols.txt index 4bb09d3f0..eda8f7aaf 100644 --- a/config/GZLJ01/symbols.txt +++ b/config/GZLJ01/symbols.txt @@ -8056,7 +8056,7 @@ __ct__20DynamicModuleControlFPCc = .text:0x8023DD4C; // type:function size:0x70 mountCallback__20DynamicModuleControlFPv = .text:0x8023DDBC; // type:function size:0x8C scope:global align:4 initialize__20DynamicModuleControlFv = .text:0x8023DE48; // type:function size:0x38 scope:global align:4 callback__20DynamicModuleControlFPv = .text:0x8023DE80; // type:function size:0x2C scope:global align:4 -calcSum2__FPCUsUl = .text:0x8023DEAC; // type:function size:0x28 scope:global align:4 +calcSum2__FPCUsUl = .text:0x8023DEAC; // type:function size:0x28 scope:local align:4 do_load__20DynamicModuleControlFv = .text:0x8023DED4; // type:function size:0x304 scope:global align:4 do_load_async__20DynamicModuleControlFv = .text:0x8023E1D8; // type:function size:0xC8 scope:global align:4 do_unload__20DynamicModuleControlFv = .text:0x8023E2A0; // type:function size:0x48 scope:global align:4 diff --git a/config/GZLP01/splits.txt b/config/GZLP01/splits.txt index a3245974d..409e61d08 100644 --- a/config/GZLP01/splits.txt +++ b/config/GZLP01/splits.txt @@ -141,10 +141,10 @@ m_Do/m_Do_machine_exception.cpp: .rodata start:0x8033EC90 end:0x8033EE70 .sbss start:0x803FE1B0 end:0x803FE1B8 -dolphin/os/__start.o: +dolphin/os/__start.c: .init start:0x80003100 end:0x800033A8 -c/c_damagereaction.o: +c/c_damagereaction.cpp: .text start:0x8001C22C end:0x80022AF0 .ctors start:0x8033DBE4 end:0x8033DBE8 .data start:0x80378AB0 end:0x80378CB8 @@ -153,7 +153,7 @@ c/c_damagereaction.o: .sbss start:0x803FE1B8 end:0x803FE1C0 .sdata2 start:0x803FF678 end:0x803FF7D0 -c/c_dylink.o: +c/c_dylink.cpp: .text start:0x80022AF0 end:0x80023354 .text start:0x80023354 end:0x800233BC .rodata start:0x8033EE70 end:0x80341128 @@ -1704,7 +1704,7 @@ d/d_wpot_water.cpp: .sbss start:0x803FEB20 end:0x803FEB28 .sdata2 start:0x80403350 end:0x80403370 -Runtime.PPCEABI.H/__mem.o: +Runtime.PPCEABI.H/__mem.c: .init start:0x800033A8 end:0x800034E0 DynamicLink.cpp: diff --git a/config/GZLP01/symbols.txt b/config/GZLP01/symbols.txt index 9d5a6d301..fa7c5da59 100644 --- a/config/GZLP01/symbols.txt +++ b/config/GZLP01/symbols.txt @@ -8105,7 +8105,7 @@ __ct__20DynamicModuleControlFPCc = .text:0x8024575C; // type:function size:0x70 mountCallback__20DynamicModuleControlFPv = .text:0x802457CC; // type:function size:0x8C scope:global align:4 initialize__20DynamicModuleControlFv = .text:0x80245858; // type:function size:0x38 scope:global align:4 callback__20DynamicModuleControlFPv = .text:0x80245890; // type:function size:0x2C scope:global align:4 -calcSum2__FPCUsUl = .text:0x802458BC; // type:function size:0x28 scope:global align:4 +calcSum2__FPCUsUl = .text:0x802458BC; // type:function size:0x28 scope:local align:4 do_load__20DynamicModuleControlFv = .text:0x802458E4; // type:function size:0x304 scope:global align:4 do_load_async__20DynamicModuleControlFv = .text:0x80245BE8; // type:function size:0xC8 scope:global align:4 do_unload__20DynamicModuleControlFv = .text:0x80245CB0; // type:function size:0x48 scope:global align:4 diff --git a/configure.py b/configure.py index 61342968e..8a5588790 100644 --- a/configure.py +++ b/configure.py @@ -42,7 +42,7 @@ parser.add_argument( "mode", default="configure", help="configure or progress (default: configure)", - nargs='?', + nargs="?", ) parser.add_argument( "--version", @@ -207,113 +207,67 @@ def ActorRel(status, rel_name): return Rel(status, rel_name, f"d/actor/{rel_name}.cpp") +# Helper function for JSystem libraries +def JSystemLib(lib_name, objects): + return { + "lib": lib_name, + "mw_version": "GC/1.3.2", + "cflags": cflags_framework, + "host": True, + "objects": objects, + } + + +# Helper function for Dolphin libraries +def DolphinLib(lib_name, objects): + return { + "lib": lib_name, + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, # TODO check + "host": False, + "objects": objects, + } + + Matching = True NonMatching = False +config.warn_missing_config = True +config.warn_missing_source = False # TODO config.libs = [ - { - "lib": "Runtime.PPCEABI.H", - "mw_version": "GC/1.3.2", - "cflags": cflags_runtime, - "host": False, - "objects": [ - Object(Matching, "Runtime.PPCEABI.H/__init_cpp_exceptions.cpp"), - Object(Matching, "Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp"), - Object(Matching, "Runtime.PPCEABI.H/global_destructor_chain.c"), - ], - }, - { - "lib": "REL", - "mw_version": "GC/1.3.2", - "cflags": cflags_rel, - "host": False, - "objects": [ - Object(Matching, "REL/executor.c"), - Object( - Matching, - "REL/global_destructor_chain.c", - source="Runtime.PPCEABI.H/global_destructor_chain.c", - ), - ], - }, - { - "lib": "JSystem", - "mw_version": "GC/1.3.2", - "cflags": cflags_framework, - "host": True, - "objects": [ - Object(NonMatching, "JSystem/JFramework/JFWDisplay.cpp"), - Object(NonMatching, "JSystem/JFramework/JFWSystem.cpp"), - Object(Matching, "JSystem/J3DGraphBase/J3DVertex.cpp"), - Object(NonMatching, "JSystem/J3DGraphBase/J3DPacket.cpp"), - Object(NonMatching, "JSystem/J3DGraphBase/J3DShape.cpp"), - Object(Matching, "JSystem/J3DGraphBase/J3DDrawBuffer.cpp"), - Object(Matching, "JSystem/J3DU/J3DUDL.cpp"), - Object(NonMatching, "JSystem/JParticle/JPATexture.cpp"), - Object(Matching, "JSystem/JKernel/JKRFile.cpp"), - Object(Matching, "JSystem/JSupport/JSUList.cpp"), - Object(NonMatching, "JSystem/JSupport/JSUInputStream.cpp"), - Object(Matching, "JSystem/JSupport/JSUMemoryStream.cpp"), - Object(Matching, "JSystem/JSupport/JSUFileStream.cpp"), - Object(Matching, "JSystem/JUtility/JUTResource.cpp"), - Object(Matching, "JSystem/JUtility/JUTTexture.cpp"), - Object(Matching, "JSystem/JUtility/JUTPalette.cpp"), - Object(Matching, "JSystem/JUtility/JUTNameTab.cpp"), - Object(Matching, "JSystem/JUtility/JUTGraphFifo.cpp"), - Object(Matching, "JSystem/JUtility/JUTFont.cpp"), - Object(NonMatching, "JSystem/J2DGraph/J2DGrafContext.cpp"), - Object(Matching, "JSystem/J2DGraph/J2DOrthoGraph.cpp"), - Object(NonMatching, "JSystem/J2DGraph/J2DPane.cpp"), - ], - }, - { - "lib": "SSystem", - "mw_version": "GC/1.3.2", - "cflags": cflags_framework, - "host": True, - "objects": [ - Object(Matching, "SSystem/SStandard/s_basic.cpp"), - Object(Matching, "SSystem/SComponent/c_malloc.cpp"), - Object(Matching, "SSystem/SComponent/c_API.cpp"), - Object(Matching, "SSystem/SComponent/c_API_graphic.cpp"), - Object(Matching, "SSystem/SComponent/c_counter.cpp"), - Object(Matching, "SSystem/SComponent/c_list.cpp"), - Object(Matching, "SSystem/SComponent/c_list_iter.cpp"), - Object(Matching, "SSystem/SComponent/c_node.cpp"), - Object(Matching, "SSystem/SComponent/c_node_iter.cpp"), - Object(Matching, "SSystem/SComponent/c_tree.cpp"), - Object(Matching, "SSystem/SComponent/c_tree_iter.cpp"), - Object(NonMatching, "SSystem/SComponent/c_phase.cpp"), - Object(Matching, "SSystem/SComponent/c_request.cpp"), - Object(Matching, "SSystem/SComponent/c_tag.cpp"), - Object(Matching, "SSystem/SComponent/c_tag_iter.cpp"), - Object(NonMatching, "SSystem/SComponent/c_xyz.cpp"), - Object(Matching, "SSystem/SComponent/c_sxyz.cpp"), - Object(Matching, "SSystem/SComponent/c_math.cpp"), - Object(NonMatching, "SSystem/SComponent/c_bg_s.cpp"), - Object(Matching, "SSystem/SComponent/c_bg_s_chk.cpp"), - Object(NonMatching, "SSystem/SComponent/c_bg_s_gnd_chk.cpp"), - Object(Matching, "SSystem/SComponent/c_bg_s_lin_chk.cpp"), - Object(NonMatching, "SSystem/SComponent/c_bg_w.cpp"), - Object(NonMatching, "SSystem/SComponent/c_m2d.cpp"), - Object(NonMatching, "SSystem/SComponent/c_m2d_g_box.cpp"), - Object(Matching, "SSystem/SComponent/c_m3d_g_aab.cpp"), - Object(Matching, "SSystem/SComponent/c_m3d_g_cyl.cpp"), - Object(Matching, "SSystem/SComponent/c_m3d_g_pla.cpp"), - Object(NonMatching, "SSystem/SComponent/c_m3d_g_sph.cpp"), - Object(Matching, "SSystem/SComponent/c_m3d_g_tri.cpp"), - Object(NonMatching, "SSystem/SComponent/c_lib.cpp"), - Object(NonMatching, "SSystem/SComponent/c_angle.cpp"), - Object(Matching, "SSystem/SComponent/c_data_tbl.cpp"), - ], - }, { "lib": "framework", "mw_version": "GC/1.3.2", "cflags": cflags_framework, "host": True, "objects": [ + # machine + Object(NonMatching, "m_Do/m_Do_main.cpp"), + Object(NonMatching, "m_Do/m_Do_printf.cpp"), + Object(NonMatching, "m_Do/m_Do_audio.cpp"), + Object(NonMatching, "m_Do/m_Do_controller_pad.cpp"), + Object(NonMatching, "m_Do/m_Do_graphic.cpp"), + Object(NonMatching, "m_Do/m_Do_machine.cpp"), + Object(NonMatching, "m_Do/m_Do_mtx.cpp"), + Object(NonMatching, "m_Do/m_Do_ext.cpp"), + Object(NonMatching, "m_Do/m_Do_lib.cpp"), + Object(Matching, "m_Do/m_Do_hostIO.cpp"), + Object(NonMatching, "m_Do/m_Do_Reset.cpp"), + Object(NonMatching, "m_Do/m_Do_dvd_thread.cpp"), + Object(NonMatching, "m_Do/m_Do_DVDError.cpp"), + Object(NonMatching, "m_Do/m_Do_MemCard.cpp"), + Object(NonMatching, "m_Do/m_Do_MemCardRWmng.cpp"), + Object(NonMatching, "m_Do/m_Do_gba_com.cpp"), + Object(NonMatching, "m_Do/m_Do_machine_exception.cpp"), + + # c + Object(NonMatching, "c/c_damagereaction.cpp"), + Object(NonMatching, "c/c_dylink.cpp"), + + # f_ap Object(NonMatching, "f_ap/f_ap_game.cpp"), + + # f_op Object(NonMatching, "f_op/f_op_actor.cpp"), Object(Matching, "f_op/f_op_actor_iter.cpp"), Object(Matching, "f_op/f_op_actor_tag.cpp"), @@ -336,6 +290,8 @@ config.libs = [ Object(Matching, "f_op/f_op_draw_iter.cpp"), Object(Matching, "f_op/f_op_draw_tag.cpp"), Object(Matching, "f_op/f_op_scene_pause.cpp"), + + # f_pc Object(Matching, "f_pc/f_pc_base.cpp"), Object(Matching, "f_pc/f_pc_create_iter.cpp"), Object(Matching, "f_pc/f_pc_create_req.cpp"), @@ -367,31 +323,878 @@ config.libs = [ Object(Matching, "f_pc/f_pc_fstcreate_req.cpp"), Object(Matching, "f_pc/f_pc_stdcreate_req.cpp"), - # machine - Object(NonMatching, "m_Do/m_Do_main.cpp"), - Object(NonMatching, "m_Do/m_Do_audio.cpp"), - Object(NonMatching, "m_Do/m_Do_controller_pad.cpp"), - Object(Matching, "m_Do/m_Do_hostIO.cpp"), - Object(NonMatching, "m_Do/m_Do_mtx.cpp"), - # dolzel - Object(Matching, "d/d_com_lib_game.cpp"), - Object(Matching, "d/d_particle_name.cpp"), - Object(NonMatching, "d/d_s_title.cpp"), + Object(NonMatching, "d/d_stage.cpp"), + Object(NonMatching, "d/d_map.cpp"), Object(NonMatching, "d/d_com_inf_game.cpp"), + Object(Matching, "d/d_com_lib_game.cpp"), + Object(NonMatching, "d/d_com_static.cpp"), + Object(NonMatching, "d/d_lib.cpp"), Object(NonMatching, "d/d_save.cpp"), Object(NonMatching, "d/d_save_init.cpp"), - Object(Matching, "d/d_bg_s_movebg_actor.cpp"), - Object(NonMatching, "d/d_s_play.cpp"), - - Object(NonMatching, "d/actor/d_a_player_main.cpp"), + Object(NonMatching, "d/d_shop.cpp"), + Object(NonMatching, "d/d_jnt_hit.cpp"), + Object(NonMatching, "d/d_chain.cpp"), + Object(NonMatching, "d/d_cloth_packet.cpp"), + Object(NonMatching, "d/actor/d_a_obj.cpp"), + Object(NonMatching, "d/actor/d_a_obj_tribox_static.cpp"), + Object(NonMatching, "d/actor/d_a_ship_static.cpp"), + Object(NonMatching, "d/actor/d_a_boko_static.cpp"), + Object(NonMatching, "d/actor/d_a_bomb_static.cpp"), + Object(NonMatching, "d/actor/d_a_branch_static.cpp"), + Object(NonMatching, "d/actor/d_a_mgameboard_static.cpp"), Object(NonMatching, "d/actor/d_a_itembase_static.cpp"), Object(NonMatching, "d/actor/d_a_item_static.cpp"), + Object(NonMatching, "d/actor/d_a_shop_item_static.cpp"), + Object(NonMatching, "d/actor/d_a_race_item_static.cpp"), + Object(NonMatching, "d/actor/d_a_leaflift_static.cpp"), + Object(NonMatching, "d/d_demo.cpp"), + Object(NonMatching, "d/d_door.cpp"), + Object(NonMatching, "d/d_resorce.cpp"), + Object(NonMatching, "d/d_material.cpp"), + Object(NonMatching, "d/d_event.cpp"), + Object(NonMatching, "d/d_event_data.cpp"), + Object(NonMatching, "d/d_event_manager.cpp"), + Object(NonMatching, "d/d_magma.cpp"), + Object(NonMatching, "d/d_boss_magma.cpp"), + Object(NonMatching, "d/d_grass.cpp"), + Object(NonMatching, "d/d_tree.cpp"), + Object(NonMatching, "d/d_particle.cpp"), + Object(Matching, "d/d_particle_name.cpp"), + Object(NonMatching, "d/d_path.cpp"), + Object(NonMatching, "d/d_drawlist.cpp"), + Object(NonMatching, "d/d_kankyo_data.cpp"), + Object(NonMatching, "d/d_kankyo_wether.cpp"), + Object(NonMatching, "d/d_kankyo_rain.cpp"), + Object(NonMatching, "d/d_kankyo_demo.cpp"), + Object(NonMatching, "d/d_detect.cpp"), + Object(NonMatching, "d/d_vibration.cpp"), + Object(NonMatching, "d/d_vib_pattern.cpp"), + Object(NonMatching, "d/d_attention.cpp"), + Object(NonMatching, "d/d_att_dist.cpp"), + Object(NonMatching, "d/d_bg_s.cpp"), + Object(NonMatching, "d/d_bg_s_acch.cpp"), + Object(NonMatching, "d/d_bg_s_func.cpp"), + Object(NonMatching, "d/d_bg_s_lin_chk.cpp"), + Object(Matching, "d/d_bg_s_movebg_actor.cpp"), + Object(NonMatching, "d/d_bg_s_spl_grp_chk.cpp"), + Object(NonMatching, "d/d_bg_s_wtr_chk.cpp"), + Object(NonMatching, "d/d_bg_w.cpp"), + Object(NonMatching, "d/d_bg_w_deform.cpp"), + Object(NonMatching, "d/d_bg_w_hf.cpp"), + Object(NonMatching, "d/d_bg_w_sv.cpp"), + Object(NonMatching, "d/d_cc_d.cpp"), + Object(NonMatching, "d/d_cc_mass_s.cpp"), + Object(NonMatching, "d/d_cc_s.cpp"), + Object(NonMatching, "d/d_cc_uty.cpp"), + Object(NonMatching, "d/d_cam_param.cpp"), + Object(NonMatching, "d/d_cam_type.cpp"), + Object(NonMatching, "d/d_cam_style.cpp"), + Object(NonMatching, "d/d_cam_type2.cpp"), + Object(NonMatching, "d/d_ev_camera.cpp"), + Object(NonMatching, "d/d_wood.cpp"), + Object(NonMatching, "d/d_flower.cpp"), + Object(NonMatching, "d/d_item_data.cpp"), + Object(NonMatching, "d/d_seafightgame.cpp"), + Object(NonMatching, "d/d_spline_path.cpp"), + Object(NonMatching, "d/d_s_actor_data_mng.cpp"), + Object(NonMatching, "d/d_item.cpp"), + Object(NonMatching, "d/d_2dnumber.cpp"), + Object(NonMatching, "d/actor/d_a_npc_cb1_static.cpp"), + Object(NonMatching, "d/actor/d_a_npc_mk_static.cpp"), + Object(NonMatching, "d/d_salvage.cpp"), + Object(NonMatching, "d/d_snap.cpp"), + Object(NonMatching, "d/d_point_wind.cpp"), + Object(NonMatching, "d/actor/d_a_agb.cpp"), + Object(NonMatching, "d/actor/d_a_arrow.cpp"), + Object(NonMatching, "d/actor/d_a_bg.cpp"), + Object(NonMatching, "d/actor/d_a_bomb.cpp"), + Object(NonMatching, "d/actor/d_a_bomb2.cpp"), + Object(NonMatching, "d/actor/d_a_boomerang.cpp"), + Object(NonMatching, "d/actor/d_a_dai_item.cpp"), + Object(NonMatching, "d/actor/d_a_demo00.cpp"), + Object(NonMatching, "d/actor/d_a_disappear.cpp"), + Object(NonMatching, "d/actor/d_a_esa.cpp"), + Object(NonMatching, "d/actor/d_a_grid.cpp"), + Object(NonMatching, "d/actor/d_a_himo2.cpp"), + Object(NonMatching, "d/actor/d_a_hookshot.cpp"), + Object(NonMatching, "d/actor/d_a_ib.cpp"), Object(NonMatching, "d/actor/d_a_item.cpp"), Object(NonMatching, "d/actor/d_a_itembase.cpp"), + Object(NonMatching, "d/actor/d_a_nh.cpp"), + Object(NonMatching, "d/actor/d_a_npc_fa1.cpp"), + Object(NonMatching, "d/actor/d_a_obj_search.cpp"), + Object(NonMatching, "d/actor/d_a_player.cpp"), + Object(NonMatching, "d/actor/d_a_player_main.cpp"), + Object(NonMatching, "d/actor/d_a_player_npc.cpp"), + Object(NonMatching, "d/actor/d_a_sea.cpp"), + Object(NonMatching, "d/actor/d_a_spc_item01.cpp"), + Object(NonMatching, "d/actor/d_a_vrbox.cpp"), + Object(NonMatching, "d/actor/d_a_vrbox2.cpp"), + Object(NonMatching, "d/d_auction_screen.cpp"), + Object(NonMatching, "d/d_place_name.cpp"), + Object(NonMatching, "d/d_camera.cpp"), + Object(NonMatching, "d/d_envse.cpp"), + Object(NonMatching, "d/d_file_error.cpp"), + Object(NonMatching, "d/d_file_select.cpp"), + Object(NonMatching, "d/d_gameover.cpp"), + Object(NonMatching, "d/d_kankyo.cpp"), + Object(NonMatching, "d/d_kyeff.cpp"), + Object(NonMatching, "d/d_kyeff2.cpp"), + Object(NonMatching, "d/d_ky_thunder.cpp"), + Object(NonMatching, "d/d_letter.cpp"), + Object(NonMatching, "d/d_level_se.cpp"), + Object(NonMatching, "d/d_menu_cloth.cpp"), + Object(NonMatching, "d/d_menu_collect.cpp"), + Object(NonMatching, "d/d_menu_dmap.cpp"), + Object(NonMatching, "d/d_menu_fmap.cpp"), + Object(NonMatching, "d/d_menu_fmap2.cpp"), + Object(NonMatching, "d/d_menu_item.cpp"), + Object(NonMatching, "d/d_menu_option.cpp"), + Object(NonMatching, "d/d_menu_save.cpp"), + Object(NonMatching, "d/d_menu_window.cpp"), + Object(NonMatching, "d/d_mesg.cpp"), + Object(NonMatching, "d/d_message.cpp"), + Object(NonMatching, "d/d_message_paper.cpp"), + Object(NonMatching, "d/d_meter.cpp"), + Object(NonMatching, "d/d_minigame_starter.cpp"), + Object(NonMatching, "d/d_minigame_terminater.cpp"), + Object(NonMatching, "d/d_msg.cpp"), + Object(NonMatching, "d/d_name.cpp"), + Object(NonMatching, "d/d_npc.cpp"), + Object(NonMatching, "d/d_operate_wind.cpp"), + Object(NonMatching, "d/d_metronome.cpp"), + Object(NonMatching, "d/d_ovlp_fade.cpp"), + Object(NonMatching, "d/d_ovlp_fade2.cpp"), + Object(NonMatching, "d/d_ovlp_fade3.cpp"), + Object(NonMatching, "d/d_ovlp_fade4.cpp"), + Object(NonMatching, "d/d_picture_box.cpp"), + Object(NonMatching, "d/d_s_logo.cpp"), + Object(NonMatching, "d/d_s_menu.cpp"), + Object(NonMatching, "d/d_s_name.cpp"), + Object(NonMatching, "d/d_s_open.cpp"), + Object(NonMatching, "d/d_s_open_sub.cpp"), + Object(NonMatching, "d/d_s_play.cpp"), + Object(NonMatching, "d/d_s_room.cpp"), + Object(NonMatching, "d/d_s_title.cpp"), + Object(NonMatching, "d/d_scope.cpp"), + Object(NonMatching, "d/d_throwstone.cpp"), + Object(NonMatching, "d/d_timer.cpp"), + Object(NonMatching, "d/d_water_mark.cpp"), + Object(NonMatching, "d/d_wind_arrow.cpp"), + Object(NonMatching, "d/d_wpillar.cpp"), + Object(NonMatching, "d/d_wpot_water.cpp"), - # ? - Object(NonMatching, "DynamicLink.cpp"), + Object(Matching, "DynamicLink.cpp"), + ], + }, + { + "lib": "SSystem", + "mw_version": "GC/1.3.2", + "cflags": cflags_framework, + "host": True, + "objects": [ + Object(Matching, "SSystem/SComponent/c_malloc.cpp"), + Object(Matching, "SSystem/SComponent/c_API.cpp"), + Object(Matching, "SSystem/SComponent/c_API_graphic.cpp"), + Object(NonMatching, "SSystem/SComponent/c_cc_d.cpp"), + Object(NonMatching, "SSystem/SComponent/c_cc_s.cpp"), + Object(Matching, "SSystem/SComponent/c_counter.cpp"), + Object(Matching, "SSystem/SComponent/c_list.cpp"), + Object(Matching, "SSystem/SComponent/c_list_iter.cpp"), + Object(Matching, "SSystem/SComponent/c_node.cpp"), + Object(Matching, "SSystem/SComponent/c_node_iter.cpp"), + Object(Matching, "SSystem/SComponent/c_tree.cpp"), + Object(Matching, "SSystem/SComponent/c_tree_iter.cpp"), + Object(NonMatching, "SSystem/SComponent/c_phase.cpp"), + Object(Matching, "SSystem/SComponent/c_request.cpp"), + Object(Matching, "SSystem/SComponent/c_tag.cpp"), + Object(Matching, "SSystem/SComponent/c_tag_iter.cpp"), + Object(NonMatching, "SSystem/SComponent/c_xyz.cpp"), + Object(Matching, "SSystem/SComponent/c_sxyz.cpp"), + Object(Matching, "SSystem/SComponent/c_math.cpp"), + Object(NonMatching, "SSystem/SComponent/c_bg_s.cpp"), + Object(Matching, "SSystem/SComponent/c_bg_s_chk.cpp"), + Object(NonMatching, "SSystem/SComponent/c_bg_s_gnd_chk.cpp"), + Object(Matching, "SSystem/SComponent/c_bg_s_lin_chk.cpp"), + Object(NonMatching, "SSystem/SComponent/c_bg_w.cpp"), + Object(NonMatching, "SSystem/SComponent/c_m2d.cpp"), + Object(NonMatching, "SSystem/SComponent/c_m2d_g_box.cpp"), + Object(NonMatching, "SSystem/SComponent/c_m3d.cpp"), + Object(Matching, "SSystem/SComponent/c_m3d_g_aab.cpp"), + Object(Matching, "SSystem/SComponent/c_m3d_g_cyl.cpp"), + Object(Matching, "SSystem/SComponent/c_m3d_g_pla.cpp"), + Object(NonMatching, "SSystem/SComponent/c_m3d_g_sph.cpp"), + Object(Matching, "SSystem/SComponent/c_m3d_g_tri.cpp"), + Object(NonMatching, "SSystem/SComponent/c_lib.cpp"), + Object(NonMatching, "SSystem/SComponent/c_angle.cpp"), + Object(Matching, "SSystem/SComponent/c_data_tbl.cpp"), + Object(Matching, "SSystem/SStandard/s_basic.cpp"), + ], + }, + JSystemLib( + "JFramework", + [ + Object(NonMatching, "JSystem/JFramework/JFWDisplay.cpp"), + Object(NonMatching, "JSystem/JFramework/JFWSystem.cpp"), + ], + ), + JSystemLib( + "J3DU", + [ + Object(NonMatching, "JSystem/J3DU/J3DUClipper.cpp"), + Object(NonMatching, "JSystem/J3DU/J3DUMotion.cpp"), + Object(Matching, "JSystem/J3DU/J3DUDL.cpp"), + ], + ), + JSystemLib( + "JParticle", + [ + Object(NonMatching, "JSystem/JParticle/JPABaseShape.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAExtraShape.cpp"), + Object(NonMatching, "JSystem/JParticle/JPASweepShape.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAExTexShape.cpp"), + Object(NonMatching, "JSystem/JParticle/JPADynamicsBlock.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAFieldBlock.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAKeyBlock.cpp"), + Object(NonMatching, "JSystem/JParticle/JPATexture.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAResourceManager.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAEmitterLoader.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAMath.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAField.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAEmitter.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAParticle.cpp"), + Object(NonMatching, "JSystem/JParticle/JPAEmitterManager.cpp"), + Object(NonMatching, "JSystem/JParticle/JPADrawVisitor.cpp"), + Object(NonMatching, "JSystem/JParticle/JPADraw.cpp"), + Object(NonMatching, "JSystem/JParticle/JPADrawSetupTev.cpp"), + ], + ), + JSystemLib( + "JStage", + [ + Object(NonMatching, "JSystem/JStage/JSGActor.cpp"), + Object(NonMatching, "JSystem/JStage/JSGAmbientLight.cpp"), + Object(NonMatching, "JSystem/JStage/JSGCamera.cpp"), + Object(NonMatching, "JSystem/JStage/JSGFog.cpp"), + Object(NonMatching, "JSystem/JStage/JSGLight.cpp"), + Object(NonMatching, "JSystem/JStage/JSGObject.cpp"), + Object(NonMatching, "JSystem/JStage/JSGSystem.cpp"), + ], + ), + JSystemLib( + "JStudio", + [ + Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-control.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-data.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-math.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/jstudio-object.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/functionvalue.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/fvb.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/fvb-data-parse.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/object-id.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/stb.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/stb-data.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio/stb-data-parse.cpp"), + ], + ), + JSystemLib( + "JStudio_JStage", + [ + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/control.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-actor.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-ambientlight.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-camera.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-fog.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JStage/object-light.cpp"), + ], + ), + JSystemLib( + "JStudio_JAudio", + [ + Object(NonMatching, "JSystem/JStudio/JStudio_JAudio/control.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JAudio/object-sound.cpp"), + ], + ), + JSystemLib( + "JStudio_JParticle", + [ + Object(NonMatching, "JSystem/JStudio/JStudio_JParticle/control.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JParticle/object-particle.cpp"), + ], + ), + JSystemLib( + "JStudio_JMessage", + [ + Object(NonMatching, "JSystem/JStudio/JStudio_JMessage/control.cpp"), + Object(NonMatching, "JSystem/JStudio/JStudio_JMessage/object-message.cpp"), + ], + ), + JSystemLib( + "JStudioToolLibrary", + [ + Object(NonMatching, "JSystem/JStudio/JStudioToolLibrary/console.cpp"), + ], + ), + JSystemLib( + "JAudio", + [ + Object(NonMatching, "JSystem/JAudio/JASCalc.cpp"), + Object(NonMatching, "JSystem/JAudio/JASAiCtrl.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDvdThread.cpp"), + Object(NonMatching, "JSystem/JAudio/JASCallback.cpp"), + Object(NonMatching, "JSystem/JAudio/JASRate.cpp"), + Object(NonMatching, "JSystem/JAudio/JASHardStream.cpp"), + Object(NonMatching, "JSystem/JAudio/JASHeapCtrl.cpp"), + Object(NonMatching, "JSystem/JAudio/JASResArcLoader.cpp"), + Object(NonMatching, "JSystem/JAudio/JASProbe.cpp"), + Object(NonMatching, "JSystem/JAudio/JASKernelDebug.cpp"), + Object(NonMatching, "JSystem/JAudio/JASCmdStack.cpp"), + Object(NonMatching, "JSystem/JAudio/JASSystemHeap.cpp"), + Object(NonMatching, "JSystem/JAudio/JASNoteMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JASOuterParam.cpp"), + Object(NonMatching, "JSystem/JAudio/JASPlayer_impl.cpp"), + Object(NonMatching, "JSystem/JAudio/JASRegisterParam.cpp"), + Object(NonMatching, "JSystem/JAudio/JASSeqCtrl.cpp"), + Object(NonMatching, "JSystem/JAudio/JASSeqParser.cpp"), + Object(NonMatching, "JSystem/JAudio/JASTrack.cpp"), + Object(NonMatching, "JSystem/JAudio/JASTrackInterrupt.cpp"), + Object(NonMatching, "JSystem/JAudio/JASTrackPort.cpp"), + Object(NonMatching, "JSystem/JAudio/JASBank.cpp"), + Object(NonMatching, "JSystem/JAudio/JASWaveBank.cpp"), + Object(NonMatching, "JSystem/JAudio/JASBasicBank.cpp"), + Object(NonMatching, "JSystem/JAudio/JASBasicInst.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDrumSet.cpp"), + Object(NonMatching, "JSystem/JAudio/JASBasicWaveBank.cpp"), + Object(NonMatching, "JSystem/JAudio/JASSimpleWaveBank.cpp"), + Object(NonMatching, "JSystem/JAudio/JASInstEffect.cpp"), + Object(NonMatching, "JSystem/JAudio/JASInstSense.cpp"), + Object(NonMatching, "JSystem/JAudio/JASInstRand.cpp"), + Object(NonMatching, "JSystem/JAudio/JASWSParser.cpp"), + Object(NonMatching, "JSystem/JAudio/JASBNKParser.cpp"), + Object(NonMatching, "JSystem/JAudio/JASWaveArcLoader.cpp"), + Object(NonMatching, "JSystem/JAudio/JASWaveBankMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JASBankMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JASAudioThread.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDSPBuf.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDSPChannel.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDSPInterface.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDriverIF.cpp"), + Object(NonMatching, "JSystem/JAudio/JASChGlobal.cpp"), + Object(NonMatching, "JSystem/JAudio/JASChAllocQueue.cpp"), + Object(NonMatching, "JSystem/JAudio/JASChannel.cpp"), + Object(NonMatching, "JSystem/JAudio/JASChannelMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JASOscillator.cpp"), + Object(NonMatching, "JSystem/JAudio/JASDriverTables.cpp"), + Object(NonMatching, "JSystem/JAudio/dspproc.c"), + Object(NonMatching, "JSystem/JAudio/dsptask.c"), + Object(NonMatching, "JSystem/JAudio/osdsp.c"), + Object(NonMatching, "JSystem/JAudio/osdsp_task.c"), + Object(NonMatching, "JSystem/JAudio/JAIAnimation.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIBasic.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIBankWave.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIConst.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIDummyObject.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIFx.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIGlobalParameter.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIInitData.cpp"), + Object(NonMatching, "JSystem/JAudio/JAISeMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JAISequenceHeap.cpp"), + Object(NonMatching, "JSystem/JAudio/JAISequenceMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JAISound.cpp"), + Object(NonMatching, "JSystem/JAudio/JAISoundTable.cpp"), + Object(NonMatching, "JSystem/JAudio/JAIStreamMgr.cpp"), + Object(NonMatching, "JSystem/JAudio/JAISystemInterface.cpp"), + ], + ), + JSystemLib( + "JMessage", + [ + Object(NonMatching, "JSystem/JMessage/data.cpp"), + Object(NonMatching, "JSystem/JMessage/control.cpp"), + Object(NonMatching, "JSystem/JMessage/processor.cpp"), + Object(NonMatching, "JSystem/JMessage/resource.cpp"), + ], + ), + DolphinLib( + "gba", + [ + Object(NonMatching, "dolphin/gba/GBA.c"), + Object(NonMatching, "dolphin/gba/GBAGetProcessStatus.c"), + Object(NonMatching, "dolphin/gba/GBAJoyBoot.c"), + Object(NonMatching, "dolphin/gba/GBARead.c"), + Object(NonMatching, "dolphin/gba/GBAWrite.c"), + Object(NonMatching, "dolphin/gba/GBAXfer.c"), + ], + ), + JSystemLib( + "JAZelAudio", + [ + Object(NonMatching, "JSystem/JAZelAudio/JAIZelBasic.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelAnime.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelAtmos.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelInst.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelParam.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelCharVoiceTable.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelScene.cpp"), + Object(NonMatching, "JSystem/JAZelAudio/JAIZelSound.cpp"), + ], + ), + DolphinLib( + "gf", + [ + Object(NonMatching, "dolphin/gf/GFGeometry.cpp"), + Object(NonMatching, "dolphin/gf/GFLight.cpp"), + Object(NonMatching, "dolphin/gf/GFPixel.cpp"), + Object(NonMatching, "dolphin/gf/GFTev.cpp"), + Object(NonMatching, "dolphin/gf/GFTransform.cpp"), + ], + ), + JSystemLib( + "JKernel", + [ + Object(Matching, "JSystem/JKernel/JKRHeap.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRStdHeap.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRExpHeap.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRSolidHeap.cpp"), + Object(Matching, "JSystem/JKernel/JKRDisposer.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRThread.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRAram.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRAramHeap.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRAramBlock.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRAramPiece.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRAramStream.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRFileLoader.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRFileFinder.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRFileCache.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRArchivePub.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRArchivePri.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRMemArchive.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRAramArchive.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRDvdArchive.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRCompArchive.cpp"), + Object(Matching, "JSystem/JKernel/JKRFile.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRDvdFile.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRDvdRipper.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRDvdAramRipper.cpp"), + Object(NonMatching, "JSystem/JKernel/JKRDecomp.cpp"), + ], + ), + JSystemLib( + "JSupport", + [ + Object(Matching, "JSystem/JSupport/JSUList.cpp"), + Object(NonMatching, "JSystem/JSupport/JSUInputStream.cpp"), + Object(Matching, "JSystem/JSupport/JSUMemoryStream.cpp"), + Object(Matching, "JSystem/JSupport/JSUFileStream.cpp"), + ], + ), + JSystemLib( + "JGadget", + [ + Object(NonMatching, "JSystem/JGadget/binary.cpp"), + Object(NonMatching, "JSystem/JGadget/linklist.cpp"), + Object(NonMatching, "JSystem/JGadget/std-vector.cpp"), + ], + ), + JSystemLib( + "JUtility", + [ + Object(NonMatching, "JSystem/JUtility/JUTCacheFont.cpp"), + Object(Matching, "JSystem/JUtility/JUTResource.cpp"), + Object(Matching, "JSystem/JUtility/JUTTexture.cpp"), + Object(Matching, "JSystem/JUtility/JUTPalette.cpp"), + Object(Matching, "JSystem/JUtility/JUTNameTab.cpp"), + Object(Matching, "JSystem/JUtility/JUTGraphFifo.cpp"), + Object(Matching, "JSystem/JUtility/JUTFont.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTResFont.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTDbPrint.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTGamePad.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTException.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTDirectPrint.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTAssert.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTVideo.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTXfb.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTFader.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTProcBar.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTConsole.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTDirectFile.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTGba.cpp"), + Object(NonMatching, "JSystem/JUtility/JUTFontData_Ascfont_fix12.s"), + ], + ), + JSystemLib( + "J2DGraph", + [ + Object(NonMatching, "JSystem/J2DGraph/J2DGrafContext.cpp"), + Object(Matching, "JSystem/J2DGraph/J2DOrthoGraph.cpp"), + Object(NonMatching, "JSystem/J2DGraph/J2DPrint.cpp"), + Object(NonMatching, "JSystem/J2DGraph/J2DPane.cpp"), + Object(NonMatching, "JSystem/J2DGraph/J2DScreen.cpp"), + Object(NonMatching, "JSystem/J2DGraph/J2DWindow.cpp"), + Object(NonMatching, "JSystem/J2DGraph/J2DPicture.cpp"), + Object(NonMatching, "JSystem/J2DGraph/J2DTextBox.cpp"), + ], + ), + JSystemLib( + "JRenderer", + [ + Object(NonMatching, "JSystem/JRenderer/JRenderer.cpp"), + ], + ), + JSystemLib( + "J3DGraphBase", + [ + Object(NonMatching, "JSystem/J3DGraphBase/J3DGD.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DSys.cpp"), + Object(Matching, "JSystem/J3DGraphBase/J3DVertex.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DTransform.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DPacket.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DShapeMtx.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DShape.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DMaterial.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DMatBlock.cpp"), + Object(NonMatching, "JSystem/J3DGraphBase/J3DTevs.cpp"), + Object(Matching, "JSystem/J3DGraphBase/J3DDrawBuffer.cpp"), + ], + ), + JSystemLib( + "J3DGraphAnimator", + [ + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModelData.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModel.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DMaterialAnm.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DVisibility.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DCluster.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DJoint.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DNode.cpp"), + Object(NonMatching, "JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp"), + ], + ), + JSystemLib( + "J3DGraphLoader", + [ + Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DClusterLoader.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DJointFactory.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DShapeFactory.cpp"), + Object(NonMatching, "JSystem/J3DGraphLoader/J3DAnmLoader.cpp"), + ], + ), + JSystemLib( + "JMath", + [ + Object(NonMatching, "JSystem/JMath/JMath.cpp"), + Object(NonMatching, "JSystem/JMath/random.cpp"), + ], + ), + DolphinLib( + "base", + [ + Object(NonMatching, "dolphin/base/PPCArch.c"), + ], + ), + DolphinLib( + "os", + [ + Object(NonMatching, "dolphin/os/__start.c"), + Object(NonMatching, "dolphin/os/OS.c"), + Object(NonMatching, "dolphin/os/OSAlarm.c"), + Object(NonMatching, "dolphin/os/OSAlloc.c"), + Object(NonMatching, "dolphin/os/OSArena.c"), + Object(NonMatching, "dolphin/os/OSAudioSystem.c"), + Object(NonMatching, "dolphin/os/OSCache.c"), + Object(NonMatching, "dolphin/os/OSContext.c"), + Object(NonMatching, "dolphin/os/OSError.c"), + Object(NonMatching, "dolphin/os/OSFont.c"), + Object(NonMatching, "dolphin/os/OSInterrupt.c"), + Object(NonMatching, "dolphin/os/OSLink.c"), + Object(NonMatching, "dolphin/os/OSMessage.c"), + Object(NonMatching, "dolphin/os/OSMemory.c"), + Object(NonMatching, "dolphin/os/OSMutex.c"), + Object(NonMatching, "dolphin/os/OSReboot.c"), + Object(NonMatching, "dolphin/os/OSReset.c"), + Object(NonMatching, "dolphin/os/OSResetSW.c"), + Object(NonMatching, "dolphin/os/OSRtc.c"), + Object(NonMatching, "dolphin/os/OSSync.c"), + Object(NonMatching, "dolphin/os/OSThread.c"), + Object(NonMatching, "dolphin/os/OSTime.c"), + Object(NonMatching, "dolphin/os/__ppc_eabi_init.cpp"), + ], + ), + DolphinLib( + "exi", + [ + Object(NonMatching, "dolphin/exi/EXIBios.c"), + Object(NonMatching, "dolphin/exi/EXIUart.c"), + ], + ), + DolphinLib( + "si", + [ + Object(NonMatching, "dolphin/si/SIBios.c"), + Object(NonMatching, "dolphin/si/SISamplingRate.c"), + ], + ), + DolphinLib( + "db", + [ + Object(NonMatching, "dolphin/db/db.c"), + ], + ), + DolphinLib( + "mtx", + [ + Object(NonMatching, "dolphin/mtx/mtx.c"), + Object(NonMatching, "dolphin/mtx/mtxvec.c"), + Object(NonMatching, "dolphin/mtx/mtx44.c"), + Object(NonMatching, "dolphin/mtx/vec.c"), + Object(NonMatching, "dolphin/mtx/quat.c"), + ], + ), + DolphinLib( + "dvd", + [ + Object(NonMatching, "dolphin/dvd/dvdlow.c"), + Object(NonMatching, "dolphin/dvd/dvdfs.c"), + Object(NonMatching, "dolphin/dvd/dvd.c"), + Object(NonMatching, "dolphin/dvd/dvdqueue.c"), + Object(NonMatching, "dolphin/dvd/dvderror.c"), + Object(NonMatching, "dolphin/dvd/dvdidutils.c"), + Object(NonMatching, "dolphin/dvd/dvdFatal.c"), + Object(NonMatching, "dolphin/dvd/fstload.c"), + ], + ), + DolphinLib( + "vi", + [ + Object(NonMatching, "dolphin/vi/vi.c"), + ], + ), + DolphinLib( + "pad", + [ + Object(NonMatching, "dolphin/pad/Padclamp.c"), + Object(NonMatching, "dolphin/pad/Pad.c"), + ], + ), + DolphinLib( + "ai", + [ + Object(NonMatching, "dolphin/ai/ai.c"), + Object(NonMatching, "dolphin/ar/ar.c"), + ], + ), + DolphinLib( + "ar", + [ + Object(NonMatching, "dolphin/ar/arq.c"), + ], + ), + DolphinLib( + "dsp", + [ + Object(NonMatching, "dolphin/dsp/dsp.c"), + Object(NonMatching, "dolphin/dsp/dsp_debug.c"), + Object(NonMatching, "dolphin/dsp/dsp_task.c"), + ], + ), + DolphinLib( + "card", + [ + Object(NonMatching, "dolphin/card/CARDBios.c"), + Object(NonMatching, "dolphin/card/CARDUnlock.c"), + Object(NonMatching, "dolphin/card/CARDRdwr.c"), + Object(NonMatching, "dolphin/card/CARDBlock.c"), + Object(NonMatching, "dolphin/card/CARDDir.c"), + Object(NonMatching, "dolphin/card/CARDCheck.c"), + Object(NonMatching, "dolphin/card/CARDMount.c"), + Object(NonMatching, "dolphin/card/CARDFormat.c"), + Object(NonMatching, "dolphin/card/CARDOpen.c"), + Object(NonMatching, "dolphin/card/CARDCreate.c"), + Object(NonMatching, "dolphin/card/CARDRead.c"), + Object(NonMatching, "dolphin/card/CARDWrite.c"), + Object(NonMatching, "dolphin/card/CARDStat.c"), + Object(NonMatching, "dolphin/card/CARDNet.c"), + ], + ), + DolphinLib( + "gx", + [ + Object(NonMatching, "dolphin/gx/GXInit.c"), + Object(NonMatching, "dolphin/gx/GXFifo.c"), + Object(NonMatching, "dolphin/gx/GXAttr.c"), + Object(NonMatching, "dolphin/gx/GXMisc.c"), + Object(NonMatching, "dolphin/gx/GXGeometry.c"), + Object(NonMatching, "dolphin/gx/GXFrameBuf.c"), + Object(NonMatching, "dolphin/gx/GXLight.c"), + Object(NonMatching, "dolphin/gx/GXTexture.c"), + Object(NonMatching, "dolphin/gx/GXBump.c"), + Object(NonMatching, "dolphin/gx/GXTev.c"), + Object(NonMatching, "dolphin/gx/GXPixel.c"), + Object(NonMatching, "dolphin/gx/GXStubs.c"), + Object(NonMatching, "dolphin/gx/GXDisplayList.c"), + Object(NonMatching, "dolphin/gx/GXTransform.c"), + Object(NonMatching, "dolphin/gx/GXPerf.c"), + ], + ), + DolphinLib( + "gd", + [ + Object(NonMatching, "dolphin/gd/GDBase.c"), + Object(NonMatching, "dolphin/gd/GDGeometry.c"), + ], + ), + { + "lib": "Runtime.PPCEABI.H", + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, + "host": False, + "objects": [ + Object(NonMatching, "Runtime.PPCEABI.H/__mem.c"), + Object(NonMatching, "Runtime.PPCEABI.H/__va_arg.c"), + Object(Matching, "Runtime.PPCEABI.H/global_destructor_chain.c"), + Object(NonMatching, "Runtime.PPCEABI.H/CPlusLibPPC.cp"), + Object(NonMatching, "Runtime.PPCEABI.H/NMWException.cp"), + Object(NonMatching, "Runtime.PPCEABI.H/ptmf.c"), + Object(NonMatching, "Runtime.PPCEABI.H/runtime.c"), + Object(Matching, "Runtime.PPCEABI.H/__init_cpp_exceptions.cpp"), + Object(Matching, "Runtime.PPCEABI.H/Gecko_ExceptionPPC.cp"), + Object(NonMatching, "Runtime.PPCEABI.H/GCN_mem_alloc.c"), + ], + }, + { + "lib": "MSL_C", + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, + "host": False, + "objects": [ + Object(NonMatching, "MSL_C/MSL_Common/abort_exit.c"), + Object(NonMatching, "MSL_C/MSL_Common/alloc.c"), + Object(NonMatching, "MSL_C/MSL_Common/errno.c"), + Object(NonMatching, "MSL_C/MSL_Common/ansi_files.c"), + Object(NonMatching, "MSL_C/MSL_Common_Embedded/ansi_fp.c"), + Object(NonMatching, "MSL_C/MSL_Common/arith.c"), + Object(NonMatching, "MSL_C/MSL_Common/buffer_io.c"), + Object(NonMatching, "MSL_C/MSL_Common/ctype.c"), + Object(NonMatching, "MSL_C/MSL_Common/direct_io.c"), + Object(NonMatching, "MSL_C/MSL_Common/file_io.c"), + Object(NonMatching, "MSL_C/MSL_Common/FILE_POS.c"), + Object(NonMatching, "MSL_C/MSL_Common/mbstring.c"), + Object(NonMatching, "MSL_C/MSL_Common/mem.c"), + Object(NonMatching, "MSL_C/MSL_Common/mem_funcs.c"), + Object(NonMatching, "MSL_C/MSL_Common/misc_io.c"), + Object(NonMatching, "MSL_C/MSL_Common/printf.c"), + Object(NonMatching, "MSL_C/MSL_Common/float.c"), + Object(NonMatching, "MSL_C/MSL_Common/scanf.c"), + Object(NonMatching, "MSL_C/MSL_Common/string.c"), + Object(NonMatching, "MSL_C/MSL_Common/strtoul.c"), + Object(NonMatching, "MSL_C/MSL_Common/uart_console_io.c"), + Object(NonMatching, "MSL_C/MSL_Common/wchar_io.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/e_acos.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/e_asin.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/e_atan2.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/e_fmod.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/e_rem_pio2.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/k_cos.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/k_rem_pio2.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/k_sin.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/k_tan.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_atan.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_copysign.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_cos.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_floor.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_frexp.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_ldexp.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_modf.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_sin.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/s_tan.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/w_acos.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/w_asin.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/w_atan2.c"), + Object(NonMatching, "MSL_C/Math/Double_precision/w_fmod.c"), + Object(NonMatching, "MSL_C/PPC_EABI/math_ppc.c"), + ], + }, + { + "lib": "TRK_MINNOW_DOLPHIN", + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, + "host": False, + "objects": [ + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/mainloop.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/nubevent.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/nubinit.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/msg.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/msgbuf.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/serpoll.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/usr_put.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/dispatch.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/msghndlr.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/support.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/mutex_TRK.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/notify.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/flush_cache.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/mem_TRK.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/targimpl.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Export/targsupp.s"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/__exception.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/ppc/Generic/mpc_7xx_603e.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Portable/main_TRK.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/dolphin_trk_glue.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/targcont.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/Os/dolphin/target_options.c"), + Object(NonMatching, "TRK_MINNOW_DOLPHIN/MetroTRK/Export/mslsupp.c"), + ], + }, + { + "lib": "amcstubs", + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, + "host": False, + "objects": [ + Object(NonMatching, "amcstubs/AmcExi2Stubs.c"), + ], + }, + { + "lib": "OdemuExi2", + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, + "host": False, + "objects": [ + Object(NonMatching, "OdemuExi2/DebuggerDriver.c"), + ], + }, + { + "lib": "odenotstub", + "mw_version": "GC/1.3.2", + "cflags": cflags_runtime, + "host": False, + "objects": [ + Object(NonMatching, "odenotstub/odenotstub.c"), + ], + }, + + # Begin RELs + { + "lib": "REL", + "mw_version": "GC/1.3.2", + "cflags": cflags_rel, + "host": False, + "objects": [ + Object(Matching, "REL/executor.c"), + Object( + Matching, + "REL/global_destructor_chain.c", + source="Runtime.PPCEABI.H/global_destructor_chain.c", + ), ], }, Rel(Matching, "f_pc_profile_lst", "f_pc/f_pc_profile_lst.cpp"), @@ -417,7 +1220,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_hot_floor"), ActorRel(NonMatching, "d_a_ikari"), ActorRel(NonMatching, "d_a_jbo"), - ActorRel(NonMatching, "d_a_kaji"), + ActorRel(Matching, "d_a_kaji"), ActorRel(NonMatching, "d_a_kanban"), ActorRel(NonMatching, "d_a_ki"), ActorRel(NonMatching, "d_a_knob00"), @@ -499,7 +1302,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_tag_evsw"), ActorRel(NonMatching, "d_a_tag_ghostship"), ActorRel(NonMatching, "d_a_tag_hint"), - ActorRel(Matching, "d_a_tag_kb_item"), + ActorRel(Matching, "d_a_tag_kb_item"), ActorRel(NonMatching, "d_a_tag_kk1"), ActorRel(NonMatching, "d_a_tag_light"), ActorRel(NonMatching, "d_a_tag_msg"), @@ -513,7 +1316,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_warphr"), ActorRel(NonMatching, "d_a_wbird"), ActorRel(NonMatching, "d_a_ykgr"), - ActorRel(NonMatching, "d_a_alldie"), + ActorRel(Matching, "d_a_alldie"), ActorRel(NonMatching, "d_a_am"), ActorRel(NonMatching, "d_a_am2"), ActorRel(NonMatching, "d_a_amiprop"), diff --git a/include/JSystem/J2DGraph/J2DPane.h b/include/JSystem/J2DGraph/J2DPane.h index e39ce88aa..654a80942 100644 --- a/include/JSystem/J2DGraph/J2DPane.h +++ b/include/JSystem/J2DGraph/J2DPane.h @@ -4,23 +4,10 @@ #include "JSystem/JGeometry.h" #include "JSystem/JSupport/JSUList.h" #include "SSystem/SComponent/c_xyz.h" -#include "dolphin/gx/GXEnum.h" #include "dolphin/mtx/mtx.h" -class J2DAnmBase; -class J2DAnmColor; -class J2DAnmTransform; -class J2DAnmTevRegKey; -class J2DAnmTextureSRTKey; -class J2DAnmVisibilityFull; -class J2DAnmVtxColor; class J2DGrafContext; -class J2DScreen; -class J2DAnmTexPattern; -class JKRArchive; class JSURandomInputStream; -struct ResFONT; -struct ResTIMG; enum J2DRotateAxis { /* 0x78 */ ROTATE_X = 'x', @@ -46,44 +33,26 @@ public: J2DPane(); J2DPane(J2DPane*, bool, u32, const JGeometry::TBox2&); J2DPane(u32, const JGeometry::TBox2&); - J2DPane(J2DPane* other, JSURandomInputStream* stream, u8 arg3); J2DPane(J2DPane*, JSURandomInputStream*); void initiate(); - void initialize(J2DPane*, bool, u64, const JGeometry::TBox2&); - void initialize(u64 tag, const JGeometry::TBox2& dim); void makePaneStream(J2DPane* other, JSURandomInputStream* stream); - void changeUseTrans(J2DPane* other); - bool appendChild(J2DPane* child); bool insertChild(J2DPane* before, J2DPane* child); void draw(f32 a1, f32 a2, const J2DGrafContext* ctx, bool a4); - void place(const JGeometry::TBox2& dim); - JGeometry::TBox2& getBounds(); - void rotate(f32 offsetX, f32 offsetY, J2DRotateAxis axis, f32 angle); - void rotate(f32 angle); void clip(const JGeometry::TBox2& bounds); void setBasePosition(J2DBasePosition position); - void setInfluencedAlpha(bool arg1, bool arg2); - JGeometry::TVec3 getGlbVtx(u8 arg1) const; - J2DPane* getFirstChildPane(); - J2DPane* getNextChildPane(); - J2DPane* getParentPane(); - void makePaneExStream(J2DPane* other, JSURandomInputStream* stream); - void* getPointer(JSURandomInputStream* stream, u32 size, JKRArchive* archive); - void animationTransform(); - void updateTransform(const J2DAnmTransform* transform); virtual ~J2DPane(); + virtual u16 getTypeID() { return 16; } virtual void move(f32 x, f32 y); virtual void add(f32 x, f32 y); virtual void resize(f32 x, f32 y); virtual bool setConnectParent(bool connected); - virtual void update(); virtual void calcMtx(); + virtual void update(); virtual void drawSelf(f32 arg1, f32 arg2); virtual void drawSelf(f32 arg1, f32 arg2, Mtx* mtx){}; - virtual void makeMatrix(f32, f32); virtual J2DPane* search(u32 tag); - virtual u16 getTypeID() { return 16; } + virtual void makeMatrix(f32, f32); JSUTree* getFirstChild() { return mPaneTree.getFirstChild(); } JSUTree* getEndChild() { return mPaneTree.getEndChild(); } @@ -100,7 +69,7 @@ public: /* 0x6C */ Mtx mDrawMtx; /* 0x9C */ cXy mBasePosition; /* 0xA4 */ f32 mRotation; - /* 0xA8 */ u8 mRotationAxis; + /* 0xA8 */ s8 mRotationAxis; /* 0xA9 */ u8 m2DBasePosition; /* 0xAA */ bool mVisible; /* 0xAB */ u8 mCullMode; diff --git a/include/JSystem/J2DGraph/J2DTextBox.h b/include/JSystem/J2DGraph/J2DTextBox.h new file mode 100644 index 000000000..571fae458 --- /dev/null +++ b/include/JSystem/J2DGraph/J2DTextBox.h @@ -0,0 +1,63 @@ +#ifndef J2DTEXTBOX_H +#define J2DTEXTBOX_H + +#include "JSystem/J2DGraph/J2DPane.h" +#include "JSystem/JKernel/JKRArchive.h" +#include "JSystem/JUtility/JUTResFont.h" + +enum J2DTextBoxHBinding { + /* 0x0 */ HBIND_CENTER, + /* 0x1 */ HBIND_RIGHT, + /* 0x2 */ HBIND_LEFT +}; + +enum J2DTextBoxVBinding { + /* 0x0 */ VBIND_CENTER, + /* 0x1 */ VBIND_BOTTOM, + /* 0x2 */ VBIND_TOP +}; + +struct J2DTbxBlockHeader { + /* 0x00 */ u32 mMagic; + /* 0x04 */ s32 mSize; +}; + +class J2DTextBox : public J2DPane { +public: + J2DTextBox(const char*, const char*); + J2DTextBox(J2DPane*, JSURandomInputStream*); + J2DTextBox(u32, const JGeometry::TBox2&, const ResFONT*, const char*, J2DTextBoxHBinding, + J2DTextBoxVBinding); + + void initiate(const ResFONT*, const char*, J2DTextBoxHBinding, J2DTextBoxVBinding); + void setFont(JUTFont*); + void draw(f32, f32, f32, J2DTextBoxHBinding); + char* getStringPtr() const; + s32 setString(const char*, ...); + + virtual ~J2DTextBox(); + virtual bool setConnectParent(bool); + virtual void drawSelf(f32, f32); + virtual void drawSelf(f32, f32, Mtx*); + virtual void resize(f32, f32); + virtual u16 getTypeID() { return 19; }; + +private: + /* 0xCC */ JUTResFont* mpFont; + /* 0xD0 */ JUtility::TColor mGradientFirst; + /* 0xD4 */ JUtility::TColor mGradientSecond; + /* 0xD8 */ f32 field_0xd8; + /* 0xDC */ f32 field_0xdc; + /* 0xD0 */ f32 field_0xe0; + /* 0xE4 */ f32 mFontLeading; + /* 0xE8 */ f32 mFontWidth; + /* 0xEC */ f32 mFontHeight; + /* 0xF0 */ char* mStringPtr; + /* 0xF4 */ JUtility::TColor mTextColor; + /* 0xF8 */ JUtility::TColor mTextBGColor; + /* 0xFC */ u8 mBindingH; + /* 0xFD */ u8 mBindingV; + /* 0xFE */ bool mTextFontOwned; +}; // Size: 0x100 + +#endif /* J2DTEXTBOX_H */ \ No newline at end of file diff --git a/include/JSystem/JKernel/JKRArchive.h b/include/JSystem/JKernel/JKRArchive.h index b1b6b13d2..4211d3edd 100644 --- a/include/JSystem/JKernel/JKRArchive.h +++ b/include/JSystem/JKernel/JKRArchive.h @@ -40,7 +40,7 @@ inline u16 read_big_endian_u16(void* ptr) { return ((u16)uptr[0] << 8) | ((u16)uptr[1]); } -inline u32 JKRDecompExpandSize(u8 * pBuf) { +inline u32 JKRDecompExpandSize(u8* pBuf) { return (pBuf[4] << 0x18) | (pBuf[5] << 0x10) | (pBuf[6] << 8) | pBuf[7]; } @@ -151,10 +151,12 @@ public: /* vt[09] */ virtual void removeResourceAll(void); /* override */ /* vt[10] */ virtual bool removeResource(void*); /* override */ /* vt[11] */ virtual bool detachResource(void*); /* override */ - /* vt[12] */ virtual u32 getResSize(const void*) const; /* override */ + /* vt[12] */ virtual u32 getResSize(const void* resource) const; /* override */ /* vt[13] */ virtual u32 countFile(const char*) const; /* override */ /* vt[14] */ virtual JKRFileFinder* getFirstFile(const char*) const; /* override */ - /* vt[15] */ virtual u32 getExpandedResSize(const void*) const; + /* vt[15] */ virtual u32 getExpandedResSize(const void* resource) const { + return getResSize(resource); + } /* vt[16] */ virtual void* fetchResource(SDIFileEntry*, u32*) = 0; /* vt[17] */ virtual void* fetchResource(void*, u32, SDIFileEntry*, u32*) = 0; /* vt[18] */ virtual void setExpandSize(SDIFileEntry*, u32); @@ -163,9 +165,7 @@ public: u32 countFile() const { return mArcInfoBlock->num_file_entries; } s32 countDirectory() const { return mArcInfoBlock->num_nodes; } u8 getMountMode() const { return mMountMode; } - bool isFileEntry(u32 param_0) { - return getFileAttribute(param_0) & 1; - } + bool isFileEntry(u32 param_0) { return getFileAttribute(param_0) & 1; } public: /* 0x00 */ // vtable @@ -224,4 +224,4 @@ inline void* JKRGetTypeResource(u32 tag, const char* name, JKRArchive* arc) { return JKRArchive::getGlbResource(tag, name, arc); } -#endif \ No newline at end of file +#endif diff --git a/include/JSystem/JKernel/JKRHeap.h b/include/JSystem/JKernel/JKRHeap.h index e3b4b802c..f8703af86 100644 --- a/include/JSystem/JKernel/JKRHeap.h +++ b/include/JSystem/JKernel/JKRHeap.h @@ -7,8 +7,6 @@ class JKRHeap; typedef void (*JKRErrorHandler)(void*, u32, int); -extern bool data_804508B0; - class JKRHeap : public JKRDisposer { public: class TState { @@ -44,6 +42,7 @@ public: s32 getFreeSize(); void* getMaxFreeBlock(); s32 getTotalFreeSize(); + u8 getCurrentGroupId(); s32 changeGroupID(u8 newGroupId); u32 getMaxAllocatableSize(int alignment); @@ -76,7 +75,7 @@ public: /* vt[18] */ virtual s32 do_getTotalFreeSize() = 0; /* vt[19] */ virtual s32 do_changeGroupID(u8 newGroupID); /* vt[20] */ virtual u8 do_getCurrentGroupId(); - /* vt[21] */ virtual u32 state_register(JKRHeap::TState* p, u32 id) const; + /* vt[21] */ virtual void state_register(JKRHeap::TState* p, u32 id) const; /* vt[22] */ virtual bool state_compare(JKRHeap::TState const& r1, JKRHeap::TState const& r2) const; /* vt[23] */ virtual void state_dump(JKRHeap::TState const& p) const; @@ -135,7 +134,7 @@ public: static JKRErrorHandler setErrorHandler(JKRErrorHandler errorHandler); - static void setDefaultDebugFill(bool status) { data_804508B0 = status; } + static void setDefaultDebugFill(bool status) { sDefaultFillFlag = status; } static void* getCodeStart(void) { return mCodeStart; } static void* getCodeEnd(void) { return mCodeEnd; } static void* getUserRamStart(void) { return mUserRamStart; } @@ -172,32 +171,23 @@ public: static JKRHeap* sSystemHeap; static JKRHeap* sCurrentHeap; + static bool sDefaultFillFlag; static JKRErrorHandler mErrorHandler; }; -// The C++ standard says that the first argument to operator new must be a size_t; -// which on 64-bit systems is unsigned long long; IntelliSense won't recognize the -// override unless we give it that. I don't know of an easy way to convince -// IntelliSense that we're in a 32-bit project, so just give it a different size. -#if defined __INTELLISENSE__ -typedef unsigned int NEW_SIZE; -#else -typedef u32 NEW_SIZE; -#endif +void* operator new(size_t size); +void* operator new(size_t size, int alignment); +void* operator new(size_t size, JKRHeap* heap, int alignment); -void* operator new(NEW_SIZE size); -void* operator new(NEW_SIZE size, int alignment); -void* operator new(NEW_SIZE size, JKRHeap* heap, int alignment); - -void* operator new[](NEW_SIZE size); -void* operator new[](NEW_SIZE size, int alignment); -void* operator new[](NEW_SIZE size, JKRHeap* heap, int alignment); +void* operator new[](size_t size); +void* operator new[](size_t size, int alignment); +void* operator new[](size_t size, JKRHeap* heap, int alignment); void operator delete(void* ptr); void operator delete[](void* ptr); -inline void* operator new(NEW_SIZE size, void* ptr) { +inline void* operator new(size_t size, void* ptr) { return ptr; } diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 8baed744b..d4f10e24e 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -13,6 +13,9 @@ #define JUT_WARN(LINE, ...) \ JUTAssertion::setWarningMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__); \ +#define JUT_LOG(LINE, ...) \ + JUTAssertion::setLogMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__) + #define JUT_CONFIRM(LINE, COND) \ JUTAssertion::setConfirmMessage(JUTAssertion::getSDevice(), __FILE__, LINE, COND, #COND) @@ -20,6 +23,7 @@ namespace JUTAssertion { u32 getSDevice(); void showAssert(u32 device, const char * file, int line, const char * assertion); void setWarningMessage_f(u32 device, char * file, int line, const char * fmt, ...); + void setLogMessage_f(u32 device, char* file, int line, const char* fmt, ...); void setConfirmMessage(u32 device, char * file, int line, bool cond, const char * msg); void create(); u32 flush_subroutine(); diff --git a/include/JSystem/JUtility/JUTFont.h b/include/JSystem/JUtility/JUTFont.h index b6cd3d90d..e91b9ed3a 100644 --- a/include/JSystem/JUtility/JUTFont.h +++ b/include/JSystem/JUtility/JUTFont.h @@ -4,10 +4,16 @@ #include "JSystem/JUtility/TColor.h" #include "MSL_C/string.h" +struct BlockHeader { + const BlockHeader* getNext() const { + return reinterpret_cast(reinterpret_cast(this) + size); + } + u32 magic; + u32 size; +}; + struct ResFONT { - struct INF1 { - /* 0x00 */ u32 magic; - /* 0x04 */ u32 size; + struct INF1 : BlockHeader { /* 0x08 */ u16 fontType; /* 0x0A */ u16 ascent; /* 0x0C */ u16 descent; @@ -16,17 +22,13 @@ struct ResFONT { /* 0x12 */ u16 defaultCode; }; - struct WID1 { - /* 0x00 */ u32 magic; - /* 0x04 */ u32 size; + struct WID1 : BlockHeader { /* 0x08 */ u16 startCode; /* 0x0A */ u16 endCode; /* 0x0C */ u8 mChunkNum[4]; }; - struct MAP1 { - /* 0x00 */ u32 magic; - /* 0x04 */ u32 size; + struct MAP1 : BlockHeader { /* 0x08 */ u16 mappingMethod; /* 0x0A */ u16 startCode; /* 0x0C */ u16 endCode; @@ -34,9 +36,7 @@ struct ResFONT { /* 0x10 */ u16 mLeading; }; - struct GLY1 { - /* 0x00 */ u32 magic; - /* 0x04 */ u32 size; + struct GLY1 : BlockHeader { /* 0x08 */ u16 startCode; /* 0x0A */ u16 endCode; /* 0x0C */ u16 cellWidth; @@ -80,7 +80,7 @@ public: /* 0x30 */ virtual int getCellWidth() const; /* 0x34 */ virtual s32 getCellHeight() const; /* 0x38 */ virtual int getFontType() const = 0; - /* 0x3C */ virtual ResFONT* getResFont() const = 0; + /* 0x3C */ virtual const ResFONT* getResFont() = 0; /* 0x40 */ virtual bool isLeadByte(int a1) const = 0; static bool isLeadByte_1Byte(int b); diff --git a/include/JSystem/JUtility/JUTGamePad.h b/include/JSystem/JUtility/JUTGamePad.h index 5f3304aed..aca0c1fd1 100644 --- a/include/JSystem/JUtility/JUTGamePad.h +++ b/include/JSystem/JUtility/JUTGamePad.h @@ -242,10 +242,9 @@ public: /* 0x7C */ JSULink mLink; /* 0x8C */ JUTGamePadRecordBase* mPadRecord; /* 0x90 */ JUTGamePadRecordBase* mPadReplay; - /* 0x94 */ C3ButtonReset mButtonReset; - /* 0x98 */ u8 field_0x98[4]; + /* 0x94 */ u8 field_0x94[4]; + /* 0x98 */ C3ButtonReset mButtonReset; /* 0x9C */ OSTime mResetTime; - /* 0xA4 */ u8 field_0xa4; static JSUList mPadList; static bool mListInitialized; diff --git a/include/JSystem/JUtility/JUTGba.h b/include/JSystem/JUtility/JUTGba.h new file mode 100644 index 000000000..b9d520e5a --- /dev/null +++ b/include/JSystem/JUtility/JUTGba.h @@ -0,0 +1,48 @@ +#ifndef JUTGBA_H +#define JUTGBA_H + +#include "dolphin/types.h" + +struct JUTGbaParam; +struct JUTGbaThreadVar; + +typedef void (*JUTGba_Func)(JUTGbaParam*, void*); + +class JUTGba { +public: + JUTGba(); + + static void create(); + void result_common(int, u32, u32*); + void resultStatus_common(int, u32, u8*); + void doJoyBoot(int, s32, s32, u8*, u32, JUTGba_Func, void*); + void resultJoyBoot(int, u8*); + void doInitProbe(int, JUTGba_Func, void*); + void resultInitProbe(int, u32*); + void doProbe(int, JUTGba_Func, void*); + BOOL resultProbe(int, u32*); + void doReset(int, JUTGba_Func, void*); + BOOL resultReset(int, u8*); + void doRead(int, u8*, JUTGba_Func, void*); + BOOL resultRead(int, u8*); + void doWrite(int, u8*, JUTGba_Func, void*); + BOOL resultWrite(int, u8*); + void doGetStatus(int, JUTGba_Func, void*); + BOOL resultGetStatus(int, u8*); + void gbaThreadMain(void*); + void gbaThread_sleep(s64); + void gbaThread_Destroy(JUTGbaThreadVar*); + void gbaThread_JoyBoot(JUTGbaThreadVar*); + void gbaThread_InitProbe(JUTGbaThreadVar*); + void gbaThread_Probe(JUTGbaThreadVar*); + void gbaThread_Reset(JUTGbaThreadVar*); + void gbaThread_Read(JUTGbaThreadVar*); + void gbaThread_Write(JUTGbaThreadVar*); + void gbaThread_GetStatus(JUTGbaThreadVar*); + + static JUTGba* getManager() { return sManager; } + + static JUTGba* sManager; +}; + +#endif /* JUTGBA_H */ diff --git a/include/JSystem/JUtility/JUTResFont.h b/include/JSystem/JUtility/JUTResFont.h index 4e5a05794..c8200136e 100644 --- a/include/JSystem/JUtility/JUTResFont.h +++ b/include/JSystem/JUtility/JUTResFont.h @@ -8,42 +8,36 @@ class JKRHeap; typedef bool (*IsLeadByte_func)(int); -struct BlockHeader { - const BlockHeader* getNext() const { return reinterpret_cast(reinterpret_cast(this) + size); } - u32 magic; - u32 size; -}; - class JUTResFont : public JUTFont { public: - /* 802DF000 */ virtual ~JUTResFont(); - /* 802DF48C */ virtual void setGX(); - /* 802DF584 */ virtual void setGX(JUtility::TColor, JUtility::TColor); - /* 802DF7C4 */ virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool); - /* 802DDFEC */ virtual int getLeading() const; - /* 802DE004 */ virtual s32 getAscent() const; - /* 802DE010 */ virtual s32 getDescent() const; - /* 802DE01C */ virtual s32 getHeight() const; - /* 802DDFF8 */ virtual s32 getWidth() const; - /* 802DFC64 */ virtual void getWidthEntry(int, JUTFont::TWidth*) const; - /* 802DFD0C */ virtual int getCellWidth() const; - /* 802DFD58 */ virtual s32 getCellHeight() const; - /* 802DDFE0 */ virtual int getFontType() const; - /* 802DDFD8 */ virtual ResFONT* getResFont() const; - /* 802DFDA4 */ virtual bool isLeadByte(int) const; - /* 802DFF60 */ virtual void loadImage(int, _GXTexMapID); - /* 802DF344 */ virtual void setBlock(); + virtual ~JUTResFont(); + virtual void setGX(); + virtual void setGX(JUtility::TColor, JUtility::TColor); + virtual f32 drawChar_scale(f32, f32, f32, f32, int, bool); + virtual int getLeading() const { return mInfoBlock->leading; } + virtual s32 getAscent() const { return mInfoBlock->ascent; } + virtual s32 getDescent() const { return mInfoBlock->descent; } + virtual s32 getHeight() const { return getAscent() + getDescent(); } + virtual s32 getWidth() const { return mInfoBlock->width; } + virtual void getWidthEntry(int, JUTFont::TWidth*) const; + virtual int getCellWidth() const; + virtual s32 getCellHeight() const; + virtual int getFontType() const { return mInfoBlock->fontType; } + virtual const ResFONT* getResFont() { return mResFont; } + virtual bool isLeadByte(int) const; + virtual void loadImage(int, _GXTexMapID); + virtual void setBlock(); - /* 802DEF94 */ JUTResFont(ResFONT const*, JKRHeap*); - /* 802DEF48 */ JUTResFont(); - /* 802DF08C */ void deleteMemBlocks_ResFont(); - /* 802DF0B0 */ void initialize_state(); - /* 802DF0DC */ bool initiate(ResFONT const*, JKRHeap*); - /* 802DF13C */ bool protected_initiate(ResFONT const*, JKRHeap*); - /* 802DF248 */ void countBlock(); - /* 802DFBE8 */ void loadFont(int, _GXTexMapID, JUTFont::TWidth*); - /* 802DFDD8 */ int getFontCode(int) const; - /* 802E00C4 */ int convertSjis(int, u16*) const; + JUTResFont(ResFONT const*, JKRHeap*); + JUTResFont(); + void deleteMemBlocks_ResFont(); + void initialize_state(); + bool initiate(ResFONT const*, JKRHeap*); + bool protected_initiate(ResFONT const*, JKRHeap*); + void countBlock(); + void loadFont(int, _GXTexMapID, JUTFont::TWidth*); + int getFontCode(int) const; + int convertSjis(int, u16*) const; inline void delete_and_initialize() { deleteMemBlocks_ResFont(); @@ -52,20 +46,19 @@ public: static IsLeadByte_func const saoAboutEncoding_[3]; - // some types uncertain, may need to be fixed /* 0x1C */ int mWidth; /* 0x20 */ int mHeight; /* 0x24 */ _GXTexObj field_0x24; - /* 0x44 */ int field_0x44; + /* 0x44 */ int mTexPageIdx; /* 0x48 */ const ResFONT* mResFont; - /* 0x4C */ ResFONT::INF1* mInf1Ptr; - /* 0x50 */ void** mMemBlocks; + /* 0x4C */ ResFONT::INF1* mInfoBlock; + /* 0x50 */ void** mpMemBlocks; /* 0x54 */ ResFONT::WID1** mpWidthBlocks; /* 0x58 */ ResFONT::GLY1** mpGlyphBlocks; /* 0x5C */ ResFONT::MAP1** mpMapBlocks; - /* 0x60 */ u16 mWid1BlockNum; - /* 0x62 */ u16 mGly1BlockNum; - /* 0x64 */ u16 mMap1BlockNum; + /* 0x60 */ u16 mWidthBlockNum; + /* 0x62 */ u16 mGlyphBlockNum; + /* 0x64 */ u16 mMapBlockNum; /* 0x66 */ u16 field_0x66; /* 0x68 */ u16 mMaxCode; /* 0x6C */ IsLeadByte_func* mIsLeadByte; diff --git a/include/MSL_C/MSL_Common/Src/stddef.h b/include/MSL_C/MSL_Common/Src/stddef.h index 91086efb3..7d93b6504 100644 --- a/include/MSL_C/MSL_Common/Src/stddef.h +++ b/include/MSL_C/MSL_Common/Src/stddef.h @@ -5,8 +5,13 @@ extern "C" { #endif +#if defined __INTELLISENSE__ +typedef unsigned int size_t; +typedef int ptrdiff_t; +#else typedef unsigned long size_t; typedef long ptrdiff_t; +#endif #ifndef NULL #define NULL (0) diff --git a/include/d/actor/d_a_obj_pirateship.h b/include/d/actor/d_a_obj_pirateship.h new file mode 100644 index 000000000..bd60ef977 --- /dev/null +++ b/include/d/actor/d_a_obj_pirateship.h @@ -0,0 +1,15 @@ +#ifndef D_A_OBJ_PIRATESHIP_H +#define D_A_OBJ_PIRATESHIP_H + +#include "f_op/f_op_actor_mng.h" + +namespace daObjPirateship { + class Act_c : public fopAc_ac_c { + public: + /* 0x290 */ u8 temp[0x2CC - 0x290]; + /* 0x2CC */ u8 unk2CC; + /* 0x2D0 */ J3DModel* mpModel; + }; +} + +#endif /* D_A_OBJ_PIRATESHIP_H */ diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 0e74a6fbd..5cb4580df 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -90,7 +90,7 @@ public: void ct(); void init(); void itemInit(); - int getLayerNo(int i_roomNo); + static int getLayerNo(int i_roomNo); void createParticle(); void createDemo(); void removeDemo(); @@ -374,6 +374,42 @@ inline u8 dComIfGs_getItem(int param_0) { return g_dComIfG_gameInfo.save.getPlayer().getItem().getItem(param_0); } +inline u8 dComIfGs_getBeast(int i_idx) { + return g_dComIfG_gameInfo.save.getPlayer().getBagItem().getBeast(i_idx); +} + +inline u8 dComIfGs_getBait(int i_idx) { + return g_dComIfG_gameInfo.save.getPlayer().getBagItem().getBait(i_idx); +} + +inline u8 dComIfGs_getReserve(int i_idx) { + return g_dComIfG_gameInfo.save.getPlayer().getBagItem().getReserve(i_idx); +} + +inline BOOL dComIfGs_isGetCollectMap(int i_itemNo) { + return g_dComIfG_gameInfo.save.getPlayer().getMap().isGetMap(i_itemNo - 1); +} + +inline u8 dComIfGs_getArrowNum() { + return g_dComIfG_gameInfo.save.getPlayer().getItemRecord().getArrowNum(); +} + +inline u8 dComIfGs_getBombNum() { + return g_dComIfG_gameInfo.save.getPlayer().getItemRecord().getBombNum(); +} + +inline u8 dComIfGs_getBeastNum(int i_idx) { + return g_dComIfG_gameInfo.save.getPlayer().getBagItemRecord().getBeastNum(i_idx); +} + +inline u8 dComIfGs_getBaitNum(int i_idx) { + return g_dComIfG_gameInfo.save.getPlayer().getBagItemRecord().getBaitNum(i_idx); +} + +inline u8 dComIfGs_getReserveNum(int i_idx) { + return g_dComIfG_gameInfo.save.getPlayer().getBagItemRecord().getReserveNum(i_idx); +} + inline void dComIfGs_setEventReg(u16 i_reg, u8 i_no) { g_dComIfG_gameInfo.save.getEvent().setEventReg(i_reg, i_no); } @@ -708,10 +744,19 @@ inline void dComIfGp_evmng_execute() { * === DRAWLIST === */ -inline int dComIfGd_setSimpleShadow(cXyz* pos, f32 param_1, f32 param_2, cXyz* param_3, s16 angle, - f32 param_5, _GXTexObj* tex) { - return g_dComIfG_gameInfo.drawlist.setSimpleShadow(pos, param_1, param_2, param_3, angle, - param_5, tex); +inline int dComIfGd_setSimpleShadow(cXyz* pPos, f32 param_1, f32 param_2, cXyz* param_3, s16 angle, + f32 param_5, GXTexObj* pTex) { + return g_dComIfG_gameInfo.drawlist.setSimpleShadow(pPos, param_1, param_2, param_3, angle, + param_5, pTex); +} + +int dComIfGd_setSimpleShadow2(cXyz* pPos, f32 param_1, f32 param_2, cBgS_PolyInfo& pPolyInfo, + s16 param_4, f32 param_5, GXTexObj* pTex); + +inline int dComIfGd_setRealShadow2(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 param_5, + f32 param_6, dKy_tevstr_c* pTevStr) { + return g_dComIfG_gameInfo.drawlist.setRealShadow2(id, param_2, pModel, pPos, param_5, param_6, + pTevStr); } /** diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index a2918a937..3cc5aaa85 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -132,6 +132,7 @@ public: void imageDraw(f32 (*)[4]); void draw(f32 (*)[4]); int setReal(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*); + int setReal2(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*); bool addReal(u32, J3DModel*); int setSimple(cXyz*, f32, f32, cXyz*, s16, f32, GXTexObj*); static void setSimpleTex(ResTIMG const*); @@ -186,6 +187,10 @@ public: return mShadowControl.setSimple(param_0, param_1, param_2, param_3, param_4, param_5, param_6); } + int setRealShadow2(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 param_5, f32 param_6, + dKy_tevstr_c* pTevStr) { + return mShadowControl.setReal2(id, param_2, pModel, pPos, param_5, param_6, pTevStr); + } static void offWipe() { mWipe = false; } @@ -234,4 +239,4 @@ STATIC_ASSERT(sizeof(dDlst_list_c) == 0x16234); void dDlst_texSpecmapST(const cXyz*, const dKy_tevstr_c*, J3DModelData*, float); -#endif /* D_D_DRAWLIST_H */ \ No newline at end of file +#endif /* D_D_DRAWLIST_H */ diff --git a/include/d/d_save.h b/include/d/d_save.h index e45b7e245..8d4382f75 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -46,7 +46,7 @@ public: void init(); void set(char const*, s8, u8); - s8 getRoomNo() const { return mRoomNo; } + const s8 getRoomNo() const { return mRoomNo; } u8 getPlayerStatus() const { return mPlayerStatus; } char* getName() { return mName; } @@ -99,6 +99,9 @@ public: /* 80059894 */ void decTimer(); /* 800598D0 */ u16 getTimer(); + u8 getArrowNum() const { return mArrowNum; } + u8 getBombNum() const { return mBombNum; } + /* 0x0 */ u16 mTimer; /* 0x2 */ u8 field_0x2; /* 0x3 */ u8 mArrowNum; @@ -141,9 +144,13 @@ public: /* 8005A854 */ u8 checkReserveItemEmpty(); /* 8005A878 */ u8 checkReserveItem(u8); - /* 0x00 */ u8 field_0x0[8]; - /* 0x08 */ u8 field_0x8[8]; - /* 0x10 */ u8 field_0x10[8]; + u8 getBeast(int i_idx) const { return mBeast[i_idx]; } + u8 getBait(int i_idx) const { return mBait[i_idx]; } + u8 getReserve(int i_idx) const { return mReserve[i_idx]; } + + /* 0x00 */ u8 mBeast[8]; + /* 0x08 */ u8 mBait[8]; + /* 0x10 */ u8 mReserve[8]; }; // Size: 0x18 STATIC_ASSERT(sizeof(dSv_player_bag_item_c) == 0x18); @@ -170,9 +177,13 @@ class dSv_player_bag_item_record_c { public: /* 8005AC48 */ void init(); - /* 0x00 */ u8 field_0x0[8]; - /* 0x08 */ u8 field_0x8[8]; - /* 0x10 */ u8 field_0x10[8]; + u8 getBeastNum(int i_idx) const { return mBeastNum[i_idx]; } + u8 getBaitNum(int i_idx) const { return mBaitNum[i_idx]; } + u8 getReserveNum(int i_idx) const { return mReserveNum[i_idx]; } + + /* 0x00 */ u8 mBeastNum[8]; + /* 0x08 */ u8 mBaitNum[8]; + /* 0x10 */ u8 mReserveNum[8]; }; // Size: 0x18 STATIC_ASSERT(sizeof(dSv_player_bag_item_record_c) == 0x18); @@ -413,6 +424,8 @@ public: /* 0x21 */ u8 mDungeonItem; }; // Size: 0x24 +STATIC_ASSERT(sizeof(dSv_memBit_c) == 0x24); + class dSv_ocean_c { public: /* 8005C8E8 */ void init(); @@ -422,6 +435,8 @@ public: /* 0x0 */ u16 field_0x0[50]; }; +STATIC_ASSERT(sizeof(dSv_ocean_c) == 0x64); + class dSv_event_c { public: /* 8005CACC */ void init(); @@ -434,6 +449,8 @@ public: /* 0x0 */ u8 mFlags[0x100]; }; // Size: 0x100 +STATIC_ASSERT(sizeof(dSv_event_c) == 0x100); + class dSv_reserve_c { public: /* 8005CB94 */ void init(); @@ -452,6 +469,8 @@ public: /* 0x0 */ dSv_memBit_c mMembit; }; // Size: 0x24 +STATIC_ASSERT(sizeof(dSv_memory_c) == 0x24); + class dSv_danBit_c { public: /* 8005CBD0 */ int init(s8); @@ -568,6 +587,8 @@ public: /* 0x624 */ dSv_event_c mEvent; }; // Size: 0x724 +STATIC_ASSERT(sizeof(dSv_save_c) == 0x728); + class dSv_info_c { public: /* 8005D604 */ void init(); diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index ae921b475..ab264fba1 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -111,8 +111,8 @@ struct DOUBLE_POS { double x, y, z; }; -inline s32 fopAcM_GetRoomNo(const fopAc_ac_c* pActor) { - return (s8)pActor->current.roomNo; +inline const s8 fopAcM_GetRoomNo(const fopAc_ac_c* pActor) { + return pActor->current.roomNo; } inline u32 fopAcM_GetID(const void* pActor) { diff --git a/include/m_Do/m_Do_controller_pad.h b/include/m_Do/m_Do_controller_pad.h index 7957acc24..4495ada4a 100644 --- a/include/m_Do/m_Do_controller_pad.h +++ b/include/m_Do/m_Do_controller_pad.h @@ -33,7 +33,7 @@ extern interface_of_controller_pad g_mDoCPd_cpadInfo[4]; #define CPad_CHECK_TRIG_RIGHT(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 6) & 1) #define CPad_CHECK_TRIG_LEFT(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 7) & 1) -void mDoCPd_Create(); -void mDoCPd_Read(); +int mDoCPd_Create(); +int mDoCPd_Read(); #endif diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 133d2f317..6da1b8c98 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -233,7 +233,19 @@ public: class JAIAnimeSound; -class mDoExt_McaMorf /* : public J3DMtxCalcMaya */ { +class J3DMtxCalcBasic { // Placeholder to fix mDoExt_McaMorf inheritance +public: + virtual ~J3DMtxCalcBasic(); +}; + +class J3DMtxCalcMaya : virtual J3DMtxCalcBasic { // Placeholder to fix mDoExt_McaMorf inheritance +public: + virtual ~J3DMtxCalcMaya(); + + u8 pad[0x48]; +}; + +class mDoExt_McaMorf : public J3DMtxCalcMaya { public: mDoExt_McaMorf(J3DModelData*, mDoExt_McaMorfCallBack1_c*, mDoExt_McaMorfCallBack2_c*, J3DAnmTransform*, int, float, int, int, int, void*, unsigned long, unsigned long); virtual ~mDoExt_McaMorf(); @@ -241,11 +253,11 @@ public: void setAnm(J3DAnmTransform*, int, f32, f32, f32, f32, void*); J3DModel* getModel() { return mpModel; } void setFrame(f32 frame) { mFrameCtrl.setFrame(frame); } + void update(); void updateDL(); - void play(Vec *, u32, u8); + void play(Vec *, u32, s8); void stopZelAnime(); - u8 pad[0x4C]; // J3DMtxCalcMaya /* 0x50 */ J3DModel* mpModel; /* 0x54 */ J3DAnmTransform* mpAnm; /* 0x58 */ J3DFrameCtrl mFrameCtrl; @@ -257,6 +269,8 @@ public: /* 0x80 */ JAIAnimeSound * mpSound; /* 0x84 */ mDoExt_McaMorfCallBack1_c * mpCallBack1; /* 0x88 */ mDoExt_McaMorfCallBack2_c * mpCallBack2; + /* 0x8C */ /* virtual inheritance */ + /* 0x94 */ u8 pad2[0xB4 - 0x94]; }; class mDoExt_3DlineMat_c { diff --git a/include/m_Do/m_Do_gba_com.h b/include/m_Do/m_Do_gba_com.h new file mode 100644 index 000000000..fa925c341 --- /dev/null +++ b/include/m_Do/m_Do_gba_com.h @@ -0,0 +1,103 @@ +#ifndef M_DO_GBA_COM_H +#define M_DO_GBA_COM_H + +#include "dolphin/types.h" + +class mDoGaC_DataManag_c { +public: + /* 0x0 */ u32 field_0x0; + /* 0x4 */ u8 field_0x4; + /* 0x5 */ u8 field_0x5; +}; + +struct mDoGaC_unk_data { + /* 0x00 */ u32* field_0x0; + /* 0x04 */ int field_0x4; + /* 0x08 */ u8 field_0x8; + /* 0x0C */ u32 field_0xc; +}; + +class mDoGaC_agbCom_c { +public: + void mDoGaC_Initial(mDoGaC_DataManag_c*, u8); + void mDoGaC_ComOpen(); + void mDoGaC_ComClose(); + void mDoGaC_ComStart(); + void mDoGaC_ComStop(); + void mDoGaC_GbaReboot(); + void mDoGaC_GbaReset(); + void mDoGaC_ComRestart(); + void mDoGaC_Connect(); + void mDoGaC_ConnectSleep(); + void mDoGaC_ConnectWake(); + int mDoGaC_GbaLink(); + int mDoGaC_SendDataSet(u32*, int, u8, u32); + void mDoGaC_SendDataWrite(); + int mDoGaC_SendEntry(u8, u32); + int mDoGaC_SendStatusCheck(u8); + int mDoGaC_SendEndCheck(u8); + bool mDoGaC_RecvStatusCheck(u8); + void mDoGaC_DataStatusReset(u8); + int mDoGaC_StatusSendSet(u8); + void mDoGaC_ProbeCheck0(); + void mDoGaC_ProbeCheck1(); + void mDoGaC_CodeExchange0(); + void mDoGaC_CodeExchange1(); + void mDoGaC_CodeExchange2(); + void mDoGaC_CodeExchange3(); + void mDoGaC_CodeExchange4(); + void mDoGaC_ContextCheck(); + void mDoGaC_ContextSend(); + void mDoGaC_ContextRead(); + void mDoGaC_GbaWrite(); + void mDoGaC_WriteResult(); + void mDoGaC_GbaRead(); + void mDoGaC_ReadResult(); + + ~mDoGaC_agbCom_c(); + + u8 getPortNo() { return mPortNo; } + + /* 0x000 */ u8 field_0x0; + /* 0x001 */ u8 field_0x1; + /* 0x002 */ u8 field_0x2; + /* 0x003 */ u8 field_0x3; + /* 0x004 */ u8 field_0x4; + /* 0x005 */ u8 field_0x5; + /* 0x006 */ u8 field_0x6; + /* 0x007 */ u8 field_0x7; + /* 0x008 */ u8 field_0x8; + /* 0x009 */ u8 field_0x9; + /* 0x00A */ u8 field_0xa; + /* 0x00B */ u8 field_0xb; + /* 0x00C */ mDoGaC_unk_data field_0xc[16]; + /* 0x10C */ u8 field_0x10c; + /* 0x10D */ u8 mPortNo; + /* 0x10E */ u8 field_0x10e; + /* 0x10F */ u8 field_0x10F[0x110 - 0x10F]; + /* 0x110 */ mDoGaC_DataManag_c* field_0x110; + /* 0x114 */ u32 field_0x114; + /* 0x118 */ u32 field_0x118; + /* 0x11C */ u32 field_0x11C; + /* 0x120 */ u32 field_0x120; + /* 0x124 */ u8 field_0x124[0x128 - 0x124]; + /* 0x128 */ u8 field_0x128; + /* 0x129 */ u8 field_0x129[0x12C - 0x129]; + union { + /* 0x12C */ u32 U32; + /* 0x12C */ u8 U8; + struct { + /* 0x12C */ u16 _12c; + /* 0x12C */ u16 _12e; + } U16; + } field_0x12c; +}; + +extern mDoGaC_agbCom_c g_mDoGaC_gbaCom; +extern mDoGaC_DataManag_c TestDataManager[16]; + +inline u8 mDoGaC_getPortNo() { + return g_mDoGaC_gbaCom.getPortNo(); +} + +#endif /* M_DO_GBA_COM_H */ \ No newline at end of file diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp index 0bc3cc716..a9d3cd5bb 100644 --- a/src/DynamicLink.cpp +++ b/src/DynamicLink.cpp @@ -13,14 +13,9 @@ #include "MSL_C/stdio.h" #include "REL/executor.h" #include "m_Do/m_Do_dvd_thread.h" +#include "m_Do/m_Do_ext.h" #include "dolphin/os/OS.h" -// TODO -// #include "m_Do/m_Do_ext.h" -JKRExpHeap* mDoExt_getArchiveHeap(); -extern JKRExpHeap* archiveHeap; -// end m_Do_ext.h - DynamicModuleControlBase* DynamicModuleControlBase::mFirst; DynamicModuleControlBase* DynamicModuleControlBase::mLast; diff --git a/src/JSystem/J2DGraph/J2DPane.cpp b/src/JSystem/J2DGraph/J2DPane.cpp index 09f060911..66b9a60d9 100644 --- a/src/JSystem/J2DGraph/J2DPane.cpp +++ b/src/JSystem/J2DGraph/J2DPane.cpp @@ -5,6 +5,7 @@ #include "JSystem/J2DGraph/J2DPane.h" #include "JSystem/JSupport/JSURandomInputStream.h" +#include "dolphin/gx/GXEnum.h" #include "dolphin/types.h" /* 802CF8F4-802CF984 .text __ct__7J2DPaneFv */ @@ -180,8 +181,18 @@ J2DPane* J2DPane::search(u32 tag) { } /* 802D0714-802D0800 .text makeMatrix__7J2DPaneFff */ -void J2DPane::makeMatrix(float, float) { - /* Nonmatching */ +void J2DPane::makeMatrix(f32 x, f32 y) { + Mtx stack1, stack2, stack3; + if (mRotation != 0.0f) { + MTXTrans(stack1, -mBasePosition.x, -mBasePosition.y, 0.0f); + f32 rot = mRotationAxis == ROTATE_Z ? -mRotation : mRotation; + MTXRotRad(stack2, mRotationAxis, rot * 0.017445329f); + MTXTrans(stack3, mBasePosition.x + x, mBasePosition.y + y, 0.0f); + MTXConcat(stack2, stack1, mMtx); + MTXConcat(stack3, mMtx, mMtx); + } else { + MTXTrans(mMtx, x, y, 0.0f); + } } /* 802D0800-802D08D8 .text setBasePosition__7J2DPaneF15J2DBasePosition */ @@ -209,13 +220,3 @@ void J2DPane::setBasePosition(J2DBasePosition pos) { mRotationAxis = ROTATE_Z; calcMtx(); } - -/* 802D08D8-802D08DC .text drawSelf__7J2DPaneFffPA3_A4_f */ -// void J2DPane::drawSelf(float, float, float (*)[3][4]) { -// /* Nonmatching */ -// } - -/* 802D08DC-802D08E4 .text getTypeID__7J2DPaneFv */ -// u16 J2DPane::getTypeID() { -// /* Nonmatching */ -// } diff --git a/src/JSystem/JKernel/JKRDisposer.cpp b/src/JSystem/JKernel/JKRDisposer.cpp index 110700a4f..8f697e96f 100644 --- a/src/JSystem/JKernel/JKRDisposer.cpp +++ b/src/JSystem/JKernel/JKRDisposer.cpp @@ -4,14 +4,20 @@ // #include "JSystem/JKernel/JKRDisposer.h" -#include "dolphin/types.h" +#include "JSystem/JKernel/JKRHeap.h" /* 802B3C30-802B3C98 .text __ct__11JKRDisposerFv */ -JKRDisposer::JKRDisposer() { - /* Nonmatching */ +JKRDisposer::JKRDisposer() : mLink(this) { + mHeap = JKRHeap::findFromRoot(this); + if (mHeap) { + mHeap->appendDisposer(this); + } } /* 802B3C98-802B3D1C .text __dt__11JKRDisposerFv */ JKRDisposer::~JKRDisposer() { - /* Nonmatching */ + JKRHeap* heap = mHeap; + if (heap) { + heap->removeDisposer(this); + } } diff --git a/src/JSystem/JKernel/JKRHeap.cpp b/src/JSystem/JKernel/JKRHeap.cpp index 10bcd98b6..1ee6dc7fe 100644 --- a/src/JSystem/JKernel/JKRHeap.cpp +++ b/src/JSystem/JKernel/JKRHeap.cpp @@ -4,229 +4,473 @@ // #include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "dolphin/os/OS.h" #include "dolphin/types.h" +#include "global.h" + +bool JKRHeap::sDefaultFillFlag = true; +JKRHeap* JKRHeap::sSystemHeap; +JKRHeap* JKRHeap::sCurrentHeap; +JKRHeap* JKRHeap::sRootHeap; +JKRErrorHandler JKRHeap::mErrorHandler; /* 802B0100-802B0224 .text __ct__7JKRHeapFPvUlP7JKRHeapb */ -JKRHeap::JKRHeap(void*, unsigned long, JKRHeap*, bool) { - /* Nonmatching */ +JKRHeap::JKRHeap(void* data, u32 size, JKRHeap* parent, bool errorFlag) : JKRDisposer(), mChildTree(this), mDisposerList() { + OSInitMutex(&mMutex); + mSize = size; + mStart = (u8*)data; + mEnd = (u8*)data + size; + + if (parent == NULL) { + becomeSystemHeap(); + becomeCurrentHeap(); + } else { + parent->mChildTree.appendChild(&mChildTree); + + if (getSystemHeap() == getRootHeap()) { + becomeSystemHeap(); + } + + if (getCurrentHeap() == getRootHeap()) { + becomeCurrentHeap(); + } + } + + mErrorFlag = errorFlag; + if (mErrorFlag == true && mErrorHandler == NULL) { + mErrorHandler = JKRDefaultMemoryErrorRoutine; + } + + mDebugFill = sDefaultFillFlag; + mInitFlag = false; } /* 802B0224-802B0338 .text __dt__7JKRHeapFv */ JKRHeap::~JKRHeap() { - /* Nonmatching */ + mChildTree.getParent()->removeChild(&mChildTree); + JSUTree* nextRootHeap = sRootHeap->mChildTree.getFirstChild(); + + if (sCurrentHeap == this) { + sCurrentHeap = !nextRootHeap ? sRootHeap : nextRootHeap->getObject(); + } + + if (sSystemHeap == this) { + sSystemHeap = !nextRootHeap ? sRootHeap : nextRootHeap->getObject(); + } } +void* JKRHeap::mCodeStart; +void* JKRHeap::mCodeEnd; +void* JKRHeap::mUserRamStart; +void* JKRHeap::mUserRamEnd; +u32 JKRHeap::mMemorySize; + /* 802B0338-802B03E8 .text initArena__7JKRHeapFPPcPUli */ -void JKRHeap::initArena(char**, unsigned long*, int) { - /* Nonmatching */ +bool JKRHeap::initArena(char** memory, u32* size, int maxHeaps) { + void* ram_start; + void* ram_end; + void* arenaStart; + + void* arenaLo = OSGetArenaLo(); + void* arenaHi = OSGetArenaHi(); + if (arenaLo == arenaHi) + return false; + + arenaStart = OSInitAlloc(arenaLo, arenaHi, maxHeaps); + ram_start = OSRoundUpPtr(arenaStart, 0x20); + ram_end = OSRoundDownPtr(arenaHi, 0x20); + + OSBootInfo* codeStart = (OSBootInfo*)OSPhysicalToCached(0); + mCodeStart = codeStart; + mCodeEnd = ram_start; + + mUserRamStart = ram_start; + mUserRamEnd = ram_end; + mMemorySize = codeStart->memory_size; + + OSSetArenaLo(ram_end); + OSSetArenaHi(ram_end); + + *memory = (char*)ram_start; + *size = (u32)ram_end - (u32)ram_start; + return true; } /* 802B03E8-802B03F8 .text becomeSystemHeap__7JKRHeapFv */ -void JKRHeap::becomeSystemHeap() { - /* Nonmatching */ +JKRHeap* JKRHeap::becomeSystemHeap() { + JKRHeap* prev = sSystemHeap; + sSystemHeap = this; + return prev; } /* 802B03F8-802B0408 .text becomeCurrentHeap__7JKRHeapFv */ -void JKRHeap::becomeCurrentHeap() { - /* Nonmatching */ +JKRHeap* JKRHeap::becomeCurrentHeap() { + JKRHeap* prev = sCurrentHeap; + sCurrentHeap = this; + return prev; } /* 802B0408-802B0434 .text destroy__7JKRHeapFv */ void JKRHeap::destroy() { - /* Nonmatching */ + do_destroy(); } /* 802B0434-802B0494 .text alloc__7JKRHeapFUliP7JKRHeap */ -void JKRHeap::alloc(unsigned long, int, JKRHeap*) { - /* Nonmatching */ +void* JKRHeap::alloc(u32 size, int alignment, JKRHeap* heap) { + if (heap != NULL) { + return heap->alloc(size, alignment); + } + + if (sCurrentHeap != NULL) { + return sCurrentHeap->alloc(size, alignment); + } + + return NULL; +} + +static void dummy1(JKRHeap* heap) { + JUT_ASSERT(0, heap != 0); } /* 802B0494-802B0518 .text alloc__7JKRHeapFUli */ -void JKRHeap::alloc(unsigned long, int) { - /* Nonmatching */ +void* JKRHeap::alloc(u32 size, int alignment) { + if (mInitFlag) { + JUT_WARN(308, "alloc %x byte in heap %x", size, this); + } + return do_alloc(size, alignment); } /* 802B0518-802B0560 .text free__7JKRHeapFPvP7JKRHeap */ -void JKRHeap::free(void*, JKRHeap*) { - /* Nonmatching */ +void JKRHeap::free(void* ptr, JKRHeap* heap) { + if (!heap) { + heap = findFromRoot(ptr); + if (!heap) + return; + } + + heap->free(ptr); } /* 802B0560-802B05DC .text free__7JKRHeapFPv */ -void JKRHeap::free(void*) { - /* Nonmatching */ +void JKRHeap::free(void* ptr) { + if (mInitFlag) { + JUT_WARN(356, "free %x in heap %x", ptr, this); + } + do_free(ptr); } /* 802B05DC-802B0634 .text callAllDisposer__7JKRHeapFv */ void JKRHeap::callAllDisposer() { - /* Nonmatching */ + JSUListIterator iterator; + + while ((iterator = mDisposerList.getFirst()) != mDisposerList.getEnd()) { + iterator->~JKRDisposer(); + } } /* 802B0634-802B069C .text freeAll__7JKRHeapFv */ void JKRHeap::freeAll() { - /* Nonmatching */ + if (mInitFlag) { + JUT_WARN(408, "freeAll in heap %x", this); + } + do_freeAll(); } /* 802B069C-802B0704 .text freeTail__7JKRHeapFv */ void JKRHeap::freeTail() { - /* Nonmatching */ + if (mInitFlag) { + JUT_WARN(422, "freeTail in heap %x", this); + } + do_freeTail(); } /* 802B0704-802B0764 .text resize__7JKRHeapFPvUlP7JKRHeap */ -void JKRHeap::resize(void*, unsigned long, JKRHeap*) { - /* Nonmatching */ +s32 JKRHeap::resize(void* ptr, u32 size, JKRHeap* heap) { + if (!heap) { + heap = findFromRoot(ptr); + if (!heap) + return -1; + } + + return heap->resize(ptr, size); } /* 802B0764-802B07EC .text resize__7JKRHeapFPvUl */ -void JKRHeap::resize(void*, unsigned long) { - /* Nonmatching */ +s32 JKRHeap::resize(void* ptr, u32 size) { + if (mInitFlag) { + JUT_WARN(466, "resize block %x into %x in heap %x", ptr, size, this); + } + return do_resize(ptr, size); } /* 802B07EC-802B083C .text getSize__7JKRHeapFPvP7JKRHeap */ -void JKRHeap::getSize(void*, JKRHeap*) { - /* Nonmatching */ +s32 JKRHeap::getSize(void* ptr, JKRHeap* heap) { + if (!heap) { + heap = findFromRoot(ptr); + if (!heap) + return -1; + } + + return heap->getSize(ptr); } /* 802B083C-802B0868 .text getSize__7JKRHeapFPv */ -void JKRHeap::getSize(void*) { - /* Nonmatching */ +s32 JKRHeap::getSize(void* ptr) { + return do_getSize(ptr); } /* 802B0868-802B0894 .text getFreeSize__7JKRHeapFv */ -void JKRHeap::getFreeSize() { - /* Nonmatching */ +s32 JKRHeap::getFreeSize() { + return do_getFreeSize(); } /* 802B0894-802B08C0 .text getMaxFreeBlock__7JKRHeapFv */ -void JKRHeap::getMaxFreeBlock() { - /* Nonmatching */ +void* JKRHeap::getMaxFreeBlock() { + return do_getMaxFreeBlock(); } /* 802B08C0-802B08EC .text getTotalFreeSize__7JKRHeapFv */ -void JKRHeap::getTotalFreeSize() { - /* Nonmatching */ +s32 JKRHeap::getTotalFreeSize() { + return do_getTotalFreeSize(); } /* 802B08EC-802B0918 .text getCurrentGroupId__7JKRHeapFv */ -void JKRHeap::getCurrentGroupId() { - /* Nonmatching */ +u8 JKRHeap::getCurrentGroupId() { + return do_getCurrentGroupId(); +} + +static void dummy2() { + OSReport("change heap ID into %x in heap %x"); } /* 802B0918-802B0978 .text getMaxAllocatableSize__7JKRHeapFi */ -void JKRHeap::getMaxAllocatableSize(int) { - /* Nonmatching */ +u32 JKRHeap::getMaxAllocatableSize(int alignment) { + u32 maxFreeBlock = (u32)getMaxFreeBlock(); + u32 ptrOffset = (alignment - 1) & alignment - (maxFreeBlock & 0xf); + return ~(alignment - 1) & (getFreeSize() - ptrOffset); } /* 802B0978-802B09B0 .text findFromRoot__7JKRHeapFPv */ -void JKRHeap::findFromRoot(void*) { - /* Nonmatching */ +JKRHeap* JKRHeap::findFromRoot(void* ptr) { + if (sRootHeap) { + return sRootHeap->find(ptr); + } + + return NULL; } /* 802B09B0-802B0A58 .text find__7JKRHeapCFPv */ -void JKRHeap::find(void*) const { - /* Nonmatching */ +JKRHeap* JKRHeap::find(void* memory) const { + if (mStart <= memory && memory < mEnd) { + if (mChildTree.getNumChildren() != 0) { + for (JSUTreeIterator iterator(mChildTree.getFirstChild()); + iterator != mChildTree.getEndChild(); ++iterator) + { + JKRHeap* result = iterator->find(memory); + if (result) { + return result; + } + } + } + + return const_cast(this); + } + + return NULL; } /* 802B0A58-802B0AEC .text dispose_subroutine__7JKRHeapFUlUl */ -void JKRHeap::dispose_subroutine(unsigned long, unsigned long) { - /* Nonmatching */ +void JKRHeap::dispose_subroutine(u32 begin, u32 end) { + JSUListIterator last_iterator; + JSUListIterator next_iterator; + JSUListIterator iterator; + + for (iterator = mDisposerList.getFirst(); iterator != mDisposerList.getEnd(); + iterator = next_iterator) + { + JKRDisposer* disposer = iterator.getObject(); + + if ((void*)begin <= disposer && disposer < (void*)end) { + disposer->~JKRDisposer(); + + if (last_iterator == NULL) { + next_iterator = mDisposerList.getFirst(); + } else { + next_iterator = last_iterator; + next_iterator++; + } + } else { + last_iterator = iterator; + next_iterator = iterator; + next_iterator++; + } + } } /* 802B0AEC-802B0B14 .text dispose__7JKRHeapFPvUl */ -void JKRHeap::dispose(void*, unsigned long) { - /* Nonmatching */ +bool JKRHeap::dispose(void* ptr, u32 size) { + dispose_subroutine((u32)ptr, (u32)ptr + size); + return false; } /* 802B0B14-802B0B34 .text dispose__7JKRHeapFPvPv */ -void JKRHeap::dispose(void*, void*) { - /* Nonmatching */ +void JKRHeap::dispose(void* begin, void* end) { + dispose_subroutine((u32)begin, (u32)end); } /* 802B0B34-802B0B8C .text dispose__7JKRHeapFv */ void JKRHeap::dispose() { - /* Nonmatching */ + JSUListIterator iterator; + while ((iterator = mDisposerList.getFirst()) != mDisposerList.getEnd()) { + iterator->~JKRDisposer(); + } } /* 802B0B8C-802B0BB4 .text copyMemory__7JKRHeapFPvPvUl */ -void JKRHeap::copyMemory(void*, void*, unsigned long) { - /* Nonmatching */ +void JKRHeap::copyMemory(void* dst, void* src, u32 size) { + u32 count = (size + 3) / 4; + + u32* dst_32 = (u32*)dst; + u32* src_32 = (u32*)src; + while (count > 0) { + *dst_32 = *src_32; + dst_32++; + src_32++; + count--; + } } /* 802B0BB4-802B0C08 .text JKRDefaultMemoryErrorRoutine__FPvUli */ -void JKRDefaultMemoryErrorRoutine(void*, unsigned long, int) { - /* Nonmatching */ +void JKRDefaultMemoryErrorRoutine(void* heap, u32 size, int alignment) { + OSReport("Error: Cannot allocate memory %d(0x%x)byte in %d byte alignment from %08x\n", size, size, alignment, heap); + OSPanic(__FILE__, 767, "abort\n"); } /* 802B0C08-802B0C18 .text setErrorFlag__7JKRHeapFb */ -void JKRHeap::setErrorFlag(bool) { - /* Nonmatching */ +bool JKRHeap::setErrorFlag(bool errorFlag) { + bool prev = mErrorFlag; + mErrorFlag = errorFlag; + return prev; } /* 802B0C18-802B0C38 .text setErrorHandler__7JKRHeapFPFPvUli_v */ -void JKRHeap::setErrorHandler(void (*)(void*, unsigned long, int)) { - /* Nonmatching */ +JKRErrorHandler JKRHeap::setErrorHandler(JKRErrorHandler errorHandler) { + JKRErrorHandler prev = mErrorHandler; + + if (!errorHandler) { + errorHandler = JKRDefaultMemoryErrorRoutine; + } + + mErrorHandler = errorHandler; + return prev; } /* 802B0C38-802B0C60 .text __nw__FUl */ -void operator new(unsigned long) { - /* Nonmatching */ +void* operator new(size_t size) { + return JKRHeap::alloc(size, 4, NULL); } /* 802B0C60-802B0C84 .text __nw__FUli */ -void operator new(unsigned long, int) { - /* Nonmatching */ +void* operator new(size_t size, int alignment) { + return JKRHeap::alloc(size, alignment, NULL); } /* 802B0C84-802B0CB0 .text __nw__FUlP7JKRHeapi */ -void operator new(unsigned long, JKRHeap*, int) { - /* Nonmatching */ +void* operator new(size_t size, JKRHeap* heap, int alignment) { + return JKRHeap::alloc(size, alignment, heap); } /* 802B0CB0-802B0CD8 .text __nwa__FUl */ -void operator new[](unsigned long) { - /* Nonmatching */ +void* operator new[](size_t size) { + return JKRHeap::alloc(size, 4, NULL); } /* 802B0CD8-802B0CFC .text __nwa__FUli */ -void operator new[](unsigned long, int) { - /* Nonmatching */ +void* operator new[](size_t size, int alignment) { + return JKRHeap::alloc(size, alignment, NULL); } /* 802B0CFC-802B0D28 .text __nwa__FUlP7JKRHeapi */ -void operator new[](unsigned long, JKRHeap*, int) { - /* Nonmatching */ +void* operator new[](size_t size, JKRHeap* heap, int alignment) { + return JKRHeap::alloc(size, alignment, heap); } /* 802B0D28-802B0D4C .text __dl__FPv */ -void operator delete(void*) { - /* Nonmatching */ +void operator delete(void* ptr) { + JKRHeap::free(ptr, NULL); } /* 802B0D4C-802B0D70 .text __dla__FPv */ -void operator delete[](void*) { - /* Nonmatching */ +void operator delete[](void* ptr) { + JKRHeap::free(ptr, NULL); +} + +static void dummy3() { +#if VERSION != VERSION_JPN + OSReport("\x1B[41;37m:::addr %08x size %08x: Freeされた領域が浸食されている (%08x=%02x)\n\x1B[m"); +#endif + OSReport("%s"); + OSReport("heap unchanged"); + OSReport("**** heap changed ****"); + OSReport("location : [%s:%d]"); + OSReport("**** heap changed : old ****"); + OSReport("**** heap changed : new ****"); } /* 802B0D70-802B0E14 .text state_register__7JKRHeapCFPQ27JKRHeap6TStateUl */ -void JKRHeap::state_register(JKRHeap::TState*, unsigned long) const { - /* Nonmatching */ +void JKRHeap::state_register(JKRHeap::TState* p, u32 id) const { +#if VERSION == VERSION_JP + JUT_ASSERT(1034, p != 0); + JUT_ASSERT(1035, p->getHeap() == this); +#else + JUT_ASSERT(1090, p != 0); + JUT_ASSERT(1091, p->getHeap() == this); +#endif } /* 802B0E14-802B0E9C .text state_compare__7JKRHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */ -void JKRHeap::state_compare(const JKRHeap::TState&, const JKRHeap::TState&) const { - /* Nonmatching */ +bool JKRHeap::state_compare(const JKRHeap::TState& r1, const JKRHeap::TState& r2) const { +#if VERSION == VERSION_JP + JUT_ASSERT(1043, r1.getHeap() == r2.getHeap()); +#else + JUT_ASSERT(1099, r1.getHeap() == r2.getHeap()); +#endif + return r1.getCheckCode() == r2.getCheckCode(); +} + +static void dummy4() { + OSReport("heap : %p / %p"); + OSReport("check-code : 0x%08x / 0x%08x"); + OSReport("id : 0x%08x / 0x%08x"); + OSReport("used size : %10u / %10u"); } /* 802B0E9C-802B0F24 .text state_dump__7JKRHeapCFRCQ27JKRHeap6TState */ -void JKRHeap::state_dump(const JKRHeap::TState&) const { - /* Nonmatching */ +void JKRHeap::state_dump(const JKRHeap::TState& p) const { +#if VERSION == VERSION_JP + JUT_LOG(1067, "check-code : 0x%08x", p.getCheckCode()); + JUT_LOG(1068, "id : 0x%08x", p.getId()); + JUT_LOG(1069, "used size : %u", p.getUsedSize()); +#else + JUT_LOG(1123, "check-code : 0x%08x", p.getCheckCode()); + JUT_LOG(1124, "id : 0x%08x", p.getId()); + JUT_LOG(1125, "used size : %u", p.getUsedSize()); +#endif } /* 802B0F24-802B0F2C .text do_changeGroupID__7JKRHeapFUc */ -void JKRHeap::do_changeGroupID(unsigned char) { - /* Nonmatching */ +s32 JKRHeap::do_changeGroupID(u8 param_0) { + return 0; } /* 802B0F2C-802B0F34 .text do_getCurrentGroupId__7JKRHeapFv */ -void JKRHeap::do_getCurrentGroupId() { - /* Nonmatching */ +u8 JKRHeap::do_getCurrentGroupId() { + return 0; } + +#if VERSION == VERSION_JP +static void dummy5() { + OSReport("\x1B[41;37m:::addr %08x size %08x: Freeされた領域が浸食されている (%08x=%02x)\n\x1B[m"); +} +#endif diff --git a/src/JSystem/JUtility/JUTResFont.cpp b/src/JSystem/JUtility/JUTResFont.cpp index c9cb9e305..135861bce 100644 --- a/src/JSystem/JUtility/JUTResFont.cpp +++ b/src/JSystem/JUtility/JUTResFont.cpp @@ -4,104 +4,457 @@ // #include "JSystem/JUtility/JUTResFont.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "JSystem/JUtility/JUTConsole.h" +#include "dolphin/gx/GX.h" #include "dolphin/types.h" +// Only used for an assert +#define suAboutEncoding_ 3 + +IsLeadByte_func const JUTResFont::saoAboutEncoding_[3] = { + isLeadByte_1Byte, + isLeadByte_2Byte, + isLeadByte_ShiftJIS, +}; + /* 802C2044-802C2090 .text __ct__10JUTResFontFv */ JUTResFont::JUTResFont() { - /* Nonmatching */ + initialize_state(); + JUTFont::initialize_state(); } /* 802C2090-802C20F4 .text __ct__10JUTResFontFPC7ResFONTP7JKRHeap */ -JUTResFont::JUTResFont(const ResFONT*, JKRHeap*) { - /* Nonmatching */ +JUTResFont::JUTResFont(const ResFONT* pFont, JKRHeap* pHeap) { + initialize_state(); + initiate(pFont, pHeap); } /* 802C20F4-802C2180 .text __dt__10JUTResFontFv */ JUTResFont::~JUTResFont() { - /* Nonmatching */ + if (mValid) { + delete_and_initialize(); + JUTFont::initialize_state(); + } } /* 802C2180-802C21A4 .text deleteMemBlocks_ResFont__10JUTResFontFv */ void JUTResFont::deleteMemBlocks_ResFont() { - /* Nonmatching */ + delete[] mpMemBlocks; } /* 802C21A4-802C21D0 .text initialize_state__10JUTResFontFv */ void JUTResFont::initialize_state() { - /* Nonmatching */ + mResFont = NULL; + mpMemBlocks = NULL; + mpWidthBlocks = NULL; + mpGlyphBlocks = NULL; + mpMapBlocks = NULL; + mWidth = 0; + mHeight = 0; + mTexPageIdx = -1; } /* 802C21D0-802C2230 .text initiate__10JUTResFontFPC7ResFONTP7JKRHeap */ -void JUTResFont::initiate(const ResFONT*, JKRHeap*) { - /* Nonmatching */ +bool JUTResFont::initiate(const ResFONT* pFont, JKRHeap* pHeap) { + u8 initiated = protected_initiate(pFont, pHeap); + if (!initiated) { + delete_and_initialize(); + JUTFont::initialize_state(); + mValid = false; + return false; + } + return true; } /* 802C2230-802C233C .text protected_initiate__10JUTResFontFPC7ResFONTP7JKRHeap */ -void JUTResFont::protected_initiate(const ResFONT*, JKRHeap*) { - /* Nonmatching */ +bool JUTResFont::protected_initiate(const ResFONT* pFont, JKRHeap* pHeap) { + delete_and_initialize(); + JUTFont::initialize_state(); + if (pFont == NULL) { + return false; + } + mResFont = pFont; + mValid = true; + countBlock(); + + u32 blockNum = mWidthBlockNum + mGlyphBlockNum + mMapBlockNum; + mpMemBlocks = new (pHeap, 0) void*[blockNum]; + + void** block = mpMemBlocks; + + if (block == NULL) { + return false; + } else { + if (mWidthBlockNum != 0) { + mpWidthBlocks = (ResFONT::WID1**)block; + block += mWidthBlockNum; + } + if (mGlyphBlockNum != 0) { + mpGlyphBlocks = (ResFONT::GLY1**)block; + block += mGlyphBlockNum; + } + if (mMapBlockNum != 0) { + mpMapBlocks = (ResFONT::MAP1**)block; + } + setBlock(); + return true; + } } /* 802C233C-802C2438 .text countBlock__10JUTResFontFv */ void JUTResFont::countBlock() { - /* Nonmatching */ + mWidthBlockNum = 0; + mGlyphBlockNum = 0; + mMapBlockNum = 0; + + const BlockHeader* header = (BlockHeader*)mResFont->data; + for (u32 i = 0; i < mResFont->numBlocks; i++, header = header->getNext()) { + switch (header->magic) { + case 'WID1': + mWidthBlockNum++; + break; + case 'GLY1': + mGlyphBlockNum++; + break; + case 'MAP1': + mMapBlockNum++; + break; + case 'INF1': + break; + default: + JUTReportConsole("JUTResFont: Unknown data block\n"); + } + } } /* 802C2438-802C25C0 .text setBlock__10JUTResFontFv */ void JUTResFont::setBlock() { - /* Nonmatching */ + int widthNum = 0; + int glyphNum = 0; + int mapNum = 0; + mMaxCode = -1; + + const BlockHeader* header = (BlockHeader*)mResFont->data; + for (u32 i = 0; i < mResFont->numBlocks; i++, header = header->getNext()) { + switch (header->magic) { + case 'INF1': + mInfoBlock = (ResFONT::INF1*)header; + u32 u = mInfoBlock->fontType; + JUT_ASSERT(0xF3, u < suAboutEncoding_) + mIsLeadByte = (IsLeadByte_func*)&saoAboutEncoding_[u]; + break; + case 'WID1': + mpWidthBlocks[widthNum] = (ResFONT::WID1*)header; + widthNum++; + break; + case 'GLY1': + mpGlyphBlocks[glyphNum] = (ResFONT::GLY1*)header; + glyphNum++; + break; + case 'MAP1': + mpMapBlocks[mapNum] = (ResFONT::MAP1*)header; + if (mMaxCode > mpMapBlocks[mapNum]->startCode) { + mMaxCode = mpMapBlocks[mapNum]->startCode; + } + mapNum++; + break; + default: + JUTReportConsole("Unknown data block\n"); + break; + } + } } /* 802C25C0-802C26B8 .text setGX__10JUTResFontFv */ void JUTResFont::setGX() { - /* Nonmatching */ + GXSetNumChans(1); + GXSetNumTevStages(1); + GXSetNumTexGens(1); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); + GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE); + GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); } /* 802C26B8-802C28F8 .text setGX__10JUTResFontFQ28JUtility6TColorQ28JUtility6TColor */ -void JUTResFont::setGX(JUtility::TColor, JUtility::TColor) { - /* Nonmatching */ +void JUTResFont::setGX(JUtility::TColor col1, JUtility::TColor col2) { + if (col1 == 0 && col2 == -1) { + setGX(); + } else { + GXSetNumChans(1); + GXSetNumTevStages(2); + GXSetNumTexGens(1); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_VTX, 0, GX_DF_NONE, GX_AF_NONE); + GXSetTevColor(GX_TEVREG0, col1); + GXSetTevColor(GX_TEVREG1, col2); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_C1, GX_CC_TEXC, GX_CC_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_A1, GX_CA_TEXA, GX_CA_ZERO); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV); + GXSetTevOrder(GX_TEVSTAGE1, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); + GXSetTevColorIn(GX_TEVSTAGE1, GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO); + GXSetTevColorOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV); + GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 15); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + } } /* 802C28F8-802C2D6C .text drawChar_scale__10JUTResFontFffffib */ -void JUTResFont::drawChar_scale(float, float, float, float, int, bool) { +f32 JUTResFont::drawChar_scale(f32 posX, f32 posY, f32 scaleX, f32 scaleY, int chr, bool flag) { /* Nonmatching */ + JUTFont::TWidth width; + f32 posMinX; + f32 posMinY; + f32 scaledHeight; + f32 posMaxX; + + JUT_ASSERT(0x179, mValid) + loadFont(chr, GX_TEXMAP0, &width); + + if (mFixed || !flag) { + posMinX = posX; + } else { + posMinX = (posX - width.field_0x0 * (scaleX / getCellWidth())); + } + f32 retval = mFixedWidth * (scaleX / getCellWidth()); + if (!mFixed) { + if (!flag) { + retval = (width.field_0x1 + width.field_0x0) * (scaleX / getCellWidth()); + } else { + retval = width.field_0x1 * (scaleX / getCellWidth()); + } + } + posMaxX = posMinX + scaleX; + posMinY = posY - getAscent() * (scaleY / getHeight()); + scaledHeight = scaleY / getHeight(); + f32 descent = getDescent(); + f32 posMaxY = descent * scaledHeight + posY; + + // Glyph details + ResFONT::GLY1* used_glyphs = mpGlyphBlocks[field_0x66]; + u16 texWidth = used_glyphs->textureWidth; + u16 texHeight = used_glyphs->textureHeight; + int tWidth = mWidth; + int tHeight = mHeight; + int shiftWidth = (tWidth + used_glyphs->cellWidth) << 15; + int texMinX = (tWidth << 15) / texWidth; + int texMinY = (tHeight << 15) / texHeight; + int shiftHeight = (tHeight + used_glyphs->cellHeight) << 15; + s32 texMaxX = shiftWidth / texWidth; + s32 texMaxY = shiftHeight / texHeight; + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + + // Bottom Left + GXPosition3f32(posMinX, posMinY, 0.0f); + GXColor1u32(mColor1); + GXTexCoord2s16(texMinX, texMinY); + + // Bottom Right + GXPosition3f32(posMaxX, posMinY, 0.0f); + GXColor1u32(mColor2); + GXTexCoord2s16(texMaxX, texMinY); + + // Top Right + GXPosition3f32(posMaxX, posMaxY, 0.0f); + GXColor1u32(mColor4); + GXTexCoord2s16(texMaxX, texMaxY); + + // Top Left + GXPosition3f32(posMinX, posMaxY, 0.0f); + GXColor1u32(mColor3); + GXTexCoord2s16(texMinX, texMaxY); + + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); + + return retval; } /* 802C2D6C-802C2DE8 .text loadFont__10JUTResFontFi11_GXTexMapIDPQ27JUTFont6TWidth */ -void JUTResFont::loadFont(int, _GXTexMapID, JUTFont::TWidth*) { - /* Nonmatching */ +void JUTResFont::loadFont(int code, _GXTexMapID texMapID, JUTFont::TWidth* pDstWidth) { + if (pDstWidth) { + getWidthEntry(code, pDstWidth); + } + u32 fontCode = getFontCode(code); + loadImage(fontCode, texMapID); } /* 802C2DE8-802C2E90 .text getWidthEntry__10JUTResFontCFiPQ27JUTFont6TWidth */ -void JUTResFont::getWidthEntry(int, JUTFont::TWidth*) const { +void JUTResFont::getWidthEntry(int code, JUTFont::TWidth* width) const { /* Nonmatching */ + int fontCode = getFontCode(code); + width->field_0x0 = 0; + width->field_0x1 = mInfoBlock->width; + + for (int i = 0; i < mWidthBlockNum; i++) { + ResFONT::WID1* block = mpWidthBlocks[i]; + if (block->startCode <= fontCode && fontCode <= block->endCode) { + int chunkNum = (fontCode - mpWidthBlocks[i]->startCode) * 2; + u8* ptr = &mpWidthBlocks[i]->mChunkNum[chunkNum]; + width->field_0x0 = ptr[0]; + width->field_0x1 = ptr[1]; + break; + } + } } /* 802C2E90-802C2EDC .text getCellWidth__10JUTResFontCFv */ -void JUTResFont::getCellWidth() const { - /* Nonmatching */ +int JUTResFont::getCellWidth() const { + if (mpGlyphBlocks) { + ResFONT::GLY1* glyph = *mpGlyphBlocks; + if (glyph) { + return glyph->cellWidth; + } + } + return getWidth(); } /* 802C2EDC-802C2F28 .text getCellHeight__10JUTResFontCFv */ -void JUTResFont::getCellHeight() const { - /* Nonmatching */ +s32 JUTResFont::getCellHeight() const { + if (mpGlyphBlocks) { + ResFONT::GLY1* glyph = *mpGlyphBlocks; + if (glyph) { + return glyph->cellHeight; + } + } + return getHeight(); } /* 802C2F28-802C2F5C .text isLeadByte__10JUTResFontCFi */ -void JUTResFont::isLeadByte(int) const { - /* Nonmatching */ +bool JUTResFont::isLeadByte(int chr) const { + return (*mIsLeadByte)(chr); } /* 802C2F5C-802C30E4 .text getFontCode__10JUTResFontCFi */ -void JUTResFont::getFontCode(int) const { +int JUTResFont::getFontCode(int chr) const { /* Nonmatching */ + static const u16 halftofull[95] = { + 0x8140, 0x8149, 0x8168, 0x8194, 0x8190, 0x8193, 0x8195, 0x8166, 0x8169, 0x816A, 0x8196, + 0x817B, 0x8143, 0x817C, 0x8144, 0x815E, 0x824F, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, + 0x8255, 0x8256, 0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148, 0x8197, + 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8268, 0x8269, 0x826A, + 0x826B, 0x826C, 0x826D, 0x826E, 0x826F, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, + 0x8276, 0x8277, 0x8278, 0x8279, 0x816D, 0x818F, 0x816E, 0x814F, 0x8151, 0x8165, 0x8281, + 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287, 0x8288, 0x8289, 0x828A, 0x828B, 0x828C, + 0x828D, 0x828E, 0x828F, 0x8290, 0x8291, 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, + 0x8298, 0x8299, 0x829A, 0x816F, 0x8162, 0x8170, 0x8160, + }; + + int ret = mInfoBlock->defaultCode; + if ((getFontType() == 2) && (mMaxCode >= 0x8000u) && (chr >= 0x20) && (chr < 0x7Fu)) { + chr = halftofull[chr - 32]; + } + int j = 0; + for (int i = mMapBlockNum; i > 0; j++, i--) { + if ((mpMapBlocks[j]->startCode <= chr) && (chr <= mpMapBlocks[j]->endCode)) { + ResFONT::MAP1* map = mpMapBlocks[j]; + if (map->mappingMethod == 0) { + ret = chr - map->startCode; + break; + } else if (map->mappingMethod == 2) { + ret = *(&mpMapBlocks[j]->mLeading + ((chr - mpMapBlocks[j]->startCode))); + break; + } else if (map->mappingMethod == 3) { + u16* leading_temp = &map->mLeading; + int phi_r5 = 0; + int phi_r6_2 = map->numEntries - 1; + + while (phi_r6_2 >= phi_r5) { + u32 temp_r3 = phi_r6_2 + phi_r5; + int temp_r7 = (int)((temp_r3 >> 0x1FU) + phi_r6_2 + phi_r5) >> 1; + + if (chr < leading_temp[temp_r7 * 2]) { + phi_r6_2 = temp_r7 - 1; + continue; + } + + if (chr > leading_temp[temp_r7 * 2]) { + phi_r5 = temp_r7 + 1; + continue; + } + + ret = leading_temp[temp_r7 * 2 + 1]; + break; + } + } else if (map->mappingMethod == 1) { + u16* phi_r5_2 = NULL; + if (map->numEntries == 1) { + phi_r5_2 = &map->mLeading; + } + ret = JUTResFont::convertSjis(chr, phi_r5_2); + break; + } + break; + } + } + return ret; } /* 802C30E4-802C3248 .text loadImage__10JUTResFontFi11_GXTexMapID */ -void JUTResFont::loadImage(int, _GXTexMapID) { - /* Nonmatching */ +void JUTResFont::loadImage(int code, _GXTexMapID id) { + int i = 0; + for (; i < mGlyphBlockNum; i++) { + if (mpGlyphBlocks[i]->startCode <= code && code <= mpGlyphBlocks[i]->endCode) { + code -= mpGlyphBlocks[i]->startCode; + break; + } + } + + if (i == mGlyphBlockNum) + return; + + s32 pageNumCells = mpGlyphBlocks[i]->numRows * mpGlyphBlocks[i]->numColumns; + s32 pageIdx = code / pageNumCells; + s32 cellIdxInPage = code % pageNumCells; + s32 cellCol = (cellIdxInPage % mpGlyphBlocks[i]->numRows); + s32 cellRow = (cellIdxInPage / mpGlyphBlocks[i]->numRows); + mWidth = cellCol * mpGlyphBlocks[i]->cellWidth; + mHeight = cellRow * mpGlyphBlocks[i]->cellHeight; + + if (pageIdx != mTexPageIdx || i != field_0x66) { + GXInitTexObj(&field_0x24, &mpGlyphBlocks[i]->data[pageIdx * mpGlyphBlocks[i]->textureSize], + mpGlyphBlocks[i]->textureWidth, mpGlyphBlocks[i]->textureHeight, + (GXTexFmt)mpGlyphBlocks[i]->textureFormat, GX_CLAMP, GX_CLAMP, 0); + + GXInitTexObjLOD(&field_0x24, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1); + mTexPageIdx = pageIdx; + field_0x66 = i; + } + + GXLoadTexObj(&field_0x24, id); } /* 802C3248-802C328C .text convertSjis__10JUTResFontCFiPUs */ -void JUTResFont::convertSjis(int, unsigned short*) const { +int JUTResFont::convertSjis(int inChar, u16* inLead) const { /* Nonmatching */ + int outChar = (u8)inChar; + inChar = inChar >> 8 & 0xFF; + outChar -= 0x40; + if (0x40 <= outChar) { + outChar--; + } + u16 lead = 0x31C; + if (inLead) { + lead = *inLead; + } + return outChar + (inChar - 0x88) * 0xBC + -0x5E + lead; } diff --git a/src/d/actor/d_a_alldie.cpp b/src/d/actor/d_a_alldie.cpp index 588775553..35a965fa8 100644 --- a/src/d/actor/d_a_alldie.cpp +++ b/src/d/actor/d_a_alldie.cpp @@ -3,9 +3,10 @@ // Translation Unit: d_a_alldie.cpp // -#include "f_op/f_op_actor_mng.h" #include "JSystem/JKernel/JKRHeap.h" +#include "d/d_com_inf_game.h" #include "d/d_procname.h" +#include "f_op/f_op_actor_mng.h" enum { ACT_WAIT, @@ -25,12 +26,12 @@ public: public: u8 mAction; - u16 mTimer; + s16 mTimer; }; /* 00000078-00000084 .text getSwbit__10daAlldie_cFv */ u8 daAlldie_c::getSwbit() { - return fopAcM_GetParam(this) >> 0x8; + return fopAcM_GetParam(this) >> 0x8; } /* 00000084-0000008C .text actionWait__10daAlldie_cFv */ @@ -52,13 +53,11 @@ s32 daAlldie_c::actionCheck() { s32 daAlldie_c::actionTimer() { if (fopAcM_myRoomSearchEnemy(fopAcM_GetRoomNo(this))) { mAction = ACT_CHECK; + } else if (mTimer > 0) { + mTimer--; } else { - if (mTimer > 0) { - mTimer--; - } else { - mAction = ACT_WAIT; - dComIfGs_onSwitch(getSwbit(), fopAcM_GetRoomNo(this)); - } + mAction = ACT_WAIT; + dComIfGs_onSwitch(getSwbit(), fopAcM_GetRoomNo(this)); } return 1; } @@ -83,9 +82,7 @@ s32 daAlldie_c::execute() { s32 daAlldie_c::create() { fopAcM_SetupActor(this, daAlldie_c); - s8 roomNo = fopAcM_GetRoomNo(this); - - if (!dComIfGs_isSwitch(this->getSwbit(), roomNo)) { + if (!dComIfGs_isSwitch(getSwbit(), fopAcM_GetRoomNo(this))) { mAction = ACT_CHECK; } else { mAction = ACT_WAIT; @@ -100,29 +97,29 @@ s32 daAlldie_c::create() { } /* 000001BC-000001C4 .text daAlldie_Draw__FP10daAlldie_c */ -s32 daAlldie_Draw(daAlldie_c*) { +static s32 daAlldie_Draw(daAlldie_c*) { return 1; } /* 000001C4-000001E8 .text daAlldie_Execute__FP10daAlldie_c */ -s32 daAlldie_Execute(daAlldie_c* i_this) { +static s32 daAlldie_Execute(daAlldie_c* i_this) { i_this->execute(); return 1; } /* 000001E8-000001F0 .text daAlldie_IsDelete__FP10daAlldie_c */ -s32 daAlldie_IsDelete(daAlldie_c*) { +static s32 daAlldie_IsDelete(daAlldie_c*) { return 1; } /* 000001F0-00000220 .text daAlldie_Delete__FP10daAlldie_c */ -s32 daAlldie_Delete(daAlldie_c* i_this) { +static s32 daAlldie_Delete(daAlldie_c* i_this) { i_this->~daAlldie_c(); return 1; } /* 00000220-000002CC .text daAlldie_Create__FP10fopAc_ac_c */ -s32 daAlldie_Create(fopAc_ac_c* ac) { +static s32 daAlldie_Create(fopAc_ac_c* ac) { return ((daAlldie_c*)ac)->create(); } diff --git a/src/d/actor/d_a_andsw0.cpp b/src/d/actor/d_a_andsw0.cpp index 6b18cd745..6daa4fa2a 100644 --- a/src/d/actor/d_a_andsw0.cpp +++ b/src/d/actor/d_a_andsw0.cpp @@ -6,6 +6,7 @@ #include "JSystem/JKernel/JKRHeap.h" #include "f_op/f_op_actor_mng.h" #include "d/d_com_inf_game.h" +#include "d/d_procname.h" enum { ACT_ON_ALL = 0, @@ -19,76 +20,259 @@ enum { struct andsw0_class : public fopAc_ac_c { public: /* 0x290 */ u32 _pad[2]; - /* 0x298 */ u8 mAction; + /* 0x298 */ s8 mAction; /* 0x299 */ u8 mNumSwitchesToCheck; /* 0x29A */ u8 mBehaviorType; /* 0x29B */ u8 mSwitchToSet; /* 0x29C */ u8 mFirstSwitchToCheck; /* 0x29E */ u16 mTimer; - /* 0x2A0 */ u16 mEventMapToolNo; - /* 0x292 */ u8 mEventIdx; - /* 0x293 */ u8 mEventState; + /* 0x2A0 */ s16 mEventIdx; + /* 0x2A2 */ u8 mEventNo; + /* 0x2A3 */ s8 mEventState; }; -/* 00000078-00000080 .text daAndsw0_Draw__FP12andsw0_class */ -s32 daAndsw0_Draw(andsw0_class*) { +static s32 daAndsw0_Draw(andsw0_class*) { return 1; } -/* 00000080-000003C4 .text daAndsw0_check__FP12andsw0_class */ -void daAndsw0_check(andsw0_class*) { +static void daAndsw0_check(andsw0_class* i_this) { /* Nonmatching */ -} + u8 numToCheck = i_this->mNumSwitchesToCheck; + u32 switchIdxToCheck = i_this->mFirstSwitchToCheck ? i_this->mFirstSwitchToCheck : i_this->mSwitchToSet + 1; -/* 000003C4-0000044C .text bk_s_sub1__FPvPv */ -void bk_s_sub1(void*, void*) { - /* Nonmatching */ -} + switch(i_this->mAction) { + case ACT_ON_ALL: + for(int i = 0; i < numToCheck; i++) { + if(dComIfGs_isSwitch(switchIdxToCheck, i_this->current.roomNo) == false) { + break; + } -/* 0000044C-000004D4 .text bk_s_sub2__FPvPv */ -void bk_s_sub2(void*, void*) { - /* Nonmatching */ -} + if(i == numToCheck - 1) { + if(i_this->mBehaviorType != 3) { + dComIfGs_onSwitch(i_this->mSwitchToSet, i_this->current.roomNo); + } -/* 000004D4-0000055C .text bk_s_sub3__FPvPv */ -void bk_s_sub3(void*, void*) { - /* Nonmatching */ -} + switch(i_this->mBehaviorType) { + case 0: + i_this->mAction = ACT_WAIT; + break; + case 3: + i_this->mAction = ACT_TIMER_SET; + i_this->mTimer = 0x41; + break; + default: + i_this->mAction = ACT_OFF_ALL; + break; + } + } -/* 0000055C-000005D4 .text bb_s_sub__FPvPv */ -void bb_s_sub(void*, void*) { - /* Nonmatching */ -} + switchIdxToCheck += 1; + } -/* 000005D4-000006AC .text hajimari_actor_entry__FP12andsw0_class */ -s32 hajimari_actor_entry(andsw0_class*) { - /* Nonmatching */ -} + break; + case ACT_OFF_ALL: + switchIdxToCheck = i_this->mFirstSwitchToCheck ? i_this->mFirstSwitchToCheck : i_this->mSwitchToSet + 1; -/* 000006AC-0000081C .text hajimarinomori_check__FP12andsw0_class */ -void hajimarinomori_check(andsw0_class* i_this) { - if (i_this->mBehaviorType == 0) { - if (hajimari_actor_entry(i_this)) - i_this->mBehaviorType = 1; - } else { - if (dComIfGs_isEventBit(4)) { - // - } + for(int i = 0; i < numToCheck; i++) { + if(dComIfGs_isSwitch(switchIdxToCheck, i_this->current.roomNo) == false) { + dComIfGs_offSwitch(i_this->mSwitchToSet, i_this->current.roomNo); + i_this->mAction = ACT_ON_ALL; + break; + } + + switchIdxToCheck += 1; + } + + break; + case ACT_TIMER: + i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 0xF; + if(fopAcM_isSwitch(i_this, i_this->mSwitchToSet)) { + i_this->mAction = ACT_WAIT; + } + else { + for(int i = 0; i < numToCheck; i++) { + if(fopAcM_isSwitch(i_this, switchIdxToCheck)) { + i_this->mAction += 1; + break; + } + + switchIdxToCheck += 1; + } + } + + break; + case ACT_TIMER2: + i_this->mTimer -= 1; + if(i_this->mTimer == 0) { + for(int i = 0; i < numToCheck; i++) { + fopAcM_offSwitch(i_this, switchIdxToCheck); + switchIdxToCheck += 1; + } + + i_this->mAction = ACT_TIMER; + } + else { + switchIdxToCheck = i_this->mFirstSwitchToCheck ? i_this->mFirstSwitchToCheck : i_this->mSwitchToSet + 1; + + for(int i = 0; i < numToCheck; i++) { + if(fopAcM_isSwitch(i_this, switchIdxToCheck) == false) { + break; + } + + if(i == numToCheck - 1) { + fopAcM_onSwitch(i_this, i_this->mSwitchToSet); + i_this->mAction = ACT_WAIT; + } + + switchIdxToCheck += 1; + } + } + + break; + case ACT_TIMER_SET: + i_this->mTimer -= 1; + if(i_this->mTimer == 0) { + fopAcM_onSwitch(i_this, i_this->mSwitchToSet); + i_this->mAction = ACT_WAIT; + } + + break; + case ACT_WAIT: + default: + break; } } -/* 0000081C-00000914 .text event_start_check__FP12andsw0_class */ +static void* ac[7]; +static s32 check_count; + +static void* bk_s_sub1(void* i_this, void*) { + if(fopAcM_IsActor(i_this) && fopAcM_GetName(i_this) == 0xBE && (fopAcM_GetParam(i_this) & 0xF) == 7) { + s32 count = check_count; //regswaps without this + if(count < 2) { + ac[check_count] = i_this; + check_count++; + } + + return 0; + } + + return 0; +} + +static void* bk_s_sub2(void* i_this, void*) { + if(fopAcM_IsActor(i_this) && fopAcM_GetName(i_this) == 0xBE && (fopAcM_GetParam(i_this) & 0xF) == 4) { + s32 count = check_count; //regswaps without this + if(count == 2) { + ac[check_count] = i_this; + check_count++; + } + + return 0; + } + + return 0; +} + +static void* bk_s_sub3(void* i_this, void*) { + if(fopAcM_IsActor(i_this) && fopAcM_GetName(i_this) == 0xBE && (fopAcM_GetParam(i_this) & 0xF) == 5) { + s32 count = check_count; //regswaps without this + if(count < 5) { + ac[check_count] = i_this; + check_count++; + } + + return 0; + } + + return 0; +} + +static void* bb_s_sub(void* i_this, void*) { + if(fopAcM_IsActor(i_this) && fopAcM_GetName(i_this) == 0xB6) { + s32 count = check_count; //regswaps without this + if(count < 7) { + ac[check_count] = i_this; + check_count++; + } + + return 0; + } + + return 0; +} + +static s32 hajimari_actor_entry(andsw0_class* i_this) { + for(int i = 0; i < 7; i++) { + ac[i] = 0; + } + check_count = 0; + + i_fpcM_Search(&bk_s_sub1, i_this); + i_fpcM_Search(&bk_s_sub2, i_this); + i_fpcM_Search(&bk_s_sub3, i_this); + check_count = 5; + i_fpcM_Search(&bb_s_sub, i_this); + + for(int i = 0; i < 7; i++) { + if(ac[i] == 0) { + return 0; + } + } + + return 1; +} + +static void hajimarinomori_check(andsw0_class* i_this) { + /* Nonmatching */ + if (i_this->mBehaviorType == 0) { + if (hajimari_actor_entry(i_this)) { + i_this->mBehaviorType = 1; + } + } + else { + for(int i = 0; i < 7; i++) {} + + //looks like these have something to do with bk_class and bb_class (based on the 0xB6/0xBE proc names earlier) + //finishing this probably needs some work on those + if (dComIfGs_isEventBit(4)) { + fopAcM_delete((fopAc_ac_c*)ac[5]); + fopAcM_delete((fopAc_ac_c*)ac[6]); + //ac[3]->field_0x121C = 1; + //ac[4]->field_0x121C = 1; + + if (dComIfGs_isEventBit(0x301)) { + //ac[0]->field_0x121C = 1; + } + if (dComIfGs_isEventBit(0x480)) { + //ac[1]->field_0x121C = 1; + } + if (dComIfGs_isEventBit(0x301) && dComIfGs_isEventBit(0x480)) { + //ac[2]->field_0x121C = 1; + } + } + else { + //ac[0]->field_0x121C = 1; + //ac[1]->field_0x121C = 1; + } + } + + fopAcM_delete(i_this); +} + static void event_start_check(andsw0_class* i_this) { + /* Nonmatching */ switch (i_this->mEventState) { case 0: - default: if (i_this->mEventIdx != -1 && fopAcM_isSwitch(i_this, i_this->mSwitchToSet)) { if (i_this->mEvtInfo.i_checkCommandDemoAccrpt()) { i_this->mEventState++; } else { - fopAcM_orderOtherEventId(i_this, i_this->mEventIdx, i_this->mEventMapToolNo, 0xFFFF, 0, 1); + fopAcM_orderOtherEventId(i_this, i_this->mEventIdx, i_this->mEventNo, 0xFFFF, 0, 1); } } + + break; case 1: if (dComIfGp_evmng_endCheck(i_this->mEventIdx)) { dComIfGp_event_onEventFlag(8); @@ -98,8 +282,7 @@ static void event_start_check(andsw0_class* i_this) { } } -/* 00000914-00000964 .text daAndsw0_Execute__FP12andsw0_class */ -s32 daAndsw0_Execute(andsw0_class* i_this) { +static s32 daAndsw0_Execute(andsw0_class* i_this) { event_start_check(i_this); if (i_this->mNumSwitchesToCheck == 0xFF) hajimarinomori_check(i_this); @@ -108,18 +291,15 @@ s32 daAndsw0_Execute(andsw0_class* i_this) { return 1; } -/* 00000964-0000096C .text daAndsw0_IsDelete__FP12andsw0_class */ -s32 daAndsw0_IsDelete(andsw0_class*) { +static s32 daAndsw0_IsDelete(andsw0_class*) { return 1; } -/* 0000096C-00000974 .text daAndsw0_Delete__FP12andsw0_class */ -s32 daAndsw0_Delete(andsw0_class*) { +static s32 daAndsw0_Delete(andsw0_class*) { return 1; } -/* 00000974-00000A64 .text daAndsw0_Create__FP10fopAc_ac_c */ -s32 daAndsw0_Create(fopAc_ac_c* ac) { +static s32 daAndsw0_Create(fopAc_ac_c* ac) { fopAcM_SetupActor(ac, andsw0_class); andsw0_class * i_this = (andsw0_class *)ac; @@ -127,9 +307,9 @@ s32 daAndsw0_Create(fopAc_ac_c* ac) { i_this->mBehaviorType = (fopAcM_GetParam(ac) >> 8) & 0xFF; i_this->mSwitchToSet = (fopAcM_GetParam(ac) >> 24) & 0xFF; i_this->mFirstSwitchToCheck = (fopAcM_GetParam(ac) >> 16) & 0xFF; - i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 16; - i_this->mEventMapToolNo = i_this->orig.angle.x; - i_this->mEventIdx = dComIfGp_evmng_getEventIdx(NULL, i_this->mEventMapToolNo); + i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 0xF; + i_this->mEventNo = i_this->orig.angle.x; + i_this->mEventIdx = dComIfGp_evmng_getEventIdx(NULL, i_this->mEventNo); if (i_this->mBehaviorType == 2) i_this->mAction = ACT_TIMER; if (i_this->mFirstSwitchToCheck == 0xFF) @@ -142,3 +322,27 @@ s32 daAndsw0_Create(fopAc_ac_c* ac) { return cPhs_COMPLEATE_e; } +static actor_method_class l_daAndsw0_Method = { + (process_method_func)daAndsw0_Create, + (process_method_func)daAndsw0_Delete, + (process_method_func)daAndsw0_Execute, + (process_method_func)daAndsw0_IsDelete, + (process_method_func)daAndsw0_Draw, +}; + +extern actor_process_profile_definition g_profile_ANDSW0 = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_ANDSW0, + &g_fpcLf_Method.mBase, + sizeof(andsw0_class), + 0, + 0, + &g_fopAc_Method.base, + 0x0135, + &l_daAndsw0_Method, + 0x00040000, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e, +}; diff --git a/src/d/actor/d_a_kaji.cpp b/src/d/actor/d_a_kaji.cpp index d3f850ee1..c420f407e 100644 --- a/src/d/actor/d_a_kaji.cpp +++ b/src/d/actor/d_a_kaji.cpp @@ -3,41 +3,171 @@ // Translation Unit: d_a_kaji.cpp // -#include "d_a_kaji.h" +#include "f_op/f_op_actor_mng.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "m_Do/m_Do_mtx.h" +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" +#include "d/actor/d_a_obj_pirateship.h" +#include "d/d_procname.h" #include "dolphin/types.h" +extern dScnPly_reg_HIO_c g_regHIO; + +struct daKaji_c : fopAc_ac_c { +public: + BOOL CreateHeap(); + inline s32 _create(); + inline BOOL _delete(); + inline BOOL _execute(); + inline bool _draw(); + +public: + /* 0x290 */ request_of_phase_process_class mPhs; + /* 0x298 */ u8 pad[0x29C - 0x298]; + /* 0x29C */ mDoExt_McaMorf* mpMorf; + /* 0x2A0 */ Mtx mMtx; + + static const char M_arcname[]; +}; + +static daObjPirateship::Act_c* l_p_ship; + +const char daKaji_c::M_arcname[] = "Kaji"; + /* 00000078-00000098 .text CheckCreateHeap__FP10fopAc_ac_c */ -void CheckCreateHeap(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL CheckCreateHeap(fopAc_ac_c* i_this) { + return ((daKaji_c*)i_this)->CreateHeap(); } /* 00000098-000001F4 .text CreateHeap__8daKaji_cFv */ -void daKaji_c::CreateHeap() { - /* Nonmatching */ +BOOL daKaji_c::CreateHeap() { + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(M_arcname, 0x11); // asoda.bdl + JUT_ASSERT(0x55, modelData != 0); + + mpMorf = new mDoExt_McaMorf( + modelData, + NULL, NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("Kaji", 0xE), // kj_wait.bck + 2, 0.0f, 0, -1, 1, + dComIfG_getObjectRes("Kaji", 0x8), // kj_wait.bas + 0x00080000, + 0x11000002 + ); + + return mpMorf && mpMorf->getModel(); +} + +s32 daKaji_c::_create() { + fopAcM_SetupActor(this, daKaji_c); + + s32 phase_state = dComIfG_resLoad(&mPhs, M_arcname); + if (phase_state == cPhs_COMPLEATE_e) { + if (fopAcM_entrySolidHeap(this, (heapCallbackFunc)&CheckCreateHeap, 0x660)) { + mDoMtx_stack_c::transS(getPosition()); + mDoMtx_stack_c::YrotM(shape_angle.y); + mDoMtx_stack_c::scaleM(mScale.x, mScale.y, mScale.z); + MTXCopy(mDoMtx_stack_c::get(), mMtx); + + l_p_ship = (daObjPirateship::Act_c*)fopAcM_SearchByID(mParentPcId); + } else { + return cPhs_ERROR_e; + } + + fopAcM_SetMtx(this, mpMorf->getModel()->getBaseTRMtx()); + fopAcM_setCullSizeBox(this, -80.0f, -80.0f, -20.0f, 80.0f, 80.0f, 20.0f); + + MTXCopy(mpMorf->getModel()->getBaseTRMtx(), mMtx); + } + + return phase_state; +} + +BOOL daKaji_c::_delete() { + dComIfG_resDelete(&mPhs, M_arcname); + return TRUE; +} + +BOOL daKaji_c::_execute() { + // Copy the ship's transform (plus an offset) to the helm. + cXyz* offset = &cXyz(0.0f, 740.0f, -858.0f); + offset->y += g_regHIO.mChild[10].mFloatRegs[10]; + offset->z += g_regHIO.mChild[10].mFloatRegs[11]; + cMtx_multVec( l_p_ship->mpModel->getBaseTRMtx(), offset, ¤t.pos); + + daObjPirateship::Act_c* ship = l_p_ship; + shape_angle = ship->shape_angle; + current.angle = shape_angle; + + mpMorf->play(NULL, 0, 0); + + mpMorf->getModel()->setBaseScale(mScale); + PSMTXTrans(mDoMtx_stack_c::get(), current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); + + mpMorf->getModel()->i_setBaseTRMtx(mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), mMtx); + + return FALSE; +} + +bool daKaji_c::_draw() { + if (!l_p_ship->unk2CC) { + return true; + } + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, ¤t.pos, &mTevStr); + g_env_light.setLightTevColorType(mpMorf->getModel(), &mTevStr); + mpMorf->update(); + return true; } /* 000001F4-00000344 .text daKajiCreate__FPv */ -void daKajiCreate(void*) { - /* Nonmatching */ +static s32 daKajiCreate(void* i_this) { + return ((daKaji_c*)i_this)->_create(); } /* 00000344-00000374 .text daKajiDelete__FPv */ -void daKajiDelete(void*) { - /* Nonmatching */ +static BOOL daKajiDelete(void* i_this) { + return ((daKaji_c*)i_this)->_delete(); } /* 00000374-000004D4 .text daKajiExecute__FPv */ -void daKajiExecute(void*) { - /* Nonmatching */ +static BOOL daKajiExecute(void* i_this) { + return ((daKaji_c*)i_this)->_execute(); } /* 000004D4-00000568 .text daKajiDraw__FPv */ -void daKajiDraw(void*) { - /* Nonmatching */ +static BOOL daKajiDraw(void* i_this) { + return ((daKaji_c*)i_this)->_draw(); } /* 00000568-00000570 .text daKajiIsDelete__FPv */ -void daKajiIsDelete(void*) { - /* Nonmatching */ +static BOOL daKajiIsDelete(void* actor) { + return TRUE; } +static actor_method_class daKajiMethodTable = { + (process_method_func)daKajiCreate, + (process_method_func)daKajiDelete, + (process_method_func)daKajiExecute, + (process_method_func)daKajiIsDelete, + (process_method_func)daKajiDraw, +}; + +extern actor_process_profile_definition g_profile_Kaji = { + fpcLy_CURRENT_e, + 3, + fpcLy_CURRENT_e, + PROC_Kaji, + &g_fpcLf_Method.mBase, + sizeof(daKaji_c), + 0, + 0, + &g_fopAc_Method.base, + 0x01AC, + &daKajiMethodTable, + 0x00040100, + fopAc_ACTOR_e, + fopAc_CULLBOX_CUSTOM_e, +}; diff --git a/src/d/actor/d_a_obj_pirateship.cpp b/src/d/actor/d_a_obj_pirateship.cpp index 5c381a31d..7e0dac199 100644 --- a/src/d/actor/d_a_obj_pirateship.cpp +++ b/src/d/actor/d_a_obj_pirateship.cpp @@ -3,7 +3,7 @@ // Translation Unit: d_a_obj_pirateship.cpp // -#include "d_a_obj_pirateship.h" +#include "d/actor/d_a_obj_pirateship.h" #include "dolphin/types.h" /* 000000EC-000000FC .text ride_call_back__FP4dBgWP10fopAc_ac_cP10fopAc_ac_c */ diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 8daaed286..ad4681cc6 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -183,11 +183,11 @@ int dComIfG_play_c::getLayerNo(int i_roomNo) { int layer = dComIfGp_getStartStageLayer(); if (layer < 0) { - int hour = dKy_getdaytime_hour(); + layer = dKy_getdaytime_hour(); if (dKy_checkEventNightStop()) { layer = 1; } else { - layer = (hour >= 6 && hour < 18) == 0; + layer = (layer >= 6 && layer < 18) ? 0 : 1; } if (strcmp(dComIfGp_getStartStageName(), "sea") == 0) { @@ -494,12 +494,12 @@ int dComIfG_resetToOpening(scene_class* i_scene) { /* 800532D8-80053330 .text phase_1__FPc */ // matches with stringbase -int phase_1(char* i_arcName) { +static int phase_1(char* i_arcName) { return !dComIfG_setObjectRes(i_arcName, (u8)0, NULL) ? cPhs_ERROR_e : cPhs_NEXT_e; } /* 80053330-80053388 .text phase_2__FPc */ -int phase_2(char* i_arcName) { +static int phase_2(char* i_arcName) { int syncStatus = dComIfG_syncObjectRes(i_arcName); if (syncStatus < 0) { @@ -510,7 +510,7 @@ int phase_2(char* i_arcName) { } /* 80053388-80053390 .text phase_3__FPc */ -int phase_3(char* i_arcName) { +static int phase_3(char* i_arcName) { return cPhs_COMPLEATE_e; } @@ -711,7 +711,6 @@ BOOL dComIfGs_isStageLife(int i_stageNo) { } /* 80053B30-80053F70 .text dComIfGs_checkGetItem__FUc */ -// NONMATCHING - almost, just a couple small things u8 dComIfGs_checkGetItem(u8 i_itemNo) { u8 get_item = 0; @@ -819,15 +818,15 @@ u8 dComIfGs_checkGetItem(u8 i_itemNo) { } else if (i < 24) { item = NO_ITEM; } else if (i < 32) { - item = g_dComIfG_gameInfo.save.getPlayer().getGetItem().mItemFlags[i - 0x18]; + item = dComIfGs_getBeast(i - 24); } else if (i < 36) { item = NO_ITEM; } else if (i < 44) { - item = g_dComIfG_gameInfo.save.getPlayer().getGetItem().mItemFlags[i - 0x1C]; + item = dComIfGs_getBait(i - 36); } else if (i < 48) { item = NO_ITEM; } else if (i < 56) { - item = g_dComIfG_gameInfo.save.getPlayer().getGetItem().mItemFlags[i - 0x20]; + item = dComIfGs_getReserve(i - 48); } else { item = NO_ITEM; } @@ -843,8 +842,8 @@ u8 dComIfGs_checkGetItem(u8 i_itemNo) { } } - if (i_itemNo >= 0xBF && i_itemNo <= 0xFE && - g_dComIfG_gameInfo.save.getPlayer().getMap().isGetMap(i_itemNo - 1)) + if (i_itemNo >= 0xBF && i_itemNo <= NO_ITEM - 1 && + dComIfGs_isGetCollectMap(NO_ITEM - i_itemNo)) { get_item++; } @@ -855,15 +854,229 @@ u8 dComIfGs_checkGetItem(u8 i_itemNo) { } /* 80053F70-80054578 .text dComIfGs_checkGetItemNum__FUc */ -void dComIfGs_checkGetItemNum(u8) { - /* Nonmatching */ +u8 dComIfGs_checkGetItemNum(u8 i_itemNo) { + u8 get_item = 0; + + switch (i_itemNo) { + case TACT_SONG1: + if (dComIfGs_isTact(0)) { + get_item = 1; + } + break; + case TACT_SONG2: + if (dComIfGs_isTact(1)) { + get_item = 1; + } + break; + case TACT_SONG3: + if (dComIfGs_isTact(2)) { + get_item = 1; + } + break; + case TACT_SONG4: + if (dComIfGs_isTact(3)) { + get_item = 1; + } + break; + case TACT_SONG5: + if (dComIfGs_isTact(4)) { + get_item = 1; + } + break; + case TACT_SONG6: + if (dComIfGs_isTact(5)) { + get_item = 1; + } + break; + case TRIFORCE1: + if (dComIfGs_isTriforce(0)) { + get_item = 1; + } + break; + case TRIFORCE2: + if (dComIfGs_isTriforce(1)) { + get_item = 1; + } + break; + case TRIFORCE3: + if (dComIfGs_isTriforce(2)) { + get_item = 1; + } + break; + case TRIFORCE4: + if (dComIfGs_isTriforce(3)) { + get_item = 1; + } + break; + case TRIFORCE5: + if (dComIfGs_isTriforce(4)) { + get_item = 1; + } + break; + case TRIFORCE6: + if (dComIfGs_isTriforce(5)) { + get_item = 1; + } + break; + case TRIFORCE7: + if (dComIfGs_isTriforce(6)) { + get_item = 1; + } + break; + case TRIFORCE8: + if (dComIfGs_isTriforce(7)) { + get_item = 1; + } + break; + case PEARL1: + if (dComIfGs_isSymbol(0)) { + get_item = 1; + } + break; + case PEARL2: + if (dComIfGs_isSymbol(1)) { + get_item = 1; + } + break; + case PEARL3: + if (dComIfGs_isSymbol(2)) { + get_item = 1; + } + break; + case PIRATES_OMAMORI: + if (dComIfGs_isCollect(3, 0)) { + get_item = 1; + } + break; + case HEROS_OMAMORI: + if (dComIfGs_isCollect(4, 0)) { + get_item = 1; + } + break; + case BOW: + if (dComIfGs_getItem(12)) { + get_item = dComIfGs_getArrowNum(); + } + break; + case BOMB_BAG: + if (dComIfGs_getItem(13)) { + get_item = dComIfGs_getBombNum(); + } + break; + case SKULL_NECKLACE: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == SKULL_NECKLACE) { + get_item = dComIfGs_getBeastNum(0); + } + } + break; + case BOKOBABA_SEED: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == BOKOBABA_SEED) { + get_item = dComIfGs_getBeastNum(1); + } + } + break; + case GOLDEN_FEATHER: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == GOLDEN_FEATHER) { + get_item = dComIfGs_getBeastNum(2); + } + } + break; + case BOKO_BELT: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == BOKO_BELT) { + get_item = dComIfGs_getBeastNum(3); + } + } + break; + case RED_JELLY: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == RED_JELLY) { + get_item = dComIfGs_getBeastNum(4); + } + } + break; + case GREEN_JELLY: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == GREEN_JELLY) { + get_item = dComIfGs_getBeastNum(5); + } + } + break; + case BLUE_JELLY: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == BLUE_JELLY) { + get_item = dComIfGs_getBeastNum(6); + } + } + break; + case PENDANT: + for (int i = 0; i < 8; i++) { + if (dComIfGs_getBeast(i) == PENDANT) { + get_item = dComIfGs_getBeastNum(7); + } + } + break; + default: + u8 item = 0; + for (int i = 0; i < 60; i++) { + if (i < 21) { + item = dComIfGs_getItem(i); + } else if (i < 24) { + item = NO_ITEM; + } else if (i < 32) { + item = dComIfGs_getBeast(i - 24); + } else if (i < 36) { + item = NO_ITEM; + } else if (i < 44) { + item = dComIfGs_getBait(i - 36); + } else if (i < 48) { + item = NO_ITEM; + } else if (i < 56) { + item = dComIfGs_getReserve(i - 48); + } else { + item = NO_ITEM; + } + + if (i_itemNo == item) { + get_item = 1; + } + } + + for (int i = 0; i < 3; i++) { + if (i_itemNo == dComIfGs_getSelectEquip(i)) { + get_item = 1; + } + } + + if (i_itemNo >= 0xBF && i_itemNo <= NO_ITEM - 1 && + dComIfGs_isGetCollectMap(NO_ITEM - i_itemNo)) + { + get_item = 1; + } + break; + } + + return get_item; } /* 80054578-8005468C .text * dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj */ -void dComIfGd_setShadow(u32, s8, J3DModel*, cXyz*, f32, f32, f32, f32, cBgS_PolyInfo&, - dKy_tevstr_c*, s16, f32, _GXTexObj*) { - /* Nonmatching */ +int dComIfGd_setShadow(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 param_5, f32 param_6, + f32 y, f32 param_8, cBgS_PolyInfo& pFloorPoly, dKy_tevstr_c* param_10, + s16 rotY, f32 param_12, GXTexObj* pTexObj) { + if (param_8 <= -1000000000.0f) { + return 0; + } + + int sid = dComIfGd_setRealShadow2(id, param_2, pModel, pPos, param_5, y - param_8, param_10); + if (sid == 0) { + cXyz i_pos(pPos->x, y, pPos->z); + dComIfGd_setSimpleShadow2(&i_pos, param_8, param_6, pFloorPoly, rotY, param_12, pTexObj); + } + return sid; } /* 8005468C-800547BC .text getSceneList__Fi */ @@ -880,8 +1093,20 @@ stage_scls_info_class* getSceneList(int i_no) { } /* 800547BC-80054870 .text dComIfGd_getMeshSceneList__FR3Vec */ -stage_scls_info_class* dComIfGd_getMeshSceneList(Vec&) { - /* Nonmatching */ +stage_scls_info_class* dComIfGd_getMeshSceneList(Vec& vec) { + s32 x = (s32)((vec.x + 350000.0f) * 2e-05f); + s32 z = (s32)((vec.z + 350000.0f) * 2e-05f); + if (x < 0) { + x = 0; + } else if (13 < x) { + x = 13; + } + if (z < 0) { + z = 0; + } else if (13 < z) { + z = 13; + } + return getSceneList((x & 1) + ((x >> 1) + (z >> 1) * 7) * 4 + (z & 1) * 2); } /* 80054870-800548FC .text dComIfGs_checkSeaLandingEvent__FSc */ @@ -926,7 +1151,7 @@ void dComIfGs_setGameStartStage() { }; check_data* data_p = l_checkData; - for (int i = 0; i < 5; i++) { + for (u32 i = 0; i < 5; i++) { if (data_p->mbHasEvent == true && dComIfGs_isEventBit(data_p->mEvent)) { break; } diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 345702623..cc53b8f0f 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -7,12 +7,12 @@ #include "dolphin/types.h" /* 800804A4-800804C0 .text setViewPort__14dDlst_window_cFffffff */ -void dDlst_window_c::setViewPort(float, float, float, float, float, float) { +void dDlst_window_c::setViewPort(f32, f32, f32, f32, f32, f32) { /* Nonmatching */ } /* 800804C0-800804D4 .text setScissor__14dDlst_window_cFffff */ -void dDlst_window_c::setScissor(float, float, float, float) { +void dDlst_window_c::setScissor(f32, f32, f32, f32) { /* Nonmatching */ } @@ -37,7 +37,7 @@ void dDlst_2DT2_c::draw() { } /* 800811E8-800812F4 .text init__12dDlst_2DT2_cFP7ResTIMGffffUcUcUcff */ -void dDlst_2DT2_c::init(ResTIMG*, float, float, float, float, unsigned char, unsigned char, unsigned char, float, float) { +void dDlst_2DT2_c::init(ResTIMG*, f32, f32, f32, f32, u8, u8, u8, f32, f32) { /* Nonmatching */ } @@ -47,22 +47,22 @@ void dDlst_2DM_c::draw() { } /* 800817CC-80081850 .text init__11dDlst_2Dm_cFP7ResTIMGP7ResTIMGff */ -void dDlst_2Dm_c::init(ResTIMG*, ResTIMG*, float, float) { +void dDlst_2Dm_c::init(ResTIMG*, ResTIMG*, f32, f32) { /* Nonmatching */ } /* 80081850-80081864 .text setPos__11dDlst_2Dm_cFssss */ -void dDlst_2Dm_c::setPos(short, short, short, short) { +void dDlst_2Dm_c::setPos(s16, s16, s16, s16) { /* Nonmatching */ } /* 80081864-80081870 .text setScale__11dDlst_2Dm_cFff */ -void dDlst_2Dm_c::setScale(float, float) { +void dDlst_2Dm_c::setScale(f32, f32) { /* Nonmatching */ } /* 80081870-80081888 .text setScroll__11dDlst_2Dm_cFiss */ -void dDlst_2Dm_c::setScroll(int, short, short) { +void dDlst_2Dm_c::setScroll(int, s16, s16) { /* Nonmatching */ } @@ -77,7 +77,7 @@ void dDlst_2DMt_c::draw() { } /* 80082130-800821B0 .text __ct__10dDlst_2D_cFP7ResTIMGssUc */ -dDlst_2D_c::dDlst_2D_c(ResTIMG*, short, short, unsigned char) { +dDlst_2D_c::dDlst_2D_c(ResTIMG*, s16, s16, u8) { /* Nonmatching */ } @@ -97,17 +97,17 @@ void cM_rnd_c::get() { } /* 80082368-800823A0 .text getF__8cM_rnd_cFf */ -void cM_rnd_c::getF(float) { +void cM_rnd_c::getF(f32) { /* Nonmatching */ } /* 800823A0-800823E8 .text getFX__8cM_rnd_cFf */ -void cM_rnd_c::getFX(float) { +void cM_rnd_c::getFX(f32) { /* Nonmatching */ } /* 800823E8-80082424 .text getValue__8cM_rnd_cFff */ -void cM_rnd_c::getValue(float, float) { +void cM_rnd_c::getValue(f32, f32) { /* Nonmatching */ } @@ -117,17 +117,17 @@ void dDlst_effectLine_c::draw() { } /* 80082794-80082828 .text update__18dDlst_effectLine_cFR4cXyzR8_GXColorUsUsUsUsffff */ -void dDlst_effectLine_c::update(cXyz&, _GXColor&, unsigned short, unsigned short, unsigned short, unsigned short, float, float, float, float) { +void dDlst_effectLine_c::update(cXyz&, _GXColor&, u16, u16, u16, u16, f32, f32, f32, f32) { /* Nonmatching */ } /* 80082828-80082838 .text set__22dDlst_alphaModelData_cFUcPA4_fUc */ -void dDlst_alphaModelData_c::set(unsigned char, float(*)[4], unsigned char) { +void dDlst_alphaModelData_c::set(u8, f32(*)[4], u8) { /* Nonmatching */ } /* 80082838-80082E44 .text draw__22dDlst_alphaModelData_cFPA4_f */ -void dDlst_alphaModelData_c::draw(float(*)[4]) { +void dDlst_alphaModelData_c::draw(f32(*)[4]) { /* Nonmatching */ } @@ -152,12 +152,12 @@ dDlst_alphaModelData_c::dDlst_alphaModelData_c() { } /* 80082F3C-80082F9C .text set__18dDlst_alphaModel_cFUcPA4_fUc */ -void dDlst_alphaModel_c::set(unsigned char, float(*)[4], unsigned char) { +void dDlst_alphaModel_c::set(u8, f32(*)[4], u8) { /* Nonmatching */ } /* 80082F9C-80083064 .text draw__18dDlst_alphaModel_cFPA4_f */ -void dDlst_alphaModel_c::draw(float(*)[4]) { +void dDlst_alphaModel_c::draw(f32(*)[4]) { /* Nonmatching */ } @@ -167,7 +167,7 @@ void dDlst_alphaModelPacket::draw() { } /* 800832C4-800833CC .text set__18dDlst_shadowPoly_cFP10cBgD_Vtx_tUsUsUsP8cM3dGPla */ -void dDlst_shadowPoly_c::set(cBgD_Vtx_t*, unsigned short, unsigned short, unsigned short, cM3dGPla*) { +void dDlst_shadowPoly_c::set(cBgD_Vtx_t*, u16, u16, u16, cM3dGPla*) { /* Nonmatching */ } @@ -207,7 +207,7 @@ void dDlst_shadowReal_c::reset() { } /* 80083850-8008398C .text imageDraw__18dDlst_shadowReal_cFPA4_f */ -void dDlst_shadowReal_c::imageDraw(float(*)[4]) { +void dDlst_shadowReal_c::imageDraw(f32(*)[4]) { /* Nonmatching */ } @@ -227,7 +227,7 @@ void seaRealCallBack(void*, cXyz&, cXyz&, cXyz&) { } /* 80083E18-800840B0 .text realPolygonCheck__FP4cXyzffP4cXyzP18dDlst_shadowPoly_c */ -void realPolygonCheck(cXyz*, float, float, cXyz*, dDlst_shadowPoly_c*) { +void realPolygonCheck(cXyz*, f32, f32, cXyz*, dDlst_shadowPoly_c*) { /* Nonmatching */ } @@ -242,17 +242,17 @@ cBgS_ShdwDraw::~cBgS_ShdwDraw() { } /* 800841B0-8008450C .text setShadowRealMtx__FPA4_fPA4_fPA4_fP4cXyzP4cXyzffP18dDlst_shadowPoly_cf */ -void setShadowRealMtx(float(*)[4], float(*)[4], float(*)[4], cXyz*, cXyz*, float, float, dDlst_shadowPoly_c*, float) { +void setShadowRealMtx(f32(*)[4], f32(*)[4], f32(*)[4], cXyz*, cXyz*, f32, f32, dDlst_shadowPoly_c*, f32) { /* Nonmatching */ } /* 8008450C-800846C8 .text set__18dDlst_shadowReal_cFUlScP8J3DModelP4cXyzffP12dKy_tevstr_c */ -void dDlst_shadowReal_c::set(unsigned long, signed char, J3DModel*, cXyz*, float, float, dKy_tevstr_c*) { +void dDlst_shadowReal_c::set(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) { /* Nonmatching */ } /* 800846C8-80084844 .text set2__18dDlst_shadowReal_cFUlScP8J3DModelP4cXyzffP12dKy_tevstr_c */ -void dDlst_shadowReal_c::set2(unsigned long, signed char, J3DModel*, cXyz*, float, float, dKy_tevstr_c*) { +void dDlst_shadowReal_c::set2(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) { /* Nonmatching */ } @@ -267,7 +267,7 @@ void dDlst_shadowSimple_c::draw() { } /* 80084AC8-80084D48 .text set__20dDlst_shadowSimple_cFP4cXyzffP4cXyzsfP9_GXTexObj */ -void dDlst_shadowSimple_c::set(cXyz*, float, float, cXyz*, short, float, _GXTexObj*) { +void dDlst_shadowSimple_c::set(cXyz*, f32, f32, cXyz*, s16, f32, _GXTexObj*) { /* Nonmatching */ } @@ -282,32 +282,32 @@ void dDlst_shadowControl_c::reset() { } /* 80084DEC-80084EF0 .text imageDraw__21dDlst_shadowControl_cFPA4_f */ -void dDlst_shadowControl_c::imageDraw(float(*)[4]) { +void dDlst_shadowControl_c::imageDraw(f32(*)[4]) { /* Nonmatching */ } /* 80084EF0-800850D4 .text draw__21dDlst_shadowControl_cFPA4_f */ -void dDlst_shadowControl_c::draw(float(*)[4]) { +void dDlst_shadowControl_c::draw(f32(*)[4]) { /* Nonmatching */ } /* 800850D4-80085170 .text setReal__21dDlst_shadowControl_cFUlScP8J3DModelP4cXyzffP12dKy_tevstr_c */ -void dDlst_shadowControl_c::setReal(unsigned long, signed char, J3DModel*, cXyz*, float, float, dKy_tevstr_c*) { +void dDlst_shadowControl_c::setReal(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) { /* Nonmatching */ } /* 80085170-8008520C .text setReal2__21dDlst_shadowControl_cFUlScP8J3DModelP4cXyzffP12dKy_tevstr_c */ -void dDlst_shadowControl_c::setReal2(unsigned long, signed char, J3DModel*, cXyz*, float, float, dKy_tevstr_c*) { +void dDlst_shadowControl_c::setReal2(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*) { /* Nonmatching */ } /* 8008520C-80085274 .text addReal__21dDlst_shadowControl_cFUlP8J3DModel */ -void dDlst_shadowControl_c::addReal(unsigned long, J3DModel*) { +void dDlst_shadowControl_c::addReal(u32, J3DModel*) { /* Nonmatching */ } /* 80085274-800852D8 .text setSimple__21dDlst_shadowControl_cFP4cXyzffP4cXyzsfP9_GXTexObj */ -void dDlst_shadowControl_c::setSimple(cXyz*, float, float, cXyz*, short, float, _GXTexObj*) { +void dDlst_shadowControl_c::setSimple(cXyz*, f32, f32, cXyz*, s16, f32, _GXTexObj*) { /* Nonmatching */ } @@ -327,12 +327,12 @@ void dDlst_mirrorPacket::init(ResTIMG*) { } /* 80085624-80085808 .text mirrorPolygonCheck__FP4cXyzP4cXyzfP18dDlst_shadowPoly_c */ -void mirrorPolygonCheck(cXyz*, cXyz*, float, dDlst_shadowPoly_c*) { +void mirrorPolygonCheck(cXyz*, cXyz*, f32, dDlst_shadowPoly_c*) { /* Nonmatching */ } /* 80085808-800859DC .text update__18dDlst_mirrorPacketFPA4_fUcf */ -void dDlst_mirrorPacket::update(float(*)[4], unsigned char, float) { +void dDlst_mirrorPacket::update(f32(*)[4], u8, f32) { /* Nonmatching */ } @@ -347,7 +347,7 @@ void dDlst_alphaInvVolPacket::draw() { } /* 80085BBC-80085BFC .text newData__13dDlst_peekZ_cFssPUl */ -void dDlst_peekZ_c::newData(short, short, unsigned long*) { +void dDlst_peekZ_c::newData(s16, s16, u32*) { /* Nonmatching */ } @@ -427,12 +427,12 @@ void dDlst_list_c::draw(dDlst_base_c**, dDlst_base_c**) { } /* 800865C8-800866C8 .text wipeIn__12dDlst_list_cFfR8_GXColor */ -void dDlst_list_c::wipeIn(float, _GXColor&) { +void dDlst_list_c::wipeIn(f32, _GXColor&) { /* Nonmatching */ } /* 800866C8-800866F0 .text wipeIn__12dDlst_list_cFf */ -void dDlst_list_c::wipeIn(float) { +void dDlst_list_c::wipeIn(f32) { /* Nonmatching */ } @@ -442,7 +442,7 @@ void dDlst_list_c::calcWipe() { } /* 80086790-8008696C .text dDlst_texSpecmapST__FPC4cXyzPC12dKy_tevstr_cP12J3DModelDataf */ -void dDlst_texSpecmapST(const cXyz*, const dKy_tevstr_c*, J3DModelData*, float) { +void dDlst_texSpecmapST(const cXyz*, const dKy_tevstr_c*, J3DModelData*, f32) { /* Nonmatching */ } @@ -520,4 +520,3 @@ dDlst_2DPoint_c::~dDlst_2DPoint_c() { dDlst_2DTri_c::~dDlst_2DTri_c() { /* Nonmatching */ } - diff --git a/src/m_Do/m_Do_controller_pad.cpp b/src/m_Do/m_Do_controller_pad.cpp index 282ef0eec..1caeb3352 100644 --- a/src/m_Do/m_Do_controller_pad.cpp +++ b/src/m_Do/m_Do_controller_pad.cpp @@ -4,9 +4,12 @@ // #include "m_Do/m_Do_controller_pad.h" +#include "JSystem/JUtility/JUTGba.h" #include "SSystem/SComponent/c_lib.h" -#include "m_Do/m_Do_main.h" +#include "f_ap/f_ap_game.h" #include "m_Do/m_Do_Reset.h" +#include "m_Do/m_Do_gba_com.h" +#include "m_Do/m_Do_main.h" JUTGamePad* g_mDoCPd_gamePad[4]; interface_of_controller_pad g_mDoCPd_cpadInfo[4]; @@ -26,6 +29,7 @@ inline void mDoCPd_TRIGGER_CONV(u8 analog, f32& param_1) { } /* 80007598-800078C0 .text mDoCPd_Convert__FP27interface_of_controller_padP10JUTGamePad */ +// NONMATCHING static s32 mDoCPd_Convert(interface_of_controller_pad* pInterface, JUTGamePad* pPad) { // pInterface->mButtonFlags = pPad->getButton(); pInterface->mMainStickPosX = pPad->getMainStickX(); @@ -47,7 +51,7 @@ static s32 mDoCPd_Convert(interface_of_controller_pad* pInterface, JUTGamePad* p } /* 800078C0-80007A70 .text mDoCPd_Read__Fv */ -void mDoCPd_Read(void) { +int mDoCPd_Read() { JUTGamePad::read(); if (!mDoRst::isReset() && mDoRst::is3ButtonReset()) { @@ -61,32 +65,60 @@ void mDoCPd_Read(void) { JUTGamePad** pad = g_mDoCPd_gamePad; interface_of_controller_pad* interface = g_mDoCPd_cpadInfo; - for (u32 i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { if (*pad == NULL) { - cLib_memSet(interface, 0, sizeof(interface_of_controller_pad)); + cLib_memSet(interface++, 0, sizeof(interface_of_controller_pad)); } else { - mDoCPd_Convert(interface, *pad); + mDoCPd_Convert(interface++, *pad); } pad++; - interface++; } - - for (u32 i = 0; i < 4; i++) { + + for (int i = 0; i < 4; i++) { + f32 threshold_lo = g_HIO.mTriggerThreshLo; + f32 threshold_hi = g_HIO.mTriggerThreshHi; + + f32 trigL = g_mDoCPd_cpadInfo[i].mTriggerLeft; g_mDoCPd_cpadInfo[i].mTrigLockL = false; g_mDoCPd_cpadInfo[i].mTrigLockR = false; + + if (trigL > threshold_lo) { + if (g_mDoCPd_cpadInfo[i].mHoldLockL != true) { + g_mDoCPd_cpadInfo[i].mTrigLockL = true; + } + + g_mDoCPd_cpadInfo[i].mHoldLockL = true; + } else if (trigL < threshold_hi) { + g_mDoCPd_cpadInfo[i].mHoldLockL = false; + } + + f32 trigR = g_mDoCPd_cpadInfo[i].mTriggerRight; + if (trigR > threshold_lo) { + if (g_mDoCPd_cpadInfo[i].mHoldLockR != true) { + g_mDoCPd_cpadInfo[i].mTrigLockR = true; + } + + g_mDoCPd_cpadInfo[i].mHoldLockR = true; + } else if (trigR < threshold_hi) { + g_mDoCPd_cpadInfo[i].mHoldLockR = false; + } } + + g_mDoGaC_gbaCom.mDoGaC_Connect(); + return 1; } /* 80007A70-80007BBC .text mDoCPd_Create__Fv */ -void mDoCPd_Create(void) { +// NONMATCHING - weird ending +int mDoCPd_Create() { JUTGamePad::sSuppressPadReset = 1; JUTGamePad* pad = new JUTGamePad(JUTGamePad::Port_1); g_mDoCPd_gamePad[0] = pad; g_mDoCPd_gamePad[1] = NULL; - if (mDoMain::developmentMode != 0) { + if (mDoMain::developmentMode) { g_mDoCPd_gamePad[2] = new JUTGamePad(JUTGamePad::Port_3); g_mDoCPd_gamePad[3] = new JUTGamePad(JUTGamePad::Port_4); } else { @@ -100,15 +132,15 @@ void mDoCPd_Create(void) { JUTGamePad::setResetCallback(mDoRst_resetCallBack, NULL); } - // JUTGba::create(); - // mDoGaC_Initial(); + JUTGba::create(); + g_mDoGaC_gbaCom.mDoGaC_Initial(TestDataManager, 16); - interface_of_controller_pad* cpad = &g_mDoCPd_cpadInfo[0]; for (int i = 0; i < 4; i++) { - cpad->mTrigLockL = false; - cpad->mHoldLockL = false; - cpad->mTrigLockR = false; - cpad->mHoldLockR = false; - cpad++; + g_mDoCPd_cpadInfo[i].mTrigLockL = false; + g_mDoCPd_cpadInfo[i].mHoldLockL = false; + g_mDoCPd_cpadInfo[i].mTrigLockR = false; + g_mDoCPd_cpadInfo[i].mHoldLockR = false; } + + return 1; } diff --git a/src/m_Do/m_Do_gba_com.cpp b/src/m_Do/m_Do_gba_com.cpp index f81cac6b4..e2cc16248 100644 --- a/src/m_Do/m_Do_gba_com.cpp +++ b/src/m_Do/m_Do_gba_com.cpp @@ -4,249 +4,697 @@ // #include "m_Do/m_Do_gba_com.h" -#include "dolphin/types.h" +#include "JSystem/JUtility/JUTGba.h" +#include "SSystem/SComponent/c_math.h" +#include "m_Do/m_Do_Reset.h" + +mDoGaC_agbCom_c g_mDoGaC_gbaCom; +mDoGaC_DataManag_c TestDataManager[16]; + +static u32 BigLittleChange(u32); /* 8001A498-8001A4C0 .text ProbeCheck_0__FP11JUTGbaParamPv */ void ProbeCheck_0(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_ProbeCheck0(); } /* 8001A4C0-8001A4E8 .text ProbeCheck_1__FP11JUTGbaParamPv */ void ProbeCheck_1(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_ProbeCheck1(); } /* 8001A4E8-8001A510 .text CodeExchange_0__FP11JUTGbaParamPv */ void CodeExchange_0(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_CodeExchange0(); } /* 8001A510-8001A538 .text CodeExchange_1__FP11JUTGbaParamPv */ void CodeExchange_1(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_CodeExchange1(); } /* 8001A538-8001A560 .text CodeExchange_2__FP11JUTGbaParamPv */ void CodeExchange_2(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_CodeExchange2(); } /* 8001A560-8001A588 .text CodeExchange_3__FP11JUTGbaParamPv */ void CodeExchange_3(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_CodeExchange3(); } /* 8001A588-8001A5B0 .text CodeExchange_4__FP11JUTGbaParamPv */ void CodeExchange_4(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_CodeExchange4(); } /* 8001A5B0-8001A5D8 .text ContextCheck__FP11JUTGbaParamPv */ void ContextCheck(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_ContextCheck(); } /* 8001A5D8-8001A600 .text ContextSend__FP11JUTGbaParamPv */ void ContextSend(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_ContextSend(); } /* 8001A600-8001A628 .text ContextRead__FP11JUTGbaParamPv */ void ContextRead(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_ContextRead(); } /* 8001A628-8001A650 .text GbaWriteResult__FP11JUTGbaParamPv */ void GbaWriteResult(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_WriteResult(); } /* 8001A650-8001A678 .text GbaReadResult__FP11JUTGbaParamPv */ void GbaReadResult(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_ReadResult(); } /* 8001A678-8001A6A0 .text GbaReset__FP11JUTGbaParamPv */ void GbaReset(JUTGbaParam*, void*) { - /* Nonmatching */ + g_mDoGaC_gbaCom.mDoGaC_GbaReset(); } /* 8001A6A0-8001A7B8 .text mDoGaC_Initial__15mDoGaC_agbCom_cFP18mDoGaC_DataManag_cUc */ -void mDoGaC_agbCom_c::mDoGaC_Initial(mDoGaC_DataManag_c*, unsigned char) { - /* Nonmatching */ +// NONMATCHING - loop / end issues +void mDoGaC_agbCom_c::mDoGaC_Initial(mDoGaC_DataManag_c* param_0, u8 param_1) { + field_0x0 = 0; + field_0x1 = 0; + field_0x2 = 0; + field_0x3 = 0; + field_0x4 = 1; + field_0x5 = 0; + mPortNo = 1; + field_0x10e = 0; + field_0x7 = 0; + field_0x8 = 0; + field_0x10c = param_1; + field_0x9 = 0; + field_0xa = 0; + field_0xb = 0; + + for (int i = 0; i < 16; i++) { + field_0xc[i].field_0x0 = 0; + field_0xc[i].field_0x4 = 0; + field_0xc[i].field_0x8 = 0; + field_0xc[i].field_0xc = 0; + } + + field_0x110 = param_0; + if (param_1 != 0) { + for (int i = 0; i < param_1; i++) { + param_0[i].field_0x0 = 0; + param_0[i].field_0x4 = 0; + param_0[i].field_0x5 = 0; + } + } + + field_0x114 = -1; + field_0x118 = 0; + + field_0x12c.U16._12e |= (u32)cM_rndF(32767.0f); + field_0x12c.U32 |= (u32)cM_rndF(32767.0f); + field_0x12c.U8 = (field_0x12c.U8 & 0x3F) | 0x40; + field_0x128 = 0; } /* 8001A7B8-8001A7C4 .text mDoGaC_ComOpen__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ComOpen() { - /* Nonmatching */ + field_0x2 = 2; } /* 8001A7C4-8001A814 .text mDoGaC_ComClose__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ComClose() { - /* Nonmatching */ + field_0x4 = 1; + field_0x2 = 0; + field_0x10e = 0; + + for (int i = 0; i < field_0x10c; i++) { + field_0x110[i].field_0x4 = 9; + field_0x110[i].field_0x5 = 1; + } } /* 8001A814-8001A820 .text mDoGaC_ComStart__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ComStart() { - /* Nonmatching */ + field_0x1 = 1; } /* 8001A820-8001A858 .text mDoGaC_ComStop__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ComStop() { - /* Nonmatching */ + mDoGaC_ComClose(); + field_0x1 = 0; + field_0x5 = 0; } /* 8001A858-8001A8B4 .text mDoGaC_GbaReboot__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_GbaReboot() { - /* Nonmatching */ + mDoGaC_ComStop(); + field_0x0 = 0; + field_0x3 = 0; + field_0x12c.U32 |= (u32)cM_rndF(32767.0f); + field_0x128 = 0; } /* 8001A8B4-8001A94C .text mDoGaC_GbaReset__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_GbaReset() { - /* Nonmatching */ + u8 sp8[16]; + + if (JUTGba::getManager()->resultReset(mDoGaC_getPortNo(), sp8)) { + mDoGaC_GbaReboot(); + } else { + field_0x6++; + if (field_0x6 > 60) { + mDoGaC_GbaReboot(); + } else { + JUTGba::getManager()->doReset(mDoGaC_getPortNo(), GbaReset, NULL); + } + } } /* 8001A94C-8001A9A4 .text mDoGaC_ComRestart__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ComRestart() { - /* Nonmatching */ + field_0x4 = 0; + field_0x7 = 0; + field_0x8 = 0; + field_0x9 = 0; + field_0xa = 0; + field_0xb = 0; + + for (int i = 0; i < field_0x10c; i++) { + field_0x110[i].field_0x4 = 0; + field_0x110[i].field_0x5 = 0; + } } /* 8001A9A4-8001AAD4 .text mDoGaC_Connect__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_Connect() { - /* Nonmatching */ + if (field_0x0 != 0) { + if (mDoRst::isReset()) { + mDoGaC_ComStop(); + field_0x6 = 0; + JUTGba::getManager()->doReset(mDoGaC_getPortNo(), GbaReset, NULL); + } else if (field_0x1 != 0) { + switch (field_0x2) { + case 0: + field_0x2 = 1; + JUTGba::getManager()->doProbe(mDoGaC_getPortNo(), ProbeCheck_0, NULL); + if (field_0x10e < 3) { + field_0x10e++; + } + break; + case 2: + mDoGaC_ComRestart(); + mDoGaC_GbaWrite(); + field_0x2 = 3; + break; + case 3: + if (field_0x5 == 0) { + mDoGaC_SendDataWrite(); + } + + if (field_0x4 == 1) { + mDoGaC_ComClose(); + } + + field_0x10e = 0; + break; + case 4: + break; + } + } + } } /* 8001AAD4-8001AAEC .text mDoGaC_ConnectSleep__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ConnectSleep() { - /* Nonmatching */ + if (field_0x2 == 0) { + field_0x2 = 4; + } } /* 8001AAEC-8001AAF8 .text mDoGaC_ConnectWake__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ConnectWake() { - /* Nonmatching */ + field_0x2 = 0; } /* 8001AAF8-8001AB4C .text mDoGaC_GbaLink__15mDoGaC_agbCom_cFv */ -void mDoGaC_agbCom_c::mDoGaC_GbaLink() { - /* Nonmatching */ +int mDoGaC_agbCom_c::mDoGaC_GbaLink() { + if (field_0x0 == 1 && field_0x2 == 3 && field_0x4 == 0) { + return 1; + } + + if (field_0x128 == 1 && field_0x10e < 3) { + return 1; + } + + return 0; } /* 8001AB4C-8001AC14 .text mDoGaC_SendDataSet__15mDoGaC_agbCom_cFPUliUcUl */ -void mDoGaC_agbCom_c::mDoGaC_SendDataSet(unsigned long*, int, unsigned char, unsigned long) { - /* Nonmatching */ +int mDoGaC_agbCom_c::mDoGaC_SendDataSet(u32* param_0, int param_1, u8 param_2, u32 param_3) { + u8 uvar1 = field_0x9 + 1; + if (uvar1 >= 16) { + uvar1 = 0; + } + + if (uvar1 == field_0xa || param_1 <= 0) { + return 0; + } + + if (param_1 < 4) { + param_1 = 4; + } + + field_0xc[field_0x9].field_0x0 = param_0; + field_0xc[field_0x9].field_0x4 = param_1; + field_0xc[field_0x9].field_0x8 = param_2; + field_0xc[field_0x9].field_0xc = param_3; + field_0x110[param_2].field_0x4 = 2; + + field_0x9++; + if (field_0x9 >= 16) { + field_0x9 = 0; + } + + field_0xb++; + + return 1; } /* 8001AC14-8001AD48 .text mDoGaC_SendDataWrite__15mDoGaC_agbCom_cFv */ +// NONMATCHING - regswap void mDoGaC_agbCom_c::mDoGaC_SendDataWrite() { - /* Nonmatching */ + u8 var_r5 = 0; + while (field_0x10c > var_r5) { + u8 var_r0 = field_0x110[var_r5].field_0x5; + if (var_r0 != 0) { + u8 temp_r0 = field_0x9 + 1; + if (temp_r0 >= 16) { + temp_r0 = 0; + } + + if (temp_r0 == field_0xa) { + return; + } + + if (field_0x110[var_r5].field_0x4 == 0 || field_0x110[var_r5].field_0x4 == 1) { + if (var_r0 == 1) { + field_0xc[field_0x9].field_0x0 = &field_0x11C; + field_0xc[field_0x9].field_0x4 = 4; + } else { + field_0xc[field_0x9].field_0x0 = &field_0x120; + field_0xc[field_0x9].field_0x4 = 8; + } + + field_0xc[field_0x9].field_0x8 = var_r5; + field_0xc[field_0x9].field_0xc = 0; + field_0x110[var_r5].field_0x4 = 2; + + field_0x9++; + if (field_0x9 >= 16) { + field_0x9 = 0; + } + + field_0xb++; + field_0x110[var_r5].field_0x5 = 0; + } + } + + var_r5++; + } } /* 8001AD48-8001AD84 .text mDoGaC_SendEntry__15mDoGaC_agbCom_cFUcUl */ -void mDoGaC_agbCom_c::mDoGaC_SendEntry(unsigned char, unsigned long) { - /* Nonmatching */ +int mDoGaC_agbCom_c::mDoGaC_SendEntry(u8 param_0, u32 param_1) { + if (field_0x110[param_0].field_0x5 == 0) { + field_0x11C = param_1; + field_0x110[param_0].field_0x5 = 1; + return 1; + } + + return 0; } /* 8001AD84-8001ADB4 .text mDoGaC_SendStatusCheck__15mDoGaC_agbCom_cFUc */ -void mDoGaC_agbCom_c::mDoGaC_SendStatusCheck(unsigned char) { - /* Nonmatching */ +int mDoGaC_agbCom_c::mDoGaC_SendStatusCheck(u8 param_0) { + if (field_0x110[param_0].field_0x4 == 0 || field_0x110[param_0].field_0x4 == 1) { + return 1; + } + + return 0; } /* 8001ADB4-8001ADE4 .text mDoGaC_SendEndCheck__15mDoGaC_agbCom_cFUc */ -void mDoGaC_agbCom_c::mDoGaC_SendEndCheck(unsigned char) { - /* Nonmatching */ +int mDoGaC_agbCom_c::mDoGaC_SendEndCheck(u8 param_0) { + if (field_0x110[param_0].field_0x4 == 4 || field_0x110[param_0].field_0x4 == 0) { + return 1; + } + + return 0; } /* 8001ADE4-8001AE04 .text mDoGaC_RecvStatusCheck__15mDoGaC_agbCom_cFUc */ -void mDoGaC_agbCom_c::mDoGaC_RecvStatusCheck(unsigned char) { - /* Nonmatching */ +bool mDoGaC_agbCom_c::mDoGaC_RecvStatusCheck(u8 param_0) { + return field_0x110[param_0].field_0x4 == 8; } /* 8001AE04-8001AE44 .text mDoGaC_DataStatusReset__15mDoGaC_agbCom_cFUc */ -void mDoGaC_agbCom_c::mDoGaC_DataStatusReset(unsigned char) { - /* Nonmatching */ +void mDoGaC_agbCom_c::mDoGaC_DataStatusReset(u8 param_0) { + if (field_0x110[param_0].field_0x4 == 8) { + field_0x110[param_0].field_0x4 = 0; + mDoGaC_StatusSendSet(param_0); + } } /* 8001AE44-8001AEE4 .text mDoGaC_StatusSendSet__15mDoGaC_agbCom_cFUc */ -void mDoGaC_agbCom_c::mDoGaC_StatusSendSet(unsigned char) { - /* Nonmatching */ +int mDoGaC_agbCom_c::mDoGaC_StatusSendSet(u8 param_0) { + u8 temp_r0 = field_0x9 + 1; + if (temp_r0 >= 16) { + temp_r0 = 0; + } + + if (temp_r0 == field_0xa) { + return 0; + } + + field_0xc[field_0x9].field_0x0 = 0; + field_0xc[field_0x9].field_0x4 = 0; + field_0xc[field_0x9].field_0x8 = param_0; + field_0xc[field_0x9].field_0xc = 0; + + field_0x9++; + if (field_0x9 >= 16) { + field_0x9 = 0; + } + + field_0xb++; + return 1; } /* 8001AEE4-8001AF68 .text mDoGaC_ProbeCheck0__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ProbeCheck0() { - /* Nonmatching */ + u32 sp8; + if (!JUTGba::getManager()->resultProbe(mDoGaC_getPortNo(), &sp8) && sp8 == 0x40000) { + JUTGba::getManager()->doReset(mDoGaC_getPortNo(), ProbeCheck_1, NULL); + } else { + field_0x2 = 0; + } } /* 8001AF68-8001AFDC .text mDoGaC_ProbeCheck1__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ProbeCheck1() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultReset(mDoGaC_getPortNo(), sp8)) { + JUTGba::getManager()->doGetStatus(mDoGaC_getPortNo(), CodeExchange_0, NULL); + } else { + field_0x2 = 0; + } } /* 8001AFDC-8001B060 .text mDoGaC_CodeExchange0__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_CodeExchange0() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultGetStatus(mDoGaC_getPortNo(), sp8) && sp8[0] == 0x28) { + JUTGba::getManager()->doRead(mDoGaC_getPortNo(), (u8*)&field_0x118, CodeExchange_1, NULL); + } else { + field_0x2 = 0; + } } /* 8001B060-8001B0F4 .text mDoGaC_CodeExchange1__15mDoGaC_agbCom_cFv */ +// NONMATCHING - weird string load void mDoGaC_agbCom_c::mDoGaC_CodeExchange1() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultRead(mDoGaC_getPortNo(), sp8)) { + if (field_0x118 == (u32) "GZLE") { + JUTGba::getManager()->doGetStatus(mDoGaC_getPortNo(), CodeExchange_2, NULL); + } else { + mDoGaC_GbaReboot(); + } + } else { + field_0x2 = 0; + } } /* 8001B0F4-8001B184 .text mDoGaC_CodeExchange2__15mDoGaC_agbCom_cFv */ +// NONMATCHING - weird string load void mDoGaC_agbCom_c::mDoGaC_CodeExchange2() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultGetStatus(mDoGaC_getPortNo(), sp8) && sp8[0] == 0x20) { + field_0x114 = (u32) "GZLE"; + JUTGba::getManager()->doWrite(mDoGaC_getPortNo(), (u8*)&field_0x114, CodeExchange_3, NULL); + } else { + field_0x2 = 0; + } } /* 8001B184-8001B1F8 .text mDoGaC_CodeExchange3__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_CodeExchange3() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultWrite(mDoGaC_getPortNo(), sp8)) { + JUTGba::getManager()->doGetStatus(mDoGaC_getPortNo(), CodeExchange_4, NULL); + } else { + field_0x2 = 0; + } } /* 8001B1F8-8001B298 .text mDoGaC_CodeExchange4__15mDoGaC_agbCom_cFv */ +// NONMATCHING - weird bit shifting void mDoGaC_agbCom_c::mDoGaC_CodeExchange4() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultGetStatus(mDoGaC_getPortNo(), sp8) && sp8[0] == 0x30) { + field_0x12c.U8 = (field_0x12c.U8 & ~0xC0) | (mDoGaC_getPortNo() & 0xC0); + field_0x114 = BigLittleChange(field_0x12c.U32); + JUTGba::getManager()->doWrite(mDoGaC_getPortNo(), (u8*)&field_0x114, ContextSend, NULL); + } else { + field_0x2 = 0; + } } /* 8001B298-8001B334 .text mDoGaC_ContextCheck__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ContextCheck() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultRead(mDoGaC_getPortNo(), sp8)) { + u32 var_r0 = BigLittleChange(field_0x118); + if (var_r0 == field_0x12c.U32) { + if (field_0x128 == 1) { + field_0x3 = 1; + } else { + field_0x128 = 1; + } + + mDoGaC_ComOpen(); + } else { + field_0x2 = 0; + } + } else { + field_0x2 = 0; + } } /* 8001B334-8001B3A8 .text mDoGaC_ContextSend__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ContextSend() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultWrite(mDoGaC_getPortNo(), sp8)) { + JUTGba::getManager()->doGetStatus(mDoGaC_getPortNo(), ContextRead, NULL); + } else { + field_0x2 = 0; + } } /* 8001B3A8-8001B42C .text mDoGaC_ContextRead__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_ContextRead() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultGetStatus(mDoGaC_getPortNo(), sp8) && sp8[0] == 0x38) { + JUTGba::getManager()->doRead(mDoGaC_getPortNo(), (u8*)&field_0x118, ContextRead, NULL); + } else { + field_0x2 = 0; + } } /* 8001B42C-8001B6CC .text mDoGaC_GbaWrite__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_GbaWrite() { - /* Nonmatching */ + static int flag = 0; + + if (field_0xa == field_0x9) { + if (field_0x5 == 1) { + mDoGaC_ComStop(); + field_0x114 = -0x10101011; + } else { + field_0x114 = -1; + } + } else { + mDoGaC_unk_data* temp_r31 = &field_0xc[field_0xa]; + switch (field_0x8) { + case 0: + field_0x114 = BigLittleChange(-0x01010102); + field_0x8 = 1; + break; + case 1: + field_0x114 = BigLittleChange(temp_r31->field_0x8); + field_0x8 = 2; + break; + case 2: + u8 temp_r3_2 = field_0x110[temp_r31->field_0x8].field_0x4; + if (temp_r3_2 == 2) { + field_0x110[temp_r31->field_0x8].field_0x4 = 3; + field_0x114 = BigLittleChange(3); + field_0x8 = 3; + } else { + field_0x114 = BigLittleChange(temp_r3_2); + if (field_0x110[temp_r31->field_0x8].field_0x4 == 5) { + field_0x110[temp_r31->field_0x8].field_0x4 = 6; + } + + field_0xb--; + field_0xa++; + if (field_0xa >= 16) { + field_0xa = 0; + } + + field_0x8 = 0; + } + break; + case 3: + field_0x114 = BigLittleChange(temp_r31->field_0x4); + temp_r31->field_0xc = 0; + field_0x8 = 5; + break; + case 4: + field_0x114 = BigLittleChange(temp_r31->field_0xc); + field_0x110[temp_r31->field_0x8].field_0x4 = 4; + + field_0xb--; + field_0xa++; + if (field_0xa >= 16) { + field_0xa = 0; + } + field_0x8 = 0; + break; + case 5: + field_0x114 = *temp_r31->field_0x0; + temp_r31->field_0xc += BigLittleChange(field_0x114); + temp_r31->field_0x4 -= 4; + if (temp_r31->field_0x4 <= 0) { + field_0x8 = 4; + } else { + temp_r31->field_0x0++; + } + break; + default: + field_0x114 = -1; + break; + } + } + + JUTGba::getManager()->doWrite(mDoGaC_getPortNo(), (u8*)&field_0x114, GbaWriteResult, NULL); } /* 8001B6CC-8001B734 .text mDoGaC_WriteResult__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_WriteResult() { - /* Nonmatching */ + u8 sp8[16]; + if (!JUTGba::getManager()->resultWrite(mDoGaC_getPortNo(), sp8) && field_0x4 == 0) { + mDoGaC_GbaRead(); + } else { + field_0x4 = 1; + } } /* 8001B734-8001B778 .text mDoGaC_GbaRead__15mDoGaC_agbCom_cFv */ void mDoGaC_agbCom_c::mDoGaC_GbaRead() { - /* Nonmatching */ + JUTGba::getManager()->doRead(mDoGaC_getPortNo(), (u8*)&field_0x118, GbaReadResult, NULL); } /* 8001B778-8001BA34 .text mDoGaC_ReadResult__15mDoGaC_agbCom_cFv */ +// NONMATCHING - almost void mDoGaC_agbCom_c::mDoGaC_ReadResult() { - /* Nonmatching */ + static u8 data_type = 0; + static u32 check_sum = 0; + static u32 data_sum = 0; + static u32* recv_p = NULL; + static u32* end_p = NULL; + + u8 sp8[16]; + if (!JUTGba::getManager()->resultRead(mDoGaC_getPortNo(), sp8) && field_0x4 == 0) { + switch (field_0x7) { + case 0: + u32 temp_r0 = BigLittleChange(field_0x118); + if (temp_r0 == -0x1010102) { + field_0x7 = 1; + } + break; + case 1: + u32 temp_r0_2 = BigLittleChange(field_0x118); + data_type = temp_r0_2; + if ((temp_r0_2 & 0xFF) < 0x10) { + recv_p = &field_0x110[temp_r0_2 & 0xFF].field_0x0; + } else { + recv_p = NULL; + } + field_0x7 = 2; + break; + case 2: + u32 temp_r0_3 = BigLittleChange(field_0x118); + field_0x110[data_type].field_0x4 = temp_r0_3; + if (temp_r0_3 == 7) { + field_0x7 = 3; + } else { + field_0x7 = 0; + if (temp_r0_3 == 9) { + field_0x4 = 1; + } + } + break; + case 3: + u32 temp_r0_4 = BigLittleChange(field_0x118); + end_p = &field_0x110[data_type].field_0x0 + temp_r0_4; + data_sum = 0; + if (recv_p == NULL) { + field_0x7 = 6; + } else { + field_0x7 = 5; + } + break; + case 4: + check_sum = BigLittleChange(field_0x118); + if (data_sum == check_sum) { + field_0x110[data_type].field_0x4 = 8; + } else { + field_0x110[data_type].field_0x4 = 9; + mDoGaC_StatusSendSet(data_type); + field_0x4 = 1; + } + field_0x7 = 0; + break; + case 5: + *recv_p = field_0x118; + data_sum += BigLittleChange(field_0x118); + case 6: + recv_p++; + if (recv_p >= end_p) { + field_0x7 = 4; + } + break; + } + + mDoGaC_GbaWrite(); + } else { + field_0x4 = 1; + } } /* 8001BA34-8001BA68 .text BigLittleChange__FUl */ -void BigLittleChange(unsigned long) { - /* Nonmatching */ +// NONMATCHING - not even close +u32 BigLittleChange(u32 param_0) { + u8 b1 = param_0 >> 8; + u8 b2 = param_0 >> 0x10; + u8 b3 = param_0 >> 0x18; + return (param_0 << 0x18) | (b1 << 0x10) | (b2 << 8) | b3; } /* 8001BAA0-8001BADC .text __dt__15mDoGaC_agbCom_cFv */ -mDoGaC_agbCom_c::~mDoGaC_agbCom_c() { - /* Nonmatching */ -} +mDoGaC_agbCom_c::~mDoGaC_agbCom_c() {} diff --git a/tools/project.py b/tools/project.py index c275dcd30..8fd6b6451 100644 --- a/tools/project.py +++ b/tools/project.py @@ -45,15 +45,17 @@ class ProjectConfig: self.sjiswrap_path = None # If None, download # Project config + self.build_rels = True # Build REL files self.check_sha_path = None # Path to version.sha1 self.config_path = None # Path to config.yml - self.build_rels = True # Build REL files self.debug = False # Build with debug info self.generate_map = False # Generate map file(s) self.ldflags = None # Linker flags - self.linker_version = None # mwld version self.libs = None # List of libraries + self.linker_version = None # mwld version self.version = None # Version name + self.warn_missing_config = False # Warn on missing unit configuration + self.warn_missing_source = False # Warn on missing source file # Progress output and progress.json config self.progress_all = True # Include combined "all" category @@ -495,6 +497,8 @@ def generate_build_ninja(config, build_config): obj_path, obj_name = build_obj["object"], build_obj["name"] result = config.find_object(obj_name) if not result: + if config.warn_missing_config: + print(f"Missing configuration for {obj_name}") link_step.add(obj_path) return @@ -506,6 +510,8 @@ def generate_build_ninja(config, build_config): unit_src_path = config.src_dir / options["source"] if not unit_src_path.exists(): + if config.warn_missing_source: + print(f"Missing source file {unit_src_path}") link_step.add(obj_path) return