From 76ac9312b67704e3ad980b0d6c825bc29266df71 Mon Sep 17 00:00:00 2001 From: Texline666 <93364055+Tanline666@users.noreply.github.com> Date: Thu, 24 Sep 2026 16:48:58 -0600 Subject: [PATCH 1/3] RPSportsMenuBgModel, RPGraphics Rev 0 libraries WIP, BTE supported for real --- config/RSPE01_00/splits.txt | 56 + config/RSPE01_00/symbols.txt | 547 ++-- config/RSPE01_01/splits.txt | 17 +- config/RSPE01_01/symbols.txt | 67 +- configure.py | 13 +- include/Pack/RPGraphics.h | 2 + include/Pack/RPGraphics/RPGrpCamera.h | 13 + include/Pack/RPGraphics/RPGrpCpuTexture.h | 156 + include/Pack/RPGraphics/RPGrpModel.h | 82 +- include/Pack/RPGraphics/RPGrpModelAnm.h | 8 +- include/Pack/RPGraphics/RPGrpModelG3D.h | 2 + include/Pack/RPGraphics/RPGrpModelRfl.h | 4 + include/Pack/RPGraphics/RPGrpModelScene.h | 27 +- include/Pack/RPGraphics/RPGrpRenderer.h | 32 +- include/Pack/RPGraphics/RPGrpResTIMG.h | 36 + include/Pack/RPSports/RPSportsCommon.h | 1 + .../RPSportsCommon/RPSportsMenuBgModel.h | 50 + include/Pack/RPSystem/RPSysGameConfig.h | 27 +- include/egg/gfxe/eggCpuTexture.h | 2 +- include/egg/gfxe/eggFogManager.h | 4 + include/egg/gfxe/eggLightManager.h | 16 +- include/egg/gfxe/eggLightObject.h | 24 +- include/egg/gfxe/eggLightTexture.h | 8 +- include/egg/gfxe/eggPostEffectBlur.h | 8 +- include/egg/gfxe/eggPostEffectBlurGather.h | 9 +- include/egg/gfxe/eggPostEffectBlurSimple.h | 5 +- include/egg/gfxe/eggScnRootEx.h | 3 + include/egg/gfxe/eggScreen.h | 5 +- include/egg/gfxe/eggShadowTexture.h | 8 +- include/egg/gfxe/eggShadowTextureManager.h | 2 +- include/egg/gfxe/eggStateGX.h | 11 + include/egg/math/eggMatrix.h | 5 +- include/revolution/BTE/bta/ar/bta_ar_int.h | 64 - .../revolution/BTE/bta/include/bta_ar_api.h | 140 - include/revolution/BTE/gki/common/gki.h | 18 + include/revolution/BTE/include/bt_target.h | 14 +- .../revolution/BTE/stack/include/l2c_api.h | 15 + include/revolution/BTE/stack/l2cap/l2c_int.h | 20 +- src/Pack/RPGraphics/RPGrpCpuTexture.cpp | 228 ++ src/Pack/RPGraphics/RPGrpModel.cpp | 44 +- src/Pack/RPGraphics/RPGrpModelImplement.cpp | 15 +- src/Pack/RPGraphics/RPGrpModelResManager.cpp | 6 +- src/Pack/RPGraphics/RPGrpModelRfl.cpp | 16 +- src/Pack/RPGraphics/RPGrpModelScene.cpp | 21 + src/Pack/RPGraphics/RPGrpRenderer.cpp | 53 + src/Pack/RPKernel/RPSysKokeshiIcon.cpp | 2 + .../RPSportsCommon/RPSportsMenuBgModel.cpp | 108 + src/egg/gfxe/eggLightManager.cpp | 10 + src/egg/gfxe/eggLightObject.cpp | 63 + src/revolution/BTE/bta/ar/bta_ar.c | 348 --- src/revolution/BTE/bta/av/bta_av_main.c | 13 +- src/revolution/BTE/gki/common/gki_buffer.c | 9 +- src/revolution/BTE/gki/common/gki_time.c | 9 + src/revolution/BTE/stack/avct/avct_api.c | 465 --- src/revolution/BTE/stack/avct/avct_ccb.c | 150 - src/revolution/BTE/stack/avct/avct_l2c.c | 434 --- src/revolution/BTE/stack/avct/avct_lcb.c | 471 --- src/revolution/BTE/stack/avct/avct_lcb_act.c | 702 ----- src/revolution/BTE/stack/l2cap/l2c_api.c | 16 +- src/revolution/BTE/stack/l2cap/l2c_csm.c | 19 +- src/revolution/BTE/stack/l2cap/l2c_fcr.c | 2709 ----------------- src/revolution/BTE/stack/l2cap/l2c_link.c | 12 + 62 files changed, 1587 insertions(+), 5857 deletions(-) create mode 100644 include/Pack/RPGraphics/RPGrpCpuTexture.h create mode 100644 include/Pack/RPGraphics/RPGrpResTIMG.h create mode 100644 include/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.h delete mode 100644 include/revolution/BTE/bta/ar/bta_ar_int.h delete mode 100644 include/revolution/BTE/bta/include/bta_ar_api.h create mode 100644 src/Pack/RPGraphics/RPGrpCpuTexture.cpp create mode 100644 src/Pack/RPGraphics/RPGrpModelScene.cpp create mode 100644 src/Pack/RPGraphics/RPGrpRenderer.cpp create mode 100644 src/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.cpp create mode 100644 src/egg/gfxe/eggLightManager.cpp create mode 100644 src/egg/gfxe/eggLightObject.cpp delete mode 100644 src/revolution/BTE/bta/ar/bta_ar.c delete mode 100644 src/revolution/BTE/stack/avct/avct_api.c delete mode 100644 src/revolution/BTE/stack/avct/avct_ccb.c delete mode 100644 src/revolution/BTE/stack/avct/avct_l2c.c delete mode 100644 src/revolution/BTE/stack/avct/avct_lcb.c delete mode 100644 src/revolution/BTE/stack/avct/avct_lcb_act.c delete mode 100644 src/revolution/BTE/stack/l2cap/l2c_fcr.c diff --git a/config/RSPE01_00/splits.txt b/config/RSPE01_00/splits.txt index e391653b4..17af552f8 100644 --- a/config/RSPE01_00/splits.txt +++ b/config/RSPE01_00/splits.txt @@ -181,6 +181,13 @@ nw4r/snd/snd_FxChorus.cpp: .text start:0x80035F90 end:0x8003635C .rodata start:0x80341240 end:0x80341250 +nw4r/snd/snd_SeqSoundHandle.cpp: + .text start:0x8003B5B0 end:0x8003B6F0 + +nw4r/snd/snd_SoundArchive.cpp: + .text start:0x8003D47C end:0x8003DA9C + .data start:0x8035FF20 end:0x8035FF40 + nw4r/snd/snd_SoundHeap.cpp: .text start:0x80041F48 end:0x8004223C @@ -451,6 +458,10 @@ egg/core/eggDisposer.cpp: .text start:0x80087C38 end:0x80087D00 .data start:0x80361A68 end:0x80361A78 +egg/audio/eggAudioFxMgr.cpp: + .text start:0x80088958 end:0x8008977C + .rodata start:0x80343A28 end:0x80343C60 + runtime/__mem.c: .init start:0x80004000 end:0x80004134 .text start:0x8008BD5C end:0x8008BD78 @@ -620,6 +631,13 @@ revolution/AXFX/AXFXChorusExp.c: .text start:0x800E3504 end:0x800E3F80 .sdata2 start:0x804E1408 end:0x804E1438 +revolution/BTE/gki/common/gki_buffer.c: + .text start:0x800E4150 end:0x800E5594 + .data start:0x80377D18 end:0x80377E60 + +revolution/BTE/gki/common/gki_time.c: + .text start:0x800E5594 end:0x800E5AEC + revolution/DVD/dvdfs.c: .text start:0x80112C00 end:0x80113648 .data start:0x8037E400 end:0x8037E568 @@ -908,13 +926,51 @@ Pack/RPKernel/RPSysKokeshiIcon.cpp: .text start:0x8016D500 end:0x8016EBF4 .data start:0x80381DA0 end:0x80381DB4 +Pack/RPGraphics/RPGrpModel.cpp: + .text start:0x801809E8 end:0x80181190 + Pack/RPGraphics/RPGrpModelAnm.cpp: .text start:0x80181190 end:0x80181984 .data start:0x803823B0 end:0x80382438 + .sdata2 start:0x804E1A88 end:0x804E1A90 Pack/RPGraphics/RPGrpModelResManager.cpp: .text start:0x80185AE4 end:0x80186924 + .data start:0x803826F0 end:0x803827A4 + +Pack/RPGraphics/RPGrpCpuTexture.cpp: + .text start:0x8018F1A0 end:0x801900F0 + +Pack/RPGraphics/RPGrpFog.cpp: + .text start:0x801900F0 end:0x80190344 Pack/RPAudio/RPSndAudioMgr.cpp: .text start:0x8019C7E0 end:0x8019E630 .sbss start:0x804DFC5C end:0x804DFC68 + +Pack/RPAudio/RPSndSpeakerMgr.cpp: + .text start:0x8019E630 end:0x8019F068 + .data start:0x80383060 end:0x8038306C + .sbss start:0x804DFC68 end:0x804DFC6C + .sdata2 start:0x804E1EA8 end:0x804E1EAC + +Pack/RPUtility/RPUtlDohMath.cpp: + .text start:0x8019F8D4 end:0x8019FE84 + .ctors start:0x80330160 end:0x80330164 + .bss start:0x804D6F08 end:0x804D6FC8 + .sbss start:0x804DFC78 end:0x804DFC80 + .sdata2 start:0x804E1EE0 end:0x804E1EF0 + +Pack/RPUtility/RPUtlMapData.cpp: + .text start:0x801A5000 end:0x801A546C + +Pack/RPUtility/RPUtlShadowDrawer.cpp: + .text start:0x801A546C end:0x801A5580 + .ctors start:0x8033016C end:0x80330170 + .bss start:0x804D7078 end:0x804D70A8 + +Pack/RPSports/RPSportsCommon/RPSysPlayerSelectScene.cpp: + .text start:0x801B8778 end:0x801BB064 + +Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.cpp: + .text start:0x801BB064 end:0x801BB644 diff --git a/config/RSPE01_00/symbols.txt b/config/RSPE01_00/symbols.txt index de9bfc87d..27fb6cee5 100644 --- a/config/RSPE01_00/symbols.txt +++ b/config/RSPE01_00/symbols.txt @@ -914,7 +914,7 @@ fn_8002D7BC = .text:0x8002D7BC; // type:function size:0x8 fn_8002D7C4 = .text:0x8002D7C4; // type:function size:0x6C fn_8002D830 = .text:0x8002D830; // type:function size:0x58 SetOutputMode__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd10OutputMode = .text:0x8002D888; // type:function size:0xC8 -fn_8002D950 = .text:0x8002D950; // type:function size:0x8 +GetOutputMode__Q44nw4r3snd6detail9AxManagerFv = .text:0x8002D950; // type:function size:0x8 fn_8002D958 = .text:0x8002D958; // type:function size:0x200 fn_8002DB58 = .text:0x8002DB58; // type:function size:0x8C fn_8002DBE4 = .text:0x8002DBE4; // type:function size:0x15C @@ -923,8 +923,8 @@ fn_8002DD78 = .text:0x8002DD78; // type:function size:0xC4 fn_8002DE3C = .text:0x8002DE3C; // type:function size:0x68 fn_8002DEA4 = .text:0x8002DEA4; // type:function size:0xF8 fn_8002DF9C = .text:0x8002DF9C; // type:function size:0x158 -fn_8002E0F4 = .text:0x8002E0F4; // type:function size:0x204 -fn_8002E2F8 = .text:0x8002E2F8; // type:function size:0xC8 +AppendEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusPQ34nw4r3snd6FxBase = .text:0x8002E0F4; // type:function size:0x204 +ClearEffect__Q44nw4r3snd6detail9AxManagerFQ34nw4r3snd6AuxBusi = .text:0x8002E2F8; // type:function size:0xC8 fn_8002E3C0 = .text:0x8002E3C0; // type:function size:0xE8 fn_8002E4A8 = .text:0x8002E4A8; // type:function size:0x2D8 PrepareReset__Q44nw4r3snd6detail9AxManagerFv = .text:0x8002E780; // type:function size:0xC8 @@ -1010,19 +1010,19 @@ fn_800335A0 = .text:0x800335A0; // type:function size:0x8 fn_800335A8 = .text:0x800335A8; // type:function size:0x8 fn_800335B0 = .text:0x800335B0; // type:function size:0x8 fn_800335B8 = .text:0x800335B8; // type:function size:0x4C -fn_80033604 = .text:0x80033604; // type:function size:0x10 -fn_80033614 = .text:0x80033614; // type:function size:0x8 -fn_8003361C = .text:0x8003361C; // type:function size:0x10 +SetOutputLine__Q44nw4r3snd6detail10BasicSoundFi = .text:0x80033604; // type:function size:0x10 +SetMainOutVolume__Q44nw4r3snd6detail10BasicSoundFf = .text:0x80033614; // type:function size:0x8 +SetRemoteOutVolume__Q44nw4r3snd6detail10BasicSoundFif = .text:0x8003361C; // type:function size:0x10 fn_8003362C = .text:0x8003362C; // type:function size:0x5C fn_80033688 = .text:0x80033688; // type:function size:0x14 fn_8003369C = .text:0x8003369C; // type:function size:0x14 -fn_800336B0 = .text:0x800336B0; // type:function size:0x14 -fn_800336C4 = .text:0x800336C4; // type:function size:0x8 -fn_800336CC = .text:0x800336CC; // type:function size:0x8 -fn_800336D4 = .text:0x800336D4; // type:function size:0x40 -fn_80033714 = .text:0x80033714; // type:function size:0x40 -fn_80033754 = .text:0x80033754; // type:function size:0x8 -fn_8003375C = .text:0x8003375C; // type:function size:0xC +IsAttachedTempGeneralHandle__Q44nw4r3snd6detail10BasicSoundFv = .text:0x800336B0; // type:function size:0x14 +DetachGeneralHandle__Q44nw4r3snd6detail10BasicSoundFv = .text:0x800336C4; // type:function size:0x8 +DetachTempGeneralHandle__Q44nw4r3snd6detail10BasicSoundFv = .text:0x800336CC; // type:function size:0x8 +SetId__Q44nw4r3snd6detail10BasicSoundFUl = .text:0x800336D4; // type:function size:0x40 +__dt__Q44nw4r3snd6detail10BasicSoundFv = .text:0x80033714; // type:function size:0x40 +GetRuntimeTypeInfo__Q44nw4r3snd6detail10BasicSoundCFv = .text:0x80033754; // type:function size:0x8 +__sinit_\snd_BasicSound_cpp = .text:0x8003375C; // type:function size:0xC fn_80033768 = .text:0x80033768; // type:function size:0xF8 fn_80033860 = .text:0x80033860; // type:function size:0x78 fn_800338D8 = .text:0x800338D8; // type:function size:0xC4 @@ -1104,13 +1104,13 @@ fn_800365A0 = .text:0x800365A0; // type:function size:0x60 fn_80036600 = .text:0x80036600; // type:function size:0x138 fn_80036738 = .text:0x80036738; // type:function size:0x44 fn_8003677C = .text:0x8003677C; // type:function size:0x7C -fn_800367F8 = .text:0x800367F8; // type:function size:0x8C -fn_80036884 = .text:0x80036884; // type:function size:0x2C +__ct__Q34nw4r3snd10FxReverbHiFv = .text:0x800367F8; // type:function size:0x8C +GetRequiredMemSize__Q34nw4r3snd10FxReverbHiFv = .text:0x80036884; // type:function size:0x2C fn_800368B0 = .text:0x800368B0; // type:function size:0x8 fn_800368B8 = .text:0x800368B8; // type:function size:0x8 fn_800368C0 = .text:0x800368C0; // type:function size:0xB4 fn_80036974 = .text:0x80036974; // type:function size:0x60 -fn_800369D4 = .text:0x800369D4; // type:function size:0x1C0 +SetParam__Q34nw4r3snd10FxReverbHiFRCQ44nw4r3snd10FxReverbHi13ReverbHiParam = .text:0x800369D4; // type:function size:0x1C0 fn_80036B94 = .text:0x80036B94; // type:function size:0x44 fn_80036BD8 = .text:0x80036BD8; // type:function size:0x7C fn_80036C54 = .text:0x80036C54; // type:function size:0x8C @@ -1199,15 +1199,15 @@ fn_8003929C = .text:0x8003929C; // type:function size:0x78 fn_80039314 = .text:0x80039314; // type:function size:0x80 fn_80039394 = .text:0x80039394; // type:function size:0x114 fn_800394A8 = .text:0x800394A8; // type:function size:0xE8 -fn_80039590 = .text:0x80039590; // type:function size:0xC -fn_8003959C = .text:0x8003959C; // type:function size:0x1C +EnableOutput__Q34nw4r3snd13RemoteSpeakerFb = .text:0x80039590; // type:function size:0xC +IsEnabledOutput__Q34nw4r3snd13RemoteSpeakerCFv = .text:0x8003959C; // type:function size:0x1C fn_800395B8 = .text:0x800395B8; // type:function size:0x2E0 fn_80039898 = .text:0x80039898; // type:function size:0xB8 fn_80039950 = .text:0x80039950; // type:function size:0xA0 fn_800399F0 = .text:0x800399F0; // type:function size:0x58 fn_80039A48 = .text:0x80039A48; // type:function size:0x74 -fn_80039ABC = .text:0x80039ABC; // type:function size:0x98 -fn_80039B54 = .text:0x80039B54; // type:function size:0x10 +GetInstance__Q44nw4r3snd6detail20RemoteSpeakerManagerFv = .text:0x80039ABC; // type:function size:0x98 +GetRemoteSpeaker__Q44nw4r3snd6detail20RemoteSpeakerManagerFi = .text:0x80039B54; // type:function size:0x10 fn_80039B64 = .text:0x80039B64; // type:function size:0xCC fn_80039C30 = .text:0x80039C30; // type:function size:0x44 fn_80039C74 = .text:0x80039C74; // type:function size:0xF0 @@ -1271,16 +1271,16 @@ fn_8003B438 = .text:0x8003B438; // type:function size:0x8 fn_8003B440 = .text:0x8003B440; // type:function size:0x8 fn_8003B448 = .text:0x8003B448; // type:function size:0xCC fn_8003B514 = .text:0x8003B514; // type:function size:0x8 -fn_8003B51C = .text:0x8003B51C; // type:function size:0x2C +WriteVariable__Q44nw4r3snd6detail8SeqSoundFis = .text:0x8003B51C; // type:function size:0x2C WriteGlobalVariable__Q44nw4r3snd6detail8SeqSoundFis = .text:0x8003B548; // type:function size:0x28 -fn_8003B570 = .text:0x8003B570; // type:function size:0x14 -fn_8003B584 = .text:0x8003B584; // type:function size:0x8 +IsAttachedTempSpecialHandle__Q44nw4r3snd6detail8SeqSoundFv = .text:0x8003B570; // type:function size:0x14 +DetachTempSpecialHandle__Q44nw4r3snd6detail8SeqSoundFv = .text:0x8003B584; // type:function size:0x8 fn_8003B58C = .text:0x8003B58C; // type:function size:0x8 fn_8003B594 = .text:0x8003B594; // type:function size:0x8 fn_8003B59C = .text:0x8003B59C; // type:function size:0x8 fn_8003B5A4 = .text:0x8003B5A4; // type:function size:0xC -fn_8003B5B0 = .text:0x8003B5B0; // type:function size:0x108 -fn_8003B6B8 = .text:0x8003B6B8; // type:function size:0x38 +__ct__Q34nw4r3snd14SeqSoundHandleFPQ34nw4r3snd11SoundHandle = .text:0x8003B5B0; // type:function size:0x108 +DetachSound__Q34nw4r3snd14SeqSoundHandleFv = .text:0x8003B6B8; // type:function size:0x38 fn_8003B6F0 = .text:0x8003B6F0; // type:function size:0x8 fn_8003B6F8 = .text:0x8003B6F8; // type:function size:0x164 fn_8003B85C = .text:0x8003B85C; // type:function size:0x10 @@ -1316,57 +1316,57 @@ fn_8003D428 = .text:0x8003D428; // type:function size:0x24 fn_8003D44C = .text:0x8003D44C; // type:function size:0x8 fn_8003D454 = .text:0x8003D454; // type:function size:0x8 fn_8003D45C = .text:0x8003D45C; // type:function size:0x20 -fn_8003D47C = .text:0x8003D47C; // type:function size:0x24 -fn_8003D4A0 = .text:0x8003D4A0; // type:function size:0x40 -fn_8003D4E0 = .text:0x8003D4E0; // type:function size:0x14 -fn_8003D4F4 = .text:0x8003D4F4; // type:function size:0x8 -fn_8003D4FC = .text:0x8003D4FC; // type:function size:0x18 -fn_8003D514 = .text:0x8003D514; // type:function size:0x8 -fn_8003D51C = .text:0x8003D51C; // type:function size:0x8 -fn_8003D524 = .text:0x8003D524; // type:function size:0x8 +__ct__Q34nw4r3snd12SoundArchiveFv = .text:0x8003D47C; // type:function size:0x24 +__dt__Q34nw4r3snd12SoundArchiveFv = .text:0x8003D4A0; // type:function size:0x40 +IsAvailable__Q34nw4r3snd12SoundArchiveCFv = .text:0x8003D4E0; // type:function size:0x14 +Setup__Q34nw4r3snd12SoundArchiveFPQ44nw4r3snd6detail22SoundArchiveFileReader = .text:0x8003D4F4; // type:function size:0x8 +Shutdown__Q34nw4r3snd12SoundArchiveFv = .text:0x8003D4FC; // type:function size:0x18 +GetPlayerCount__Q34nw4r3snd12SoundArchiveCFv = .text:0x8003D514; // type:function size:0x8 +GetGroupCount__Q34nw4r3snd12SoundArchiveCFv = .text:0x8003D51C; // type:function size:0x8 +GetSoundLabelString__Q34nw4r3snd12SoundArchiveCFUl = .text:0x8003D524; // type:function size:0x8 ConvertLabelStringToSoundId__Q34nw4r3snd12SoundArchiveCFPCc = .text:0x8003D52C; // type:function size:0x10 -fn_8003D53C = .text:0x8003D53C; // type:function size:0x10 -fn_8003D54C = .text:0x8003D54C; // type:function size:0x10 +ConvertLabelStringToPlayerId__Q34nw4r3snd12SoundArchiveCFPCc = .text:0x8003D53C; // type:function size:0x10 +ConvertLabelStringToGroupId__Q34nw4r3snd12SoundArchiveCFPCc = .text:0x8003D54C; // type:function size:0x10 GetSoundUserParam__Q34nw4r3snd12SoundArchiveCFUl = .text:0x8003D55C; // type:function size:0x8 -fn_8003D564 = .text:0x8003D564; // type:function size:0x8 -fn_8003D56C = .text:0x8003D56C; // type:function size:0x8 -fn_8003D574 = .text:0x8003D574; // type:function size:0x8 -fn_8003D57C = .text:0x8003D57C; // type:function size:0x8 -fn_8003D584 = .text:0x8003D584; // type:function size:0x8 -fn_8003D58C = .text:0x8003D58C; // type:function size:0x8 -fn_8003D594 = .text:0x8003D594; // type:function size:0x8 -fn_8003D59C = .text:0x8003D59C; // type:function size:0x8 -fn_8003D5A4 = .text:0x8003D5A4; // type:function size:0x8 -fn_8003D5AC = .text:0x8003D5AC; // type:function size:0x8 -fn_8003D5B4 = .text:0x8003D5B4; // type:function size:0x8 -fn_8003D5BC = .text:0x8003D5BC; // type:function size:0x8 -fn_8003D5C4 = .text:0x8003D5C4; // type:function size:0x8 -fn_8003D5CC = .text:0x8003D5CC; // type:function size:0x224 -fn_8003D7F0 = .text:0x8003D7F0; // type:function size:0x118 -fn_8003D908 = .text:0x8003D908; // type:function size:0x118 -fn_8003DA20 = .text:0x8003DA20; // type:function size:0x7C -fn_8003DA9C = .text:0x8003DA9C; // type:function size:0x24 -fn_8003DAC0 = .text:0x8003DAC0; // type:function size:0xB0 -fn_8003DB70 = .text:0x8003DB70; // type:function size:0xA8 -fn_8003DC18 = .text:0x8003DC18; // type:function size:0xC -fn_8003DC24 = .text:0x8003DC24; // type:function size:0xF0 -fn_8003DD14 = .text:0x8003DD14; // type:function size:0xEC -fn_8003DE00 = .text:0x8003DE00; // type:function size:0x104 -fn_8003DF04 = .text:0x8003DF04; // type:function size:0x80 -fn_8003DF84 = .text:0x8003DF84; // type:function size:0x4C -fn_8003DFD0 = .text:0x8003DFD0; // type:function size:0x70 -fn_8003E040 = .text:0x8003E040; // type:function size:0xAC -fn_8003E0EC = .text:0x8003E0EC; // type:function size:0xB8 -fn_8003E1A4 = .text:0x8003E1A4; // type:function size:0x110 -fn_8003E2B4 = .text:0x8003E2B4; // type:function size:0x138 -fn_8003E3EC = .text:0x8003E3EC; // type:function size:0x84 -fn_8003E470 = .text:0x8003E470; // type:function size:0x40 -fn_8003E4B0 = .text:0x8003E4B0; // type:function size:0x44 -fn_8003E4F4 = .text:0x8003E4F4; // type:function size:0x104 -fn_8003E5F8 = .text:0x8003E5F8; // type:function size:0xB8 -fn_8003E6B0 = .text:0x8003E6B0; // type:function size:0x100 -fn_8003E7B0 = .text:0x8003E7B0; // type:function size:0x120 -fn_8003E8D0 = .text:0x8003E8D0; // type:function size:0x148 +GetSoundType__Q34nw4r3snd12SoundArchiveCFUl = .text:0x8003D564; // type:function size:0x8 +ReadSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive9SoundInfo = .text:0x8003D56C; // type:function size:0x8 +detail_ReadSeqSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive12SeqSoundInfo = .text:0x8003D574; // type:function size:0x8 +detail_ReadStrmSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive13StrmSoundInfo = .text:0x8003D57C; // type:function size:0x8 +detail_ReadWaveSoundInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive13WaveSoundInfo = .text:0x8003D584; // type:function size:0x8 +ReadPlayerInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive10PlayerInfo = .text:0x8003D58C; // type:function size:0x8 +ReadSoundArchivePlayerInfo__Q34nw4r3snd12SoundArchiveCFPQ44nw4r3snd12SoundArchive22SoundArchivePlayerInfo = .text:0x8003D594; // type:function size:0x8 +detail_ReadSound3DParam__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive12Sound3DParam = .text:0x8003D59C; // type:function size:0x8 +detail_ReadBankInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive8BankInfo = .text:0x8003D5A4; // type:function size:0x8 +detail_ReadGroupInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive9GroupInfo = .text:0x8003D5AC; // type:function size:0x8 +detail_ReadGroupItemInfo__Q34nw4r3snd12SoundArchiveCFUlUlPQ44nw4r3snd12SoundArchive13GroupItemInfo = .text:0x8003D5B4; // type:function size:0x8 +detail_ReadFileInfo__Q34nw4r3snd12SoundArchiveCFUlPQ44nw4r3snd12SoundArchive8FileInfo = .text:0x8003D5BC; // type:function size:0x8 +detail_ReadFilePos__Q34nw4r3snd12SoundArchiveCFUlUlPQ44nw4r3snd12SoundArchive7FilePos = .text:0x8003D5C4; // type:function size:0x8 +detail_OpenFileStream__Q34nw4r3snd12SoundArchiveCFUlPvi = .text:0x8003D5CC; // type:function size:0x224 +detail_OpenGroupStream__Q34nw4r3snd12SoundArchiveCFUlPvi = .text:0x8003D7F0; // type:function size:0x118 +detail_OpenGroupWaveDataStream__Q34nw4r3snd12SoundArchiveCFUlPvi = .text:0x8003D908; // type:function size:0x118 +SetExternalFileRoot__Q34nw4r3snd12SoundArchiveFPCc = .text:0x8003DA20; // type:function size:0x7C +__ct__Q44nw4r3snd6detail22SoundArchiveFileReaderFv = .text:0x8003DA9C; // type:function size:0x24 +Init__Q44nw4r3snd6detail22SoundArchiveFileReaderFPCv = .text:0x8003DAC0; // type:function size:0xB0 +SetStringChunk__Q44nw4r3snd6detail22SoundArchiveFileReaderFPCvUl = .text:0x8003DB70; // type:function size:0xA8 +SetInfoChunk__Q44nw4r3snd6detail22SoundArchiveFileReaderFPCvUl = .text:0x8003DC18; // type:function size:0xC +GetSoundType__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUl = .text:0x8003DC24; // type:function size:0xF0 +ReadSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive9SoundInfo = .text:0x8003DD14; // type:function size:0xEC +ReadSound3DParam__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive12Sound3DParam = .text:0x8003DE00; // type:function size:0x104 +ReadSeqSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive12SeqSoundInfo = .text:0x8003DF04; // type:function size:0x80 +ReadStrmSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive13StrmSoundInfo = .text:0x8003DF84; // type:function size:0x4C +ReadWaveSoundInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive13WaveSoundInfo = .text:0x8003DFD0; // type:function size:0x70 +ReadBankInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive8BankInfo = .text:0x8003E040; // type:function size:0xAC +ReadPlayerInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive10PlayerInfo = .text:0x8003E0EC; // type:function size:0xB8 +ReadGroupInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive9GroupInfo = .text:0x8003E1A4; // type:function size:0x110 +ReadGroupItemInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlUlPQ44nw4r3snd12SoundArchive13GroupItemInfo = .text:0x8003E2B4; // type:function size:0x138 +ReadSoundArchivePlayerInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFPQ44nw4r3snd12SoundArchive22SoundArchivePlayerInfo = .text:0x8003E3EC; // type:function size:0x84 +GetPlayerCount__Q44nw4r3snd6detail22SoundArchiveFileReaderCFv = .text:0x8003E470; // type:function size:0x40 +GetGroupCount__Q44nw4r3snd6detail22SoundArchiveFileReaderCFv = .text:0x8003E4B0; // type:function size:0x44 +GetSoundLabelString__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUl = .text:0x8003E4F4; // type:function size:0x104 +GetSoundUserParam__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUl = .text:0x8003E5F8; // type:function size:0xB8 +ReadFileInfo__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlPQ44nw4r3snd12SoundArchive8FileInfo = .text:0x8003E6B0; // type:function size:0x100 +ReadFilePos__Q44nw4r3snd6detail22SoundArchiveFileReaderCFUlUlPQ44nw4r3snd12SoundArchive7FilePos = .text:0x8003E7B0; // type:function size:0x120 +ConvertLabelStringToId__Q44nw4r3snd6detail22SoundArchiveFileReaderCFPCQ54nw4r3snd6detail16SoundArchiveFile10StringTreePCc = .text:0x8003E8D0; // type:function size:0x148 fn_8003EA18 = .text:0x8003EA18; // type:function size:0xF4 fn_8003EB0C = .text:0x8003EB0C; // type:function size:0x3C fn_8003EB48 = .text:0x8003EB48; // type:function size:0x40 @@ -2469,7 +2469,7 @@ fn_80070B08 = .text:0x80070B08; // type:function size:0x80 fn_80070B88 = .text:0x80070B88; // type:function size:0x30 fn_80070BB8 = .text:0x80070BB8; // type:function size:0xC fn_80070BC4 = .text:0x80070BC4; // type:function size:0x410 -fn_80070FD4 = .text:0x80070FD4; // type:function size:0xF8 +G3dInit__Q24nw4r3g3dFb = .text:0x80070FD4; // type:function size:0xF8 G3dReset__Q24nw4r3g3dFv = .text:0x800710CC; // type:function size:0x8 fn_800710D4 = .text:0x800710D4; // type:function size:0x104 fn_800711D8 = .text:0x800711D8; // type:function size:0x108 @@ -2698,7 +2698,7 @@ setAxisRotation__Q23EGG5QuatfFRCQ23EGG8Vector3ff = .text:0x8007DF04; // type:fun normalise__Q23EGG8Vector3fFv = .text:0x8007DF9C; // type:function size:0x7C __sinit_\eggVector_cpp = .text:0x8007E018; // type:function size:0x130 fn_8007E148 = .text:0x8007E148; // type:function size:0x74 -fn_8007E1BC = .text:0x8007E1BC; // type:function size:0xA8 +create__Q23EGG7ExpHeapFPvUlUs = .text:0x8007E1BC; // type:function size:0xA8 create__Q23EGG7ExpHeapFUlPQ23EGG4HeapUs = .text:0x8007E264; // type:function size:0x12C fn_8007E390 = .text:0x8007E390; // type:function size:0x70 fn_8007E400 = .text:0x8007E400; // type:function size:0x8 @@ -2956,24 +2956,24 @@ fn_80088908 = .text:0x80088908; // type:function size:0x38 fn_80088940 = .text:0x80088940; // type:function size:0x8 fn_80088948 = .text:0x80088948; // type:function size:0x8 fn_80088950 = .text:0x80088950; // type:function size:0x8 -fn_80088958 = .text:0x80088958; // type:function size:0x18 -fn_80088970 = .text:0x80088970; // type:function size:0xD0 -fn_80088A40 = .text:0x80088A40; // type:function size:0x244 -fn_80088C84 = .text:0x80088C84; // type:function size:0x244 -fn_80088EC8 = .text:0x80088EC8; // type:function size:0x244 -fn_8008910C = .text:0x8008910C; // type:function size:0x244 -fn_80089350 = .text:0x80089350; // type:function size:0x48 -fn_80089398 = .text:0x80089398; // type:function size:0x64 -fn_800893FC = .text:0x800893FC; // type:function size:0xC0 -fn_800894BC = .text:0x800894BC; // type:function size:0x70 -fn_8008952C = .text:0x8008952C; // type:function size:0x70 -fn_8008959C = .text:0x8008959C; // type:function size:0x70 -fn_8008960C = .text:0x8008960C; // type:function size:0x70 -fn_8008967C = .text:0x8008967C; // type:function size:0xD0 -fn_8008974C = .text:0x8008974C; // type:function size:0xC -fn_80089758 = .text:0x80089758; // type:function size:0xC -fn_80089764 = .text:0x80089764; // type:function size:0xC -fn_80089770 = .text:0x80089770; // type:function size:0xC +__ct__Q23EGG7AudioFxFv = .text:0x80088958; // type:function size:0x18 +__dt__Q23EGG7AudioFxFv = .text:0x80088970; // type:function size:0xD0 +createFxReverbHi__Q23EGG7AudioFxFPCQ44nw4r3snd10FxReverbHi13ReverbHiParam = .text:0x80088A40; // type:function size:0x244 +createFxReverbHiDpl2__Q23EGG7AudioFxFPCQ44nw4r3snd14FxReverbHiDpl217ReverbHiDpl2Param = .text:0x80088C84; // type:function size:0x244 +createFxChorus__Q23EGG7AudioFxFPCQ44nw4r3snd8FxChorus11ChorusParam = .text:0x80088EC8; // type:function size:0x244 +createFxDelay__Q23EGG7AudioFxFPCQ44nw4r3snd7FxDelay10DelayParam = .text:0x8008910C; // type:function size:0x244 +__ct__Q23EGG10AudioFxMgrFv = .text:0x80089350; // type:function size:0x48 +__dt__Q23EGG10AudioFxMgrFv = .text:0x80089398; // type:function size:0x64 +initializeFx__Q23EGG10AudioFxMgrFPQ34nw4r3snd9SoundHeapPQ33EGG10AudioFxMgr13AudioFxMgrArg = .text:0x800893FC; // type:function size:0xC0 +setFxReverbHi__Q23EGG10AudioFxMgrFQ34nw4r3snd6AuxBusPCQ44nw4r3snd10FxReverbHi13ReverbHiParam = .text:0x800894BC; // type:function size:0x70 +setFxReverbHiDpl2__Q23EGG10AudioFxMgrFQ34nw4r3snd6AuxBusPCQ44nw4r3snd14FxReverbHiDpl217ReverbHiDpl2Param = .text:0x8008952C; // type:function size:0x70 +setFxChorus__Q23EGG10AudioFxMgrFQ34nw4r3snd6AuxBusPCQ44nw4r3snd8FxChorus11ChorusParam = .text:0x8008959C; // type:function size:0x70 +setFxDelay__Q23EGG10AudioFxMgrFQ34nw4r3snd6AuxBusPCQ44nw4r3snd7FxDelay10DelayParam = .text:0x8008960C; // type:function size:0x70 +clearFx__Q23EGG10AudioFxMgrFQ34nw4r3snd6AuxBus = .text:0x8008967C; // type:function size:0xD0 +getDefaultFxReverbHi__Q23EGG10AudioFxMgrFv = .text:0x8008974C; // type:function size:0xC +getDefaultFxReverbHiDpl2__Q23EGG10AudioFxMgrFv = .text:0x80089758; // type:function size:0xC +getDefaultFxChorus__Q23EGG10AudioFxMgrFv = .text:0x80089764; // type:function size:0xC +getDefaultFxDelay__Q23EGG10AudioFxMgrFv = .text:0x80089770; // type:function size:0xC decode__Q23EGG6DecompFPUcPUc = .text:0x8008977C; // type:function size:0x260 decodeASH__Q23EGG6DecompFPUcPUc = .text:0x800899DC; // type:function size:0x300 decodeASR__Q23EGG6DecompFPUcPUc = .text:0x80089CDC; // type:function size:0x940 @@ -3728,7 +3728,7 @@ GXSetDither = .text:0x800BB3B8; // type:function size:0x2C GXSetDstAlpha = .text:0x800BB3E4; // type:function size:0x30 fn_800BB414 = .text:0x800BB414; // type:function size:0x34 fn_800BB448 = .text:0x800BB448; // type:function size:0x70 -fn_800BB4B8 = .text:0x800BB4B8; // type:function size:0x840 +GXDrawCylinder = .text:0x800BB4B8; // type:function size:0x840 fn_800BBCF8 = .text:0x800BBCF8; // type:function size:0x3E4 fn_800BC0DC = .text:0x800BC0DC; // type:function size:0x3D0 fn_800BC4AC = .text:0x800BC4AC; // type:function size:0x200 @@ -4512,45 +4512,45 @@ PPCDisableSpeculation = .text:0x800E40C8; // type:function size:0x28 scope:globa PPCSetFpNonIEEEMode = .text:0x800E40F0; // type:function size:0x8 scope:global fn_800E40F8 = .text:0x800E40F8; // type:function size:0x8 PPCMthid4 = .text:0x800E4100; // type:function size:0x50 scope:global -fn_800E4150 = .text:0x800E4150; // type:function size:0x220 -fn_800E4370 = .text:0x800E4370; // type:function size:0x2AC -fn_800E461C = .text:0x800E461C; // type:function size:0x14 -fn_800E4630 = .text:0x800E4630; // type:function size:0x1A0 -fn_800E47D0 = .text:0x800E47D0; // type:function size:0xE8 -fn_800E48B8 = .text:0x800E48B8; // type:function size:0x170 -fn_800E4A28 = .text:0x800E4A28; // type:function size:0x44 -fn_800E4A6C = .text:0x800E4A6C; // type:function size:0x1BC -fn_800E4C28 = .text:0x800E4C28; // type:function size:0xB0 -fn_800E4CD8 = .text:0x800E4CD8; // type:function size:0x13C -fn_800E4E14 = .text:0x800E4E14; // type:function size:0x140 -fn_800E4F54 = .text:0x800E4F54; // type:function size:0xA0 -fn_800E4FF4 = .text:0x800E4FF4; // type:function size:0xC4 -fn_800E50B8 = .text:0x800E50B8; // type:function size:0x8 -fn_800E50C0 = .text:0x800E50C0; // type:function size:0x1C -fn_800E50DC = .text:0x800E50DC; // type:function size:0x10 -fn_800E50EC = .text:0x800E50EC; // type:function size:0x348 -fn_800E5434 = .text:0x800E5434; // type:function size:0x160 -fn_800E5594 = .text:0x800E5594; // type:function size:0xBC -fn_800E5650 = .text:0x800E5650; // type:function size:0x14 -fn_800E5664 = .text:0x800E5664; // type:function size:0x150 -fn_800E57B4 = .text:0x800E57B4; // type:function size:0x88 -fn_800E583C = .text:0x800E583C; // type:function size:0x14 -fn_800E5850 = .text:0x800E5850; // type:function size:0x8C -fn_800E58DC = .text:0x800E58DC; // type:function size:0xEC -fn_800E59C8 = .text:0x800E59C8; // type:function size:0x124 -fn_800E5AEC = .text:0x800E5AEC; // type:function size:0x90 -fn_800E5B7C = .text:0x800E5B7C; // type:function size:0xA8 -fn_800E5C24 = .text:0x800E5C24; // type:function size:0x4 -fn_800E5C28 = .text:0x800E5C28; // type:function size:0x4 -fn_800E5C2C = .text:0x800E5C2C; // type:function size:0x4 -fn_800E5C30 = .text:0x800E5C30; // type:function size:0x4 -fn_800E5C34 = .text:0x800E5C34; // type:function size:0xA4 -fn_800E5CD8 = .text:0x800E5CD8; // type:function size:0x8 -fn_800E5CE0 = .text:0x800E5CE0; // type:function size:0x24 -fn_800E5D04 = .text:0x800E5D04; // type:function size:0x44 -fn_800E5D48 = .text:0x800E5D48; // type:function size:0x4 -fn_800E5D4C = .text:0x800E5D4C; // type:function size:0x2C -fn_800E5D78 = .text:0x800E5D78; // type:function size:0x4 +gki_init_free_queue = .text:0x800E4150; // type:function size:0x220 +gki_buffer_init = .text:0x800E4370; // type:function size:0x2AC +GKI_init_q = .text:0x800E461C; // type:function size:0x14 +GKI_getbuf = .text:0x800E4630; // type:function size:0x1A0 +GKI_getpoolbuf = .text:0x800E47D0; // type:function size:0xE8 +GKI_freebuf = .text:0x800E48B8; // type:function size:0x170 +GKI_get_buf_size = .text:0x800E4A28; // type:function size:0x44 +GKI_send_msg = .text:0x800E4A6C; // type:function size:0x1BC +GKI_read_mbox = .text:0x800E4C28; // type:function size:0xB0 +GKI_enqueue = .text:0x800E4CD8; // type:function size:0x13C +GKI_enqueue_head = .text:0x800E4E14; // type:function size:0x140 +GKI_dequeue = .text:0x800E4F54; // type:function size:0xA0 +GKI_remove_from_queue = .text:0x800E4FF4; // type:function size:0xC4 +GKI_getfirst = .text:0x800E50B8; // type:function size:0x8 +GKI_getnext = .text:0x800E50C0; // type:function size:0x1C +GKI_queue_is_empty = .text:0x800E50DC; // type:function size:0x10 +GKI_create_pool = .text:0x800E50EC; // type:function size:0x348 +GKI_delete_pool = .text:0x800E5434; // type:function size:0x160 +gki_timers_init = .text:0x800E5594; // type:function size:0xBC +GKI_get_tick_count = .text:0x800E5650; // type:function size:0x14 +GKI_start_timer = .text:0x800E5664; // type:function size:0x150 +GKI_stop_timer = .text:0x800E57B4; // type:function size:0x88 +GKI_init_timer_list = .text:0x800E583C; // type:function size:0x14 +GKI_update_timer_list = .text:0x800E5850; // type:function size:0x8C +GKI_add_to_timer_list = .text:0x800E58DC; // type:function size:0xEC +GKI_remove_from_timer_list = .text:0x800E59C8; // type:function size:0x124 +GKI_init = .text:0x800E5AEC; // type:function size:0x90 +GKI_shutdown = .text:0x800E5B7C; // type:function size:0xA8 +GKI_run = .text:0x800E5C24; // type:function size:0x4 +GKI_sched_lock = .text:0x800E5C28; // type:function size:0x4 +GKI_sched_unlock = .text:0x800E5C2C; // type:function size:0x4 +GKI_delay = .text:0x800E5C30; // type:function size:0x4 +GKI_send_event = .text:0x800E5C34; // type:function size:0xA4 +GKI_get_taskid = .text:0x800E5CD8; // type:function size:0x8 +GKI_enable = .text:0x800E5CE0; // type:function size:0x24 +GKI_disable = .text:0x800E5D04; // type:function size:0x44 +GKI_exception = .text:0x800E5D48; // type:function size:0x4 +GKI_os_malloc = .text:0x800E5D4C; // type:function size:0x2C +GKI_os_free = .text:0x800E5D78; // type:function size:0x4 fn_800E5D7C = .text:0x800E5D7C; // type:function size:0x24 fn_800E5DA0 = .text:0x800E5DA0; // type:function size:0x398 fn_800E6138 = .text:0x800E6138; // type:function size:0x1AC @@ -6647,8 +6647,8 @@ fn_801651AC = .text:0x801651AC; // type:function size:0x68 fn_80165214 = .text:0x80165214; // type:function size:0x58 fn_8016526C = .text:0x8016526C; // type:function size:0x128 fn_80165394 = .text:0x80165394; // type:function size:0x34 -fn_801653C8 = .text:0x801653C8; // type:function size:0x40 -fn_80165408 = .text:0x80165408; // type:function size:0x10 +__dt__15RP_DEBUG_STUB_1Fv = .text:0x801653C8; // type:function size:0x40 +__ct__15RP_DEBUG_STUB_1Fv = .text:0x80165408; // type:function size:0x10 fn_80165418 = .text:0x80165418; // type:function size:0x40 fn_80165458 = .text:0x80165458; // type:function size:0x194 fn_801655EC = .text:0x801655EC; // type:function size:0x114 @@ -7035,13 +7035,13 @@ fn_8017866C = .text:0x8017866C; // type:function size:0x540 fn_80178BAC = .text:0x80178BAC; // type:function size:0x40 fn_80178BEC = .text:0x80178BEC; // type:function size:0x68 fn_80178C54 = .text:0x80178C54; // type:function size:0x15C -fn_80178DB0 = .text:0x80178DB0; // type:function size:0x244 -fn_80178FF4 = .text:0x80178FF4; // type:function size:0x4C -fn_80179040 = .text:0x80179040; // type:function size:0x4C -fn_8017908C = .text:0x8017908C; // type:function size:0x50 -fn_801790DC = .text:0x801790DC; // type:function size:0x24C +SyncFromMatrix__11RPGrpCameraFUs = .text:0x80178DB0; // type:function size:0x244 +GetScreenToWorld__11RPGrpCameraCFPQ34nw4r4math4VEC3RCQ34nw4r4math4VEC2PC11RPGrpScreen = .text:0x80178FF4; // type:function size:0x4C +GetScreenToWorld__11RPGrpCameraCFPQ34nw4r4math4VEC3RCQ34nw4r4math4VEC3PC11RPGrpScreen = .text:0x80179040; // type:function size:0x4C +GetWorldToScreen__11RPGrpCameraCFPQ34nw4r4math4VEC3RCQ34nw4r4math4VEC3PC11RPGrpScreen = .text:0x8017908C; // type:function size:0x50 +CalcMatrix__11RPGrpCameraFv = .text:0x801790DC; // type:function size:0x24C fn_80179328 = .text:0x80179328; // type:function size:0x44 -fn_8017936C = .text:0x8017936C; // type:function size:0x8C +__ct__11RPGrpCameraFv = .text:0x8017936C; // type:function size:0x8C fn_801793F8 = .text:0x801793F8; // type:function size:0x40 fn_80179438 = .text:0x80179438; // type:function size:0x324 fn_8017975C = .text:0x8017975C; // type:function size:0xA8 @@ -7183,24 +7183,24 @@ fn_801808A8 = .text:0x801808A8; // type:function size:0xBC fn_80180964 = .text:0x80180964; // type:function size:0x40 fn_801809A4 = .text:0x801809A4; // type:function size:0x3C fn_801809E0 = .text:0x801809E0; // type:function size:0x8 -fn_801809E8 = .text:0x801809E8; // type:function size:0x44 -fn_80180A2C = .text:0x80180A2C; // type:function size:0xF8 +RemoveGenList__10RPGrpModelFv = .text:0x801809E8; // type:function size:0x44 +SetReverseCulling__10RPGrpModelFb = .text:0x80180A2C; // type:function size:0xF8 CalcMaterial__10RPGrpModelFv = .text:0x80180B24; // type:function size:0x78 Entry__10RPGrpModelFv = .text:0x80180B9C; // type:function size:0x2C Calc__10RPGrpModelFv = .text:0x80180BC8; // type:function size:0x74 -fn_80180C3C = .text:0x80180C3C; // type:function size:0x5C -fn_80180C98 = .text:0x80180C98; // type:function size:0x64 -fn_80180CFC = .text:0x80180CFC; // type:function size:0x84 -fn_80180D80 = .text:0x80180D80; // type:function size:0x110 +UpdateFrame__10RPGrpModelFv = .text:0x80180C3C; // type:function size:0x5C +CreateRecord__10RPGrpModelFUs = .text:0x80180C98; // type:function size:0x64 +CreateBoundingInfo__10RPGrpModelFUl = .text:0x80180CFC; // type:function size:0x84 +Configure__10RPGrpModelFv = .text:0x80180D80; // type:function size:0x110 SetCallback__10RPGrpModelFP19IRPGrpModelCallback = .text:0x80180E90; // type:function size:0x10 __dt__10RPGrpModelFv = .text:0x80180EA0; // type:function size:0x40 __ct__10RPGrpModelFUc = .text:0x80180EE0; // type:function size:0xBC Construct__10RPGrpModelFUsPCcUcUlUl = .text:0x80180F9C; // type:function size:0x94 Construct__10RPGrpModelFUsiUcUlUl = .text:0x80181030; // type:function size:0x94 Construct__10RPGrpModelFUsUcUlUl = .text:0x801810C4; // type:function size:0xB4 -fn_80181178 = .text:0x80181178; // type:function size:0x8 -fn_80181180 = .text:0x80181180; // type:function size:0x8 -fn_80181188 = .text:0x80181188; // type:function size:0x8 +GetJointNum__10RPGrpModelCFv = .text:0x80181178; // type:function size:0x8 +GetShapeNum__10RPGrpModelCFv = .text:0x80181180; // type:function size:0x8 +GetViewMtxNum__10RPGrpModelCFv = .text:0x80181188; // type:function size:0x8 InternalRegist__13RPGrpModelAnmFQ213RPGrpModelAnm3AnmUs = .text:0x80181190; // type:function size:0x1C GetBlendIndex__13RPGrpModelAnmFQ213RPGrpModelAnm3AnmUsUc = .text:0x801811AC; // type:function size:0x7C SetBlendAnm__13RPGrpModelAnmFQ213RPGrpModelAnm3AnmUcUs = .text:0x80181228; // type:function size:0x110 @@ -7217,19 +7217,19 @@ __dt__13RPGrpModelAnmFv = .text:0x80181944; // type:function size:0x40 GetUpdateRate__25RPGrpModelAnmImplement<1>CFQ213RPGrpModelAnm3AnmUs = .text:0x80181984; // type:function size:0x3C GetAnmObj__25RPGrpModelAnmImplement<1>CFQ213RPGrpModelAnm3AnmUs = .text:0x801819C0; // type:function size:0x4 SetUpdateRate__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUsf = .text:0x801819C4; // type:function size:0x4C -fn_80181A10 = .text:0x80181A10; // type:function size:0x3C -fn_80181A4C = .text:0x80181A4C; // type:function size:0x4C -fn_80181A98 = .text:0x80181A98; // type:function size:0xF0 -fn_80181B88 = .text:0x80181B88; // type:function size:0xE8 -fn_80181C70 = .text:0x80181C70; // type:function size:0x8 -fn_80181C78 = .text:0x80181C78; // type:function size:0x8 -fn_80181C80 = .text:0x80181C80; // type:function size:0x4 -fn_80181C84 = .text:0x80181C84; // type:function size:0x24 -fn_80181CA8 = .text:0x80181CA8; // type:function size:0x190 -fn_80181E38 = .text:0x80181E38; // type:function size:0x54 -fn_80181E8C = .text:0x80181E8C; // type:function size:0x60 -fn_80181EEC = .text:0x80181EEC; // type:function size:0x58 -fn_80181F44 = .text:0x80181F44; // type:function size:0x100 +GetFrame__25RPGrpModelAnmImplement<1>CFQ213RPGrpModelAnm3AnmUs = .text:0x80181A10; // type:function size:0x3C +SetFrame__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUsf = .text:0x80181A4C; // type:function size:0x4C +GetAnmPlayPolicy__25RPGrpModelAnmImplement<1>CFQ213RPGrpModelAnm3AnmUs = .text:0x80181A98; // type:function size:0xF0 +GetNumFrame__25RPGrpModelAnmImplement<1>CFQ213RPGrpModelAnm3AnmUs = .text:0x80181B88; // type:function size:0xE8 +VF_0x48__25RPGrpModelAnmImplement<1>Fv = .text:0x80181C70; // type:function size:0x8 +VF_0x44__25RPGrpModelAnmImplement<1>Fv = .text:0x80181C78; // type:function size:0x8 +VF_0x70__25RPGrpModelAnmImplement<1>Fv = .text:0x80181C80; // type:function size:0x4 +SetEnableQuaternionBlend__25RPGrpModelAnmImplement<1>Fb = .text:0x80181C84; // type:function size:0x24 +UpdateFrame__25RPGrpModelAnmImplement<1>Fv = .text:0x80181CA8; // type:function size:0x190 +ReleaseChrAnmNode__25RPGrpModelAnmImplement<1>FUsUsQ213RPGrpModelAnm8BindType = .text:0x80181E38; // type:function size:0x54 +GetBlendWeight__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUcUc = .text:0x80181E8C; // type:function size:0x60 +GetBlendAnm__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUcUc = .text:0x80181EEC; // type:function size:0x58 +RemoveBlendAnm__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUcUc = .text:0x80181F44; // type:function size:0x100 fn_80182044 = .text:0x80182044; // type:function size:0x58 fn_8018209C = .text:0x8018209C; // type:function size:0xD8 fn_80182174 = .text:0x80182174; // type:function size:0x1C0 @@ -7239,11 +7239,11 @@ fn_80182A18 = .text:0x80182A18; // type:function size:0x430 fn_80182E48 = .text:0x80182E48; // type:function size:0x84 fn_80182ECC = .text:0x80182ECC; // type:function size:0x74 fn_80182F40 = .text:0x80182F40; // type:function size:0x4 -fn_80182F44 = .text:0x80182F44; // type:function size:0xA8 -fn_80182FEC = .text:0x80182FEC; // type:function size:0x60 -fn_8018304C = .text:0x8018304C; // type:function size:0x40 -fn_8018308C = .text:0x8018308C; // type:function size:0x44C -fn_801834D8 = .text:0x801834D8; // type:function size:0x44C +InternalGetAnmObj__25RPGrpModelAnmImplement<1>CFQ213RPGrpModelAnm3AnmUs = .text:0x80182F44; // type:function size:0xA8 +SetAnmObj__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmPPQ34nw4r3g3d6AnmObj = .text:0x80182FEC; // type:function size:0x60 +__dt__25RPGrpModelAnmImplement<1>Fv = .text:0x8018304C; // type:function size:0x40 +RegistFromResFile__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUsUsUl = .text:0x8018308C; // type:function size:0x44C +RegistFromResFile__25RPGrpModelAnmImplement<1>FQ213RPGrpModelAnm3AnmUsUsPCc = .text:0x801834D8; // type:function size:0x44C fn_80183924 = .text:0x80183924; // type:function size:0x34 fn_80183958 = .text:0x80183958; // type:function size:0x34 fn_8018398C = .text:0x8018398C; // type:function size:0x30 @@ -7311,7 +7311,7 @@ fn_801852E8 = .text:0x801852E8; // type:function size:0x34 fn_8018531C = .text:0x8018531C; // type:function size:0xC fn_80185328 = .text:0x80185328; // type:function size:0x8 fn_80185330 = .text:0x80185330; // type:function size:0x4 -fn_80185334 = .text:0x80185334; // type:function size:0x58 +__dt__13RPGrpModelG3DFv = .text:0x80185334; // type:function size:0x58 fn_8018538C = .text:0x8018538C; // type:function size:0x8 fn_80185394 = .text:0x80185394; // type:function size:0x8 fn_8018539C = .text:0x8018539C; // type:function size:0x8 @@ -7325,10 +7325,10 @@ fn_801853D4 = .text:0x801853D4; // type:function size:0x8 fn_801853DC = .text:0x801853DC; // type:function size:0x174 fn_80185550 = .text:0x80185550; // type:function size:0x104 fn_80185654 = .text:0x80185654; // type:function size:0xC -fn_80185660 = .text:0x80185660; // type:function size:0x10 +GetBinaryType__14RPGrpModelMiscCFv = .text:0x80185660; // type:function size:0x10 fn_80185670 = .text:0x80185670; // type:function size:0x10 fn_80185680 = .text:0x80185680; // type:function size:0x10 -fn_80185690 = .text:0x80185690; // type:function size:0x10 +GetDrawPathManager__17RPGrpModelManagerCFUc = .text:0x80185690; // type:function size:0x10 fn_801856A0 = .text:0x801856A0; // type:function size:0x50 fn_801856F0 = .text:0x801856F0; // type:function size:0x60 fn_80185750 = .text:0x80185750; // type:function size:0x58 @@ -7345,13 +7345,13 @@ fn_80185AA4 = .text:0x80185AA4; // type:function size:0x40 InternalGetResultTransform__20RPGrpModelResManagerFQ34nw4r3g3d9ResAnmChrUsfPQ23EGG9Matrix34fPQ23EGG8Vector3fPQ23EGG8Vector3fPQ23EGG8Vector3f = .text:0x80185AE4; // type:function size:0xA8 GetResultTransform__20RPGrpModelResManagerFUsUsfPQ23EGG9Matrix34fPQ23EGG8Vector3fPQ23EGG8Vector3fPQ23EGG8Vector3f = .text:0x80185B8C; // type:function size:0xD0 HasFile__20RPGrpModelResManagerCFQ220RPGrpModelResManager4TypeUsPCc = .text:0x80185C5C; // type:function size:0x24C -fn_80185EA8 = .text:0x80185EA8; // type:function size:0x270 -fn_80186118 = .text:0x80186118; // type:function size:0x1D4 -fn_801862EC = .text:0x801862EC; // type:function size:0x1D4 -fn_801864C0 = .text:0x801864C0; // type:function size:0xA0 -fn_80186560 = .text:0x80186560; // type:function size:0x48 -fn_801865A8 = .text:0x801865A8; // type:function size:0xB0 -fn_80186658 = .text:0x80186658; // type:function size:0x84 +InternalCreateData__20RPGrpModelResManagerFUsQ220RPGrpModelResManager4TypePvUl = .text:0x80185EA8; // type:function size:0x270 +GetPtr__20RPGrpModelResManagerCFQ220RPGrpModelResManager4TypeUsi = .text:0x80186118; // type:function size:0x1D4 +GetPtr__20RPGrpModelResManagerCFQ220RPGrpModelResManager4TypeUsPCc = .text:0x801862EC; // type:function size:0x1D4 +CreateData__20RPGrpModelResManagerFQ220RPGrpModelResManager4TypePvUl = .text:0x801864C0; // type:function size:0xA0 +SearchData__20RPGrpModelResManagerCFPv = .text:0x80186560; // type:function size:0x48 +TerminateAll__20RPGrpModelResManagerFv = .text:0x801865A8; // type:function size:0xB0 +Terminate__20RPGrpModelResManagerFUs = .text:0x80186658; // type:function size:0x84 CreateResourceList__20RPGrpModelResManagerFUs = .text:0x801866DC; // type:function size:0x1E8 Configure__20RPGrpModelResManagerFv = .text:0x801868C4; // type:function size:0x10 __ct__20RPGrpModelResManagerFv = .text:0x801868D4; // type:function size:0x10 @@ -7381,7 +7381,7 @@ fn_801877BC = .text:0x801877BC; // type:function size:0x94 fn_80187850 = .text:0x80187850; // type:function size:0x40 fn_80187890 = .text:0x80187890; // type:function size:0x40 fn_801878D0 = .text:0x801878D0; // type:function size:0x30 -SetTVMode__Q23EGG6ScreenFQ33EGG6Screen6TVMode = .text:0x80187900; // type:function size:0xBC +fn_80187900 = .text:0x80187900; // type:function size:0xBC fn_801879BC = .text:0x801879BC; // type:function size:0x608 fn_80187FC4 = .text:0x80187FC4; // type:function size:0x74 fn_80188038 = .text:0x80188038; // type:function size:0x54 @@ -7551,20 +7551,20 @@ fn_8018EF28 = .text:0x8018EF28; // type:function size:0x10C fn_8018F034 = .text:0x8018F034; // type:function size:0xE0 fn_8018F114 = .text:0x8018F114; // type:function size:0x50 fn_8018F164 = .text:0x8018F164; // type:function size:0x3C -fn_8018F1A0 = .text:0x8018F1A0; // type:function size:0x6C -fn_8018F20C = .text:0x8018F20C; // type:function size:0x58 -fn_8018F264 = .text:0x8018F264; // type:function size:0x440 +allocWithHeaderDebug__15RPGrpCpuTextureFv = .text:0x8018F1A0; // type:function size:0x6C +alloc__15RPGrpCpuTextureFv = .text:0x8018F20C; // type:function size:0x58 +fillGradationTable__15RPGrpCpuTextureFQ215RPGrpCpuTexture14EGradationKindiUsUsRC8_GXColorRC8_GXColorbb = .text:0x8018F264; // type:function size:0x440 fn_8018F6A4 = .text:0x8018F6A4; // type:function size:0x294 -fn_8018F938 = .text:0x8018F938; // type:function size:0x84 -fn_8018F9BC = .text:0x8018F9BC; // type:function size:0x1C -fn_8018F9D8 = .text:0x8018F9D8; // type:function size:0x4C -fn_8018FA24 = .text:0x8018FA24; // type:function size:0x4C -fn_8018FA70 = .text:0x8018FA70; // type:function size:0x48 -fn_8018FAB8 = .text:0x8018FAB8; // type:function size:0x80 +initResTIMG__15RPGrpCpuTextureCFv = .text:0x8018F938; // type:function size:0x84 +getTexBufferSize__15RPGrpCpuTextureCFv = .text:0x8018F9BC; // type:function size:0x1C +flush__15RPGrpCpuTextureCFv = .text:0x8018F9D8; // type:function size:0x4C +invalidate__15RPGrpCpuTextureCFv = .text:0x8018FA24; // type:function size:0x4C +load__15RPGrpCpuTextureF11_GXTexMapID = .text:0x8018FA70; // type:function size:0x48 +getTexObj__15RPGrpCpuTextureCFP9_GXTexObj = .text:0x8018FAB8; // type:function size:0x80 fn_8018FB38 = .text:0x8018FB38; // type:function size:0x20 fn_8018FB58 = .text:0x8018FB58; // type:function size:0x24 fn_8018FB7C = .text:0x8018FB7C; // type:function size:0x28 -fn_8018FBA4 = .text:0x8018FBA4; // type:function size:0x54C +makeGradationTable__FQ215RPGrpCpuTexture14EGradationKindP8_GXColorUsUsUsRC8_GXColorRC8_GXColor = .text:0x8018FBA4; // type:function size:0x54C fn_801900F0 = .text:0x801900F0; // type:function size:0xA4 fn_80190194 = .text:0x80190194; // type:function size:0x78 fn_8019020C = .text:0x8019020C; // type:function size:0xA8 @@ -7712,8 +7712,8 @@ fn_80198744 = .text:0x80198744; // type:function size:0xAC fn_801987F0 = .text:0x801987F0; // type:function size:0x1A0 fn_80198990 = .text:0x80198990; // type:function size:0x170 fn_80198B00 = .text:0x80198B00; // type:function size:0x1B4 -fn_80198CB4 = .text:0x80198CB4; // type:function size:0x660 -fn_80199314 = .text:0x80199314; // type:function size:0x66C +Calc__18RPGrpModelMaterialFv = .text:0x80198CB4; // type:function size:0x660 +__ct__18RPGrpModelMaterialFP10RPGrpModelUs = .text:0x80199314; // type:function size:0x66C fn_80199980 = .text:0x80199980; // type:function size:0x124 fn_80199AA4 = .text:0x80199AA4; // type:function size:0x84 fn_80199B28 = .text:0x80199B28; // type:function size:0x40 @@ -7723,8 +7723,8 @@ fn_8019A310 = .text:0x8019A310; // type:function size:0x70 fn_8019A380 = .text:0x8019A380; // type:function size:0x40 fn_8019A3C0 = .text:0x8019A3C0; // type:function size:0x4 fn_8019A3C4 = .text:0x8019A3C4; // type:function size:0x1B0 -fn_8019A574 = .text:0x8019A574; // type:function size:0xCC -fn_8019A640 = .text:0x8019A640; // type:function size:0x164 +Clear__16RPGrpModelRecordFv = .text:0x8019A574; // type:function size:0xCC +__ct__16RPGrpModelRecordFUsP10RPGrpModel = .text:0x8019A640; // type:function size:0x164 fn_8019A7A4 = .text:0x8019A7A4; // type:function size:0x78 fn_8019A81C = .text:0x8019A81C; // type:function size:0x4 fn_8019A820 = .text:0x8019A820; // type:function size:0x40 @@ -7846,25 +7846,25 @@ fn_8019E618 = .text:0x8019E618; // type:function size:0x8 fn_8019E620 = .text:0x8019E620; // type:function size:0x8 fn_8019E628 = .text:0x8019E628; // type:function size:0x8 isDisconnectAllFinished__15RPSndSpeakerMgrFv = .text:0x8019E630; // type:function size:0x2C -fn_8019E65C = .text:0x8019E65C; // type:function size:0x84 -fn_8019E6E0 = .text:0x8019E6E0; // type:function size:0x84 -fn_8019E764 = .text:0x8019E764; // type:function size:0x34 -fn_8019E798 = .text:0x8019E798; // type:function size:0x30 -fn_8019E7C8 = .text:0x8019E7C8; // type:function size:0xD0 -fn_8019E898 = .text:0x8019E898; // type:function size:0xD4 -fn_8019E96C = .text:0x8019E96C; // type:function size:0x58 -fn_8019E9C4 = .text:0x8019E9C4; // type:function size:0xE4 +disconnectAll__15RPSndSpeakerMgrFv = .text:0x8019E65C; // type:function size:0x84 +connectAll__15RPSndSpeakerMgrFv = .text:0x8019E6E0; // type:function size:0x84 +setSpeakerShutdownCallback__15RPSndSpeakerMgrFll = .text:0x8019E764; // type:function size:0x34 +setSpeakerSetupCallback__15RPSndSpeakerMgrFll = .text:0x8019E798; // type:function size:0x30 +setSpeakerOffCallback__15RPSndSpeakerMgrFll = .text:0x8019E7C8; // type:function size:0xD0 +setSpeakerOnCallback__15RPSndSpeakerMgrFll = .text:0x8019E898; // type:function size:0xD4 +__dt__15RPSndSpeakerMgrFv = .text:0x8019E96C; // type:function size:0x58 +__ct__15RPSndSpeakerMgrFPQ23EGG4Heap = .text:0x8019E9C4; // type:function size:0xE4 setRemoteSend__15RPSndSpeakerMgrFPQ34nw4r3snd11SoundHandleUlfff = .text:0x8019EAA8; // type:function size:0x190 -fn_8019EC38 = .text:0x8019EC38; // type:function size:0xEC -fn_8019ED24 = .text:0x8019ED24; // type:function size:0x30 -fn_8019ED54 = .text:0x8019ED54; // type:function size:0x84 -fn_8019EDD8 = .text:0x8019EDD8; // type:function size:0x1AC +setEnableSw__15RPSndSpeakerMgrFlb = .text:0x8019EC38; // type:function size:0xEC +updateMasterVolume__15RPSndSpeakerMgrFv = .text:0x8019ED24; // type:function size:0x30 +exit__15RPSndSpeakerMgrFv = .text:0x8019ED54; // type:function size:0x84 +calc__15RPSndSpeakerMgrFv = .text:0x8019EDD8; // type:function size:0x1AC reset__15RPSndSpeakerMgrFv = .text:0x8019EF84; // type:function size:0x84 -fn_8019F008 = .text:0x8019F008; // type:function size:0x60 -fn_8019F068 = .text:0x8019F068; // type:function size:0x80 -fn_8019F0E8 = .text:0x8019F0E8; // type:function size:0xF8 +CreateInstance__15RPSndSpeakerMgrFPQ23EGG4Heap = .text:0x8019F008; // type:function size:0x60 +stopAllActorSound__11RPSndObjMgrFi = .text:0x8019F068; // type:function size:0x80 +setHandleDpdPan__12RPSndUtilityFRQ34nw4r3snd11SoundHandleRCQ34nw4r4math4VEC2f = .text:0x8019F0E8; // type:function size:0xF8 fn_8019F1E0 = .text:0x8019F1E0; // type:function size:0xD8 -fn_8019F2B8 = .text:0x8019F2B8; // type:function size:0x78 +update__17RPSndMoveValueF32Fv = .text:0x8019F2B8; // type:function size:0x78 moveValue__17RPSndMoveValueF32FfUl = .text:0x8019F330; // type:function size:0x4C fn_8019F37C = .text:0x8019F37C; // type:function size:0x20 fn_8019F39C = .text:0x8019F39C; // type:function size:0x18 @@ -7877,10 +7877,10 @@ fn_8019F514 = .text:0x8019F514; // type:function size:0x144 fn_8019F658 = .text:0x8019F658; // type:function size:0x168 fn_8019F7C0 = .text:0x8019F7C0; // type:function size:0x54 __dt__14RPSndStaticMgrFv = .text:0x8019F814; // type:function size:0x68 -fn_8019F87C = .text:0x8019F87C; // type:function size:0x58 -fn_8019F8D4 = .text:0x8019F8D4; // type:function size:0x1FC -fn_8019FAD0 = .text:0x8019FAD0; // type:function size:0x298 -fn_8019FD68 = .text:0x8019FD68; // type:function size:0x11C +__ct__14RPSndStaticMgrFv = .text:0x8019F87C; // type:function size:0x58 +GetMidPoint__12RPUtlDohMathFPQ34nw4r4math4VEC3PfRCQ34nw4r4math4VEC3RCQ34nw4r4math4VEC3RCQ34nw4r4math4VEC3ff = .text:0x8019F8D4; // type:function size:0x1FC +MTX34Normalize__12RPUtlDohMathFPQ34nw4r4math5MTX34PCQ34nw4r4math5MTX34Q212RPUtlDohMath9AxisOrder = .text:0x8019FAD0; // type:function size:0x298 +__sinit_\RPUtlDohMath_cpp = .text:0x8019FD68; // type:function size:0x11C fn_8019FE84 = .text:0x8019FE84; // type:function size:0x3C4 fn_801A0248 = .text:0x801A0248; // type:function size:0x7C fn_801A02C4 = .text:0x801A02C4; // type:function size:0x198 @@ -7980,9 +7980,9 @@ fn_801A5000 = .text:0x801A5000; // type:function size:0x80 fn_801A5080 = .text:0x801A5080; // type:function size:0x74 fn_801A50F4 = .text:0x801A50F4; // type:function size:0x6C fn_801A5160 = .text:0x801A5160; // type:function size:0x30C -fn_801A546C = .text:0x801A546C; // type:function size:0x88 -fn_801A54F4 = .text:0x801A54F4; // type:function size:0x88 -fn_801A557C = .text:0x801A557C; // type:function size:0x4 +drawShadow__17RPUtlShadowDrawerFv = .text:0x801A546C; // type:function size:0x88 +initMtx__17RPUtlShadowDrawerCFv = .text:0x801A54F4; // type:function size:0x88 +__sinit_\RPUtlShadowDrawer_cpp = .text:0x801A557C; // type:function size:0x4 fn_801A5580 = .text:0x801A5580; // type:function size:0xC fn_801A558C = .text:0x801A558C; // type:function size:0x5C fn_801A55E8 = .text:0x801A55E8; // type:function size:0x5C @@ -8459,11 +8459,11 @@ fn_801BAFC4 = .text:0x801BAFC4; // type:function size:0x5C fn_801BB020 = .text:0x801BB020; // type:function size:0x34 fn_801BB054 = .text:0x801BB054; // type:function size:0x8 fn_801BB05C = .text:0x801BB05C; // type:function size:0x8 -fn_801BB064 = .text:0x801BB064; // type:function size:0x94 -fn_801BB0F8 = .text:0x801BB0F8; // type:function size:0x130 -fn_801BB228 = .text:0x801BB228; // type:function size:0x1F8 -fn_801BB420 = .text:0x801BB420; // type:function size:0x1CC -fn_801BB5EC = .text:0x801BB5EC; // type:function size:0x58 +calcView__19RPSportsMenuBgModelFv = .text:0x801BB064; // type:function size:0x94 +initCamera__19RPSportsMenuBgModelFv = .text:0x801BB0F8; // type:function size:0x130 +createData__19RPSportsMenuBgModelFPQ23EGG7Archive = .text:0x801BB228; // type:function size:0x1F8 +__ct__19RPSportsMenuBgModelFUcUcUs = .text:0x801BB420; // type:function size:0x1CC +__dt__19RPSportsMenuBgModelFv = .text:0x801BB5EC; // type:function size:0x58 fn_801BB644 = .text:0x801BB644; // type:function size:0x20 fn_801BB664 = .text:0x801BB664; // type:function size:0xA8 fn_801BB70C = .text:0x801BB70C; // type:function size:0xA8 @@ -14373,10 +14373,10 @@ lbl_80343978 = .rodata:0x80343978; // type:object size:0x1B lbl_80343998 = .rodata:0x80343998; // type:object size:0x60 lbl_803439F8 = .rodata:0x803439F8; // type:object size:0x18 lbl_80343A10 = .rodata:0x80343A10; // type:object size:0x18 -lbl_80343A28 = .rodata:0x80343A28; // type:object size:0x18 -lbl_80343A40 = .rodata:0x80343A40; // type:object size:0x18 -lbl_80343A58 = .rodata:0x80343A58; // type:object size:0xC -lbl_80343A64 = .rodata:0x80343A64; // type:object size:0xC +sDefaultFxReverbHi__Q23EGG10AudioFxMgr = .rodata:0x80343A28; // type:object size:0x18 +sDefaultFxReverbHiDpl2__Q23EGG10AudioFxMgr = .rodata:0x80343A40; // type:object size:0x18 +sDefaultFxChorus__Q23EGG10AudioFxMgr = .rodata:0x80343A58; // type:object size:0xC +sDefaultFxDelay__Q23EGG10AudioFxMgr = .rodata:0x80343A64; // type:object size:0xC lbl_80343A70 = .rodata:0x80343A70; // type:object size:0x1F0 lbl_80343C60 = .rodata:0x80343C60; // type:object size:0x38 lbl_80343C98 = .rodata:0x80343C98; // type:object size:0xD8 @@ -16654,8 +16654,8 @@ lbl_8035FE50 = .data:0x8035FE50; // type:object size:0x68 lbl_8035FEB8 = .data:0x8035FEB8; // type:object size:0x28 lbl_8035FEE0 = .data:0x8035FEE0; // type:object size:0x28 lbl_8035FF08 = .data:0x8035FF08; // type:object size:0x18 -lbl_8035FF20 = .data:0x8035FF20; // type:object size:0x20 -lbl_8035FF40 = .data:0x8035FF40; // type:object size:0x30 +__vt__Q34nw4r3snd12SoundArchive = .data:0x8035FF20; // type:object size:0x20 +__vt__Q34nw4r3snd18SoundArchivePlayer = .data:0x8035FF40; // type:object size:0x30 lbl_8035FF70 = .data:0x8035FF70; // type:object size:0x14 lbl_8035FF84 = .data:0x8035FF84; // type:object size:0x14 lbl_8035FF98 = .data:0x8035FF98; // type:object size:0x18 @@ -17106,12 +17106,19 @@ lbl_803771E0 = .data:0x803771E0; // type:object size:0x100 lbl_803772E0 = .data:0x803772E0; // type:object size:0x200 lbl_803774E0 = .data:0x803774E0; // type:object size:0x800 lbl_80377CE0 = .data:0x80377CE0; // type:object size:0x37 data:string -lbl_80377D18 = .data:0x80377D18; // type:object size:0x15 data:string -lbl_80377D30 = .data:0x80377D30; // type:object size:0x98 -lbl_80377DC8 = .data:0x80377DC8; // type:object size:0x1B data:string -lbl_80377DE4 = .data:0x80377DE4; // type:object size:0x1D data:string -lbl_80377E04 = .data:0x80377E04; // type:object size:0x44 -lbl_80377E48 = .data:0x80377E48; // type:object size:0x12 data:string +@844 = .data:0x80377D18; // type:object size:0x15 data:string +@845 = .data:0x80377D30; // type:object size:0x18 data:string +@873 = .data:0x80377D48; // type:object size:0x15 data:string +@874 = .data:0x80377D60; // type:object size:0x13 data:string +@875 = .data:0x80377D74; // type:object size:0xC data:string +@917 = .data:0x80377D80; // type:object size:0x18 data:string +@918 = .data:0x80377D98; // type:object size:0x18 data:string +@919 = .data:0x80377DB0; // type:object size:0x15 data:string +@966 = .data:0x80377DC8; // type:object size:0x1B data:string +@967 = .data:0x80377DE4; // type:object size:0x1D data:string +@987 = .data:0x80377E04; // type:object size:0x22 data:string +@1043 = .data:0x80377E28; // type:object size:0x1D data:string +@1157 = .data:0x80377E48; // type:object size:0x12 data:string lbl_80377E60 = .data:0x80377E60; // type:object size:0x3A data:string lbl_80377E9C = .data:0x80377E9C; // type:object size:0x2F data:string lbl_80377ED0 = .data:0x80377ED0; // type:object size:0x5D0 @@ -17727,7 +17734,7 @@ lbl_80382240 = .data:0x80382240; // type:object size:0x28 lbl_80382268 = .data:0x80382268; // type:object size:0x28 lbl_80382290 = .data:0x80382290; // type:object size:0x58 lbl_803822E8 = .data:0x803822E8; // type:object size:0x30 -lbl_80382318 = .data:0x80382318; // type:object size:0x98 +__vt__10RPGrpModel = .data:0x80382318; // type:object size:0x98 __vt__13RPGrpModelAnm = .data:0x803823B0; // type:object size:0x88 jumptable_80382438 = .data:0x80382438; // type:object size:0x20 scope:local jumptable_80382458 = .data:0x80382458; // type:object size:0x20 scope:local @@ -17741,11 +17748,11 @@ lbl_803825A0 = .data:0x803825A0; // type:object size:0x30 lbl_803825D0 = .data:0x803825D0; // type:object size:0xF0 lbl_803826C0 = .data:0x803826C0; // type:object size:0xC lbl_803826CC = .data:0x803826CC; // type:object size:0x24 -jumptable_803826F0 = .data:0x803826F0; // type:object size:0x28 scope:local -jumptable_80382718 = .data:0x80382718; // type:object size:0x30 scope:local -jumptable_80382748 = .data:0x80382748; // type:object size:0x28 scope:local -jumptable_80382770 = .data:0x80382770; // type:object size:0x28 scope:local -__vt__20RPGrpModelResManager = .data:0x80382798; // type:object size:0x10 +@18027 = .data:0x803826F0; // type:object size:0x28 scope:local +@18143 = .data:0x80382718; // type:object size:0x30 scope:local +@18357 = .data:0x80382748; // type:object size:0x28 scope:local +@18572 = .data:0x80382770; // type:object size:0x28 scope:local +__vt__20RPGrpModelResManager = .data:0x80382798; // type:object size:0xC jumptable_803827A8 = .data:0x803827A8; // type:object size:0x24 scope:local lbl_803827CC = .data:0x803827CC; // type:object size:0x14 lbl_803827E0 = .data:0x803827E0; // type:object size:0x10 @@ -17804,7 +17811,7 @@ lbl_80383004 = .data:0x80383004; // type:object size:0x16 data:string @STRING@setCameraCount__Q23EGG19TAudioSound3DMgr<4>Fl@1 = .data:0x80383030; // type:object size:0x10 data:string @STRING@setCameraCount__Q23EGG19TAudioSound3DMgr<4>Fl@0 = .data:0x80383040; // type:object size:0xC data:string @STRING@setCameraCount__Q23EGG19TAudioSound3DMgr<4>Fl = .data:0x80383050; // type:object size:0x10 data:string -lbl_80383060 = .data:0x80383060; // type:object size:0x10 +__vt__15RPSndSpeakerMgr = .data:0x80383060; // type:object size:0xC lbl_80383070 = .data:0x80383070; // type:object size:0x70 lbl_803830E0 = .data:0x803830E0; // type:object size:0x6BA0 lbl_80389C80 = .data:0x80389C80; // type:object size:0x58 @@ -17860,7 +17867,7 @@ lbl_8038A2D0 = .data:0x8038A2D0; // type:object size:0x20 lbl_8038A2F0 = .data:0x8038A2F0; // type:object size:0x10 __vt__14RPSysBootScene = .data:0x8038A300; // type:object size:0x60 __vt__22RPSysPlayerSelectScene = .data:0x8038A360; // type:object size:0x60 -lbl_8038A3C0 = .data:0x8038A3C0; // type:object size:0x10 +__vt__19RPSportsMenuBgModel = .data:0x8038A3C0; // type:object size:0x10 lbl_8038A3D0 = .data:0x8038A3D0; // type:object size:0x20 lbl_8038A3F0 = .data:0x8038A3F0; // type:object size:0x28 jumptable_8038A418 = .data:0x8038A418; // type:object size:0x1C scope:local @@ -18774,10 +18781,7 @@ lbl_80400900 = .bss:0x80400900; // type:object size:0x4E7 lbl_80400DE7 = .bss:0x80400DE7; // type:object size:0x3310 lbl_804040F7 = .bss:0x804040F7; // type:object size:0x5227 lbl_8040931E = .bss:0x8040931E; // type:object size:0xBE2 -lbl_80409F00 = .bss:0x80409F00; // type:object size:0x1FF data:byte -lbl_8040A0FF = .bss:0x8040A0FF; // type:object size:0x5E9C -lbl_8040FF9B = .bss:0x8040FF9B; // type:object size:0x1076E -lbl_80420709 = .bss:0x80420709; // type:object size:0x122D7 +gki_cb = .bss:0x80409F00; // type:object size:0x28AE0 data:byte lbl_804329E0 = .bss:0x804329E0; // type:object size:0x40 lbl_80432A20 = .bss:0x80432A20; // type:object size:0x60 data:4byte lbl_80432A80 = .bss:0x80432A80; // type:object size:0x1000 @@ -18874,15 +18878,16 @@ lbl_804D6EB0 = .bss:0x804D6EB0; // type:object size:0x28 data:byte lbl_804D6ED8 = .bss:0x804D6ED8; // type:object size:0x10 data:4byte lbl_804D6EE8 = .bss:0x804D6EE8; // type:object size:0x10 lbl_804D6EF8 = .bss:0x804D6EF8; // type:object size:0x10 -lbl_804D6F08 = .bss:0x804D6F08; // type:object size:0xC align:4 data:float -lbl_804D6F14 = .bss:0x804D6F14; // type:object size:0xC align:4 data:float -lbl_804D6F20 = .bss:0x804D6F20; // type:object size:0xC align:4 data:float -lbl_804D6F2C = .bss:0x804D6F2C; // type:object size:0xC align:4 data:float -lbl_804D6F38 = .bss:0x804D6F38; // type:object size:0xC align:4 data:float -lbl_804D6F44 = .bss:0x804D6F44; // type:object size:0xC align:4 data:float -lbl_804D6F50 = .bss:0x804D6F50; // type:object size:0x10 align:4 data:float -lbl_804D6F60 = .bss:0x804D6F60; // type:object size:0x58 align:4 data:float -lbl_804D6FB8 = .bss:0x804D6FB8; // type:object size:0x10 align:4 data:float +VEC3_ZERO__12RPUtlDohMath = .bss:0x804D6F08; // type:object size:0xC align:4 data:float +AXIS_XP__12RPUtlDohMath = .bss:0x804D6F14; // type:object size:0xC align:4 data:float +AXIS_XN__12RPUtlDohMath = .bss:0x804D6F20; // type:object size:0xC align:4 data:float +AXIS_YP__12RPUtlDohMath = .bss:0x804D6F2C; // type:object size:0xC align:4 data:float +AXIS_YN__12RPUtlDohMath = .bss:0x804D6F38; // type:object size:0xC align:4 data:float +AXIS_ZP__12RPUtlDohMath = .bss:0x804D6F44; // type:object size:0xC align:4 data:float +AXIS_ZN__12RPUtlDohMath = .bss:0x804D6F50; // type:object size:0xC align:4 data:float +MTX34_IDENT__12RPUtlDohMath = .bss:0x804D6F60; // type:object size:0x30 align:4 data:float +MTX33_IDENT__12RPUtlDohMath = .bss:0x804D6F90; // type:object size:0x24 align:4 data:float +QUAT_IDENT__12RPUtlDohMath = .bss:0x804D6FB8; // type:object size:0x10 align:4 data:float lbl_804D6FC8 = .bss:0x804D6FC8; // type:object size:0x10 data:4byte lbl_804D6FD8 = .bss:0x804D6FD8; // type:object size:0x10 data:byte lbl_804D6FE8 = .bss:0x804D6FE8; // type:object size:0xC align:4 data:float @@ -18891,7 +18896,7 @@ lbl_804D7000 = .bss:0x804D7000; // type:object size:0xC align:4 data:float lbl_804D700C = .bss:0x804D700C; // type:object size:0xC align:4 data:float lbl_804D7018 = .bss:0x804D7018; // type:object size:0xC align:4 data:float lbl_804D7024 = .bss:0x804D7024; // type:object size:0x54 data:4byte -lbl_804D7078 = .bss:0x804D7078; // type:object size:0x30 data:4byte +sCameraMtx__17RPUtlShadowDrawer = .bss:0x804D7078; // type:object size:0x30 data:4byte lbl_804D70A8 = .bss:0x804D70A8; // type:object size:0x18 data:4byte lbl_804D70C0 = .bss:0x804D70C0; // type:object size:0x20 data:4byte lbl_804D70E0 = .bss:0x804D70E0; // type:object size:0x18 align:4 data:float @@ -20227,7 +20232,7 @@ lbl_804DF148 = .sbss:0x804DF148; // type:object size:0x4 data:4byte lbl_804DF14C = .sbss:0x804DF14C; // type:object size:0x1 data:byte lbl_804DF150 = .sbss:0x804DF150; // type:object size:0x8 data:byte lbl_804DF158 = .sbss:0x804DF158; // type:object size:0x8 data:byte -lbl_804DF160 = .sbss:0x804DF160; // type:object size:0x8 data:4byte +typeInfo__Q44nw4r3snd6detail8SeqSound = .sbss:0x804DF160; // type:object size:0x8 data:4byte lbl_804DF168 = .sbss:0x804DF168; // type:object size:0x4 align:4 data:float lbl_804DF16C = .sbss:0x804DF16C; // type:object size:0x1 data:byte lbl_804DF170 = .sbss:0x804DF170; // type:object size:0x4 align:4 data:float @@ -20751,10 +20756,10 @@ lbl_804DFB54 = .sbss:0x804DFB54; // type:object size:0x4 data:4byte lbl_804DFB58 = .sbss:0x804DFB58; // type:object size:0x4 data:4byte lbl_804DFB5C = .sbss:0x804DFB5C; // type:object size:0x4 data:4byte spAllocator__10RPGrpModel = .sbss:0x804DFB60; // type:object size:0x4 data:4byte -lbl_804DFB64 = .sbss:0x804DFB64; // type:object size:0x4 data:4byte -lbl_804DFB68 = .sbss:0x804DFB68; // type:object size:0x4 data:4byte -lbl_804DFB6C = .sbss:0x804DFB6C; // type:object size:0x4 data:4byte -lbl_804DFB70 = .sbss:0x804DFB70; // type:object size:0x8 data:4byte +spCalcModel__10RPGrpModel = .sbss:0x804DFB64; // type:object size:0x4 data:4byte +spEntryHead__10RPGrpModel = .sbss:0x804DFB68; // type:object size:0x4 data:4byte +spEntryTail__10RPGrpModel = .sbss:0x804DFB6C; // type:object size:0x4 data:4byte +spGenList__10RPGrpModel = .sbss:0x804DFB70; // type:object size:0x8 data:4byte lbl_804DFB78 = .sbss:0x804DFB78; // type:object size:0x8 data:4byte lbl_804DFB80 = .sbss:0x804DFB80; // type:object size:0x4 data:4byte lbl_804DFB84 = .sbss:0x804DFB84; // type:object size:0x4 data:4byte @@ -20814,9 +20819,9 @@ lbl_804DFC58 = .sbss:0x804DFC58; // type:object size:0x4 data:4byte MemDeallocCallbackArg = .sbss:0x804DFC5C; // type:object size:0x4 data:4byte spInstance__13RPSndAudioMgr = .sbss:0x804DFC60; // type:object size:0x4 data:4byte lbl_804DFC64 = .sbss:0x804DFC64; // type:object size:0x4 data:4byte -spInstance__15RPSndSpeakerMgr = .sbss:0x804DFC68; // type:object size:0x8 data:4byte +spInstance__15RPSndSpeakerMgr = .sbss:0x804DFC68; // type:object size:0x4 data:4byte lbl_804DFC70 = .sbss:0x804DFC70; // type:object size:0x8 data:4byte -lbl_804DFC78 = .sbss:0x804DFC78; // type:object size:0x8 align:4 data:float +VEC2_ZERO__12RPUtlDohMath = .sbss:0x804DFC78; // type:object size:0x8 align:4 data:float lbl_804DFC80 = .sbss:0x804DFC80; // type:object size:0x8 data:4byte lbl_804DFC88 = .sbss:0x804DFC88; // type:object size:0x4 data:4byte lbl_804DFC8C = .sbss:0x804DFC8C; // type:object size:0x4 data:4byte @@ -22287,9 +22292,9 @@ lbl_804E1A78 = .sdata2:0x804E1A78; // type:object size:0x1 data:byte lbl_804E1A79 = .sdata2:0x804E1A79; // type:object size:0x1 data:byte lbl_804E1A7A = .sdata2:0x804E1A7A; // type:object size:0x1 data:byte lbl_804E1A7B = .sdata2:0x804E1A7B; // type:object size:0x5 data:byte -lbl_804E1A80 = .sdata2:0x804E1A80; // type:object size:0x8 align:4 data:float -lbl_804E1A88 = .sdata2:0x804E1A88; // type:object size:0x4 align:4 data:float -lbl_804E1A8C = .sdata2:0x804E1A8C; // type:object size:0x4 align:4 data:float +@17544 = .sdata2:0x804E1A80; // type:object size:0x8 align:4 data:float +@17460 = .sdata2:0x804E1A88; // type:object size:0x4 align:4 data:float +@17461 = .sdata2:0x804E1A8C; // type:object size:0x4 align:4 data:float lbl_804E1A90 = .sdata2:0x804E1A90; // type:object size:0x8 lbl_804E1A98 = .sdata2:0x804E1A98; // type:object size:0x4 align:4 data:float lbl_804E1A9C = .sdata2:0x804E1A9C; // type:object size:0x4 align:4 data:float @@ -22557,7 +22562,7 @@ lbl_804E1E90 = .sdata2:0x804E1E90; // type:object size:0x4 align:4 data:float lbl_804E1E94 = .sdata2:0x804E1E94; // type:object size:0x4 align:4 data:float lbl_804E1E98 = .sdata2:0x804E1E98; // type:object size:0x4 align:4 data:float lbl_804E1EA0 = .sdata2:0x804E1EA0; // type:object size:0x8 align:8 data:double -lbl_804E1EA8 = .sdata2:0x804E1EA8; // type:object size:0x8 align:4 data:float +@11557 = .sdata2:0x804E1EA8; // type:object size:0x4 align:4 data:float lbl_804E1EB0 = .sdata2:0x804E1EB0; // type:object size:0x4 align:4 data:float lbl_804E1EB4 = .sdata2:0x804E1EB4; // type:object size:0x4 align:4 data:float lbl_804E1EB8 = .sdata2:0x804E1EB8; // type:object size:0x4 align:4 data:float @@ -22566,10 +22571,10 @@ lbl_804E1EC0 = .sdata2:0x804E1EC0; // type:object size:0x8 align:8 data:double lbl_804E1EC8 = .sdata2:0x804E1EC8; // type:object size:0x8 align:4 data:float lbl_804E1ED0 = .sdata2:0x804E1ED0; // type:object size:0x4 align:4 data:float lbl_804E1ED8 = .sdata2:0x804E1ED8; // type:object size:0x8 align:8 data:double -lbl_804E1EE0 = .sdata2:0x804E1EE0; // type:object size:0x4 align:4 data:float -lbl_804E1EE4 = .sdata2:0x804E1EE4; // type:object size:0x4 align:4 data:float -lbl_804E1EE8 = .sdata2:0x804E1EE8; // type:object size:0x4 align:4 data:float -lbl_804E1EEC = .sdata2:0x804E1EEC; // type:object size:0x4 align:4 data:float +FLOAT_EPSILON__12RPUtlDohMath = .sdata2:0x804E1EE0; // type:object size:0x4 align:4 data:float +@27055 = .sdata2:0x804E1EE4; // type:object size:0x4 align:4 data:float +@27056 = .sdata2:0x804E1EE8; // type:object size:0x4 align:4 data:float +@27244 = .sdata2:0x804E1EEC; // type:object size:0x4 align:4 data:float lbl_804E1EF0 = .sdata2:0x804E1EF0; // type:object size:0x4 align:4 data:float lbl_804E1EF4 = .sdata2:0x804E1EF4; // type:object size:0x4 align:4 data:float lbl_804E1EF8 = .sdata2:0x804E1EF8; // type:object size:0x4 align:4 data:float diff --git a/config/RSPE01_01/splits.txt b/config/RSPE01_01/splits.txt index df4085de5..4b039ffb9 100644 --- a/config/RSPE01_01/splits.txt +++ b/config/RSPE01_01/splits.txt @@ -2365,11 +2365,22 @@ revolution/BASE/PPCArch.c: .text start:0x8010AA18 end:0x8010AB88 .data start:0x803AF5A0 end:0x803AF5D8 +revolution/BTE/gki/common/gki_buffer.c: + .text start:0x8010AB88 end:0x8010BFCC + .data start:0x803AF5D8 end:0x803AF720 + +revolution/BTE/gki/common/gki_time.c: + .text start:0x8010BFCC end:0x8010C524 + +revolution/BTE/rvl/gki_ppc.c: + .text start:0x8010C524 end:0x8010C7B4 + .bss start:0x80440900 end:0x804693E0 + revolution/BTE/bte_unsplit.o: - .text start:0x8010AB88 end:0x80138A18 + .text start:0x8010C7B4 end:0x80138A18 .rodata start:0x8037C658 end:0x8037CAD0 - .data start:0x803AF5D8 end:0x803B5AE8 - .bss start:0x80440900 end:0x804754C0 + .data start:0x803AF720 end:0x803B5AE8 + .bss start:0x804693E0 end:0x804754C0 .sdata start:0x804BD8B0 end:0x804BD960 .sbss start:0x804BF298 end:0x804BF2D0 .sdata2 start:0x804C1380 end:0x804C13D8 diff --git a/config/RSPE01_01/symbols.txt b/config/RSPE01_01/symbols.txt index 4ea2385f4..f3de7b62c 100644 --- a/config/RSPE01_01/symbols.txt +++ b/config/RSPE01_01/symbols.txt @@ -2894,7 +2894,7 @@ __ct__Q23EGG12LightManagerFUlUlUc = .text:0x8008FF24; // type:function size:0x23 Reset__Q23EGG12LightManagerFv = .text:0x80090160; // type:function size:0x12C scope:global Calc__Q23EGG12LightManagerFPQ34nw4r3g3d7ScnRoot = .text:0x8009028C; // type:function size:0xB0 scope:global CalcView__Q23EGG12LightManagerFRCQ34nw4r4math5MTX34UcPQ34nw4r3g3d7ScnRoot = .text:0x8009033C; // type:function size:0x140 scope:global -fn_8009047C = .text:0x8009047C; // type:function size:0x78 +SetChanAmbColor__Q23EGG12LightManagerCFv = .text:0x8009047C; // type:function size:0x78 LoadObjIndxGX__Q23EGG12LightManagerCFv = .text:0x800904F4; // type:function size:0x74 scope:global LoadLightSetGD__Q23EGG12LightManagerCFiPUlPUlPUlPUlP8_GXColor = .text:0x80090568; // type:function size:0x6C scope:global DoneDraw__Q23EGG12LightManagerFv = .text:0x800905D4; // type:function size:0x2C scope:global @@ -6864,7 +6864,7 @@ fn_80183534 = .text:0x80183534; // type:function size:0x50 fn_80183584 = .text:0x80183584; // type:function size:0x24 getFBHeight__11RPSysSystemCFv = .text:0x801835A8; // type:function size:0xC getFBWidth__11RPSysSystemCFv = .text:0x801835B4; // type:function size:0xC -fn_801835C0 = .text:0x801835C0; // type:function size:0x14 +getModifyRatio__11RPSysSystemCFv = .text:0x801835C0; // type:function size:0x14 fn_801835D4 = .text:0x801835D4; // type:function size:0x8 setupRenderMode__11RPSysSystemFv = .text:0x801835DC; // type:function size:0x130 setupTVMode__11RPSysSystemFv = .text:0x8018370C; // type:function size:0x6C @@ -7774,8 +7774,8 @@ fn_801A96B8 = .text:0x801A96B8; // type:function size:0x40 fn_801A96F8 = .text:0x801A96F8; // type:function size:0x40 fn_801A9738 = .text:0x801A9738; // type:function size:0x40 fn_801A9778 = .text:0x801A9778; // type:function size:0x40 -fn_801A97B8 = .text:0x801A97B8; // type:function size:0x14 -fn_801A97CC = .text:0x801A97CC; // type:function size:0x14 +On__13RPGrpDrawPathFv = .text:0x801A97B8; // type:function size:0x14 +Off__13RPGrpDrawPathFv = .text:0x801A97CC; // type:function size:0x14 LoadScnLight__17RPGrpLightManagerFUsPCcfUl = .text:0x801A97E0; // type:function size:0x80 RemoveGenList__10RPGrpModelFv = .text:0x801A9860; // type:function size:0x44 ReplaceTexture__10RPGrpModelFPCcRC12RPGrpTextureb = .text:0x801A98A4; // type:function size:0x94 @@ -7947,7 +7947,7 @@ fn_801AF40C = .text:0x801AF40C; // type:function size:0x24 AppendDrawObject__13RPGrpRendererFP16IRPGrpDrawObject = .text:0x801AF430; // type:function size:0x24 fn_801AF454 = .text:0x801AF454; // type:function size:0x138 fn_801AF58C = .text:0x801AF58C; // type:function size:0x9C -fn_801AF628 = .text:0x801AF628; // type:function size:0x98 +CreateView3D__13RPGrpRendererFUcP11RPGrpCameraP11RPGrpScreen = .text:0x801AF628; // type:function size:0x98 fn_801AF6C0 = .text:0x801AF6C0; // type:function size:0x54 CalculateInPause__13RPGrpRendererFv = .text:0x801AF714; // type:function size:0x58 PostCalculate__13RPGrpRendererFv = .text:0x801AF76C; // type:function size:0x84 @@ -8007,19 +8007,19 @@ GetCamera__17RPGrpViewRender3DCFv = .text:0x801B18BC; // type:function size:0x8 __ct__17RPGrpViewRender3DFUc = .text:0x801B18C4; // type:function size:0x4C __dt__17RPGrpViewRender3DFv = .text:0x801B1910; // type:function size:0x40 scope:weak GetType__17RPGrpViewRender3DCFv = .text:0x801B1950; // type:function size:0x8 scope:weak -fn_801B1958 = .text:0x801B1958; // type:function size:0x98 +setupEnvironment__15RPGrpModelSceneCFv = .text:0x801B1958; // type:function size:0x98 fn_801B19F0 = .text:0x801B19F0; // type:function size:0x24 -fn_801B1A14 = .text:0x801B1A14; // type:function size:0x80 +setDrawPriority__15RPGrpModelSceneCFP10RPGrpModel = .text:0x801B1A14; // type:function size:0x80 fn_801B1A94 = .text:0x801B1A94; // type:function size:0x18 fn_801B1AAC = .text:0x801B1AAC; // type:function size:0x14 fn_801B1AC0 = .text:0x801B1AC0; // type:function size:0x14 fn_801B1AD4 = .text:0x801B1AD4; // type:function size:0x120 DrawPrepare__15RPGrpModelSceneFPC11RPGrpCameraPC11RPGrpScreen = .text:0x801B1BF4; // type:function size:0x50 -fn_801B1C44 = .text:0x801B1C44; // type:function size:0x40 +g_calc_background__15RPGrpModelSceneFv = .text:0x801B1C44; // type:function size:0x40 fn_801B1C84 = .text:0x801B1C84; // type:function size:0x100 -fn_801B1D84 = .text:0x801B1D84; // type:function size:0x38 +CalcView__15RPGrpModelSceneFv = .text:0x801B1D84; // type:function size:0x38 fn_801B1DBC = .text:0x801B1DBC; // type:function size:0xC4 -fn_801B1E80 = .text:0x801B1E80; // type:function size:0x80 +__dt__15RPGrpModelSceneFv = .text:0x801B1E80; // type:function size:0x80 fn_801B1F00 = .text:0x801B1F00; // type:function size:0x4E0 fn_801B23E0 = .text:0x801B23E0; // type:function size:0x4 fn_801B23E4 = .text:0x801B23E4; // type:function size:0x40 @@ -8800,11 +8800,11 @@ fn_801D5744 = .text:0x801D5744; // type:function size:0x5C fn_801D57A0 = .text:0x801D57A0; // type:function size:0x34 fn_801D57D4 = .text:0x801D57D4; // type:function size:0x8 fn_801D57DC = .text:0x801D57DC; // type:function size:0x8 -fn_801D57E4 = .text:0x801D57E4; // type:function size:0xA4 -fn_801D5888 = .text:0x801D5888; // type:function size:0x130 -fn_801D59B8 = .text:0x801D59B8; // type:function size:0x1F8 -fn_801D5BB0 = .text:0x801D5BB0; // type:function size:0x1CC -fn_801D5D7C = .text:0x801D5D7C; // type:function size:0x58 +calcView__19RPSportsMenuBgModelFv = .text:0x801D57E4; // type:function size:0xA4 +initCamera__19RPSportsMenuBgModelFv = .text:0x801D5888; // type:function size:0x130 +createData__19RPSportsMenuBgModelFPQ23EGG7Archive = .text:0x801D59B8; // type:function size:0x1F8 +__ct__19RPSportsMenuBgModelFUcUcUs = .text:0x801D5BB0; // type:function size:0x1CC +__dt__19RPSportsMenuBgModelFv = .text:0x801D5D7C; // type:function size:0x58 fn_801D5DD4 = .text:0x801D5DD4; // type:function size:0x20 fn_801D5DF4 = .text:0x801D5DF4; // type:function size:0xA8 fn_801D5E9C = .text:0x801D5E9C; // type:function size:0xA8 @@ -17895,12 +17895,19 @@ __FilterSizeTable = .data:0x803AEAA0; // type:object size:0x100 scope:local __SinTableFixedPoint = .data:0x803AEBA0; // type:object size:0x200 scope:local align:8 __SrcTab12khz = .data:0x803AEDA0; // type:object size:0x800 scope:local align:8 @472 = .data:0x803AF5A0; // type:object size:0x37 scope:local align:4 data:string -lbl_803AF5D8 = .data:0x803AF5D8; // type:object size:0x15 data:string -lbl_803AF5F0 = .data:0x803AF5F0; // type:object size:0x98 -lbl_803AF688 = .data:0x803AF688; // type:object size:0x1B data:string -lbl_803AF6A4 = .data:0x803AF6A4; // type:object size:0x1D data:string -lbl_803AF6C4 = .data:0x803AF6C4; // type:object size:0x44 -lbl_803AF708 = .data:0x803AF708; // type:object size:0x12 data:string +@844 = .data:0x803AF5D8; // type:object size:0x15 data:string +@845 = .data:0x803AF5F0; // type:object size:0x18 data:string +@873 = .data:0x803AF608; // type:object size:0x15 data:string +@874 = .data:0x803AF620; // type:object size:0x13 data:string +@875 = .data:0x803AF634; // type:object size:0xC data:string +@917 = .data:0x803AF640; // type:object size:0x18 data:string +@918 = .data:0x803AF658; // type:object size:0x18 align:8 data:string +@919 = .data:0x803AF670; // type:object size:0x15 data:string +@966 = .data:0x803AF688; // type:object size:0x1B data:string +@967 = .data:0x803AF6A4; // type:object size:0x1D data:string +@987 = .data:0x803AF6C4; // type:object size:0x22 align:4 data:string +@1043 = .data:0x803AF6E8; // type:object size:0x1D data:string +@1157 = .data:0x803AF708; // type:object size:0x12 data:string lbl_803AF720 = .data:0x803AF720; // type:object size:0x3A data:string lbl_803AF75C = .data:0x803AF75C; // type:object size:0x2F data:string lbl_803AF790 = .data:0x803AF790; // type:object size:0x5D0 @@ -18674,8 +18681,8 @@ lbl_803BA550 = .data:0x803BA550; // type:object size:0xE data:string lbl_803BA560 = .data:0x803BA560; // type:object size:0xD data:string lbl_803BA570 = .data:0x803BA570; // type:object size:0xE data:string lbl_803BA580 = .data:0x803BA580; // type:object size:0xD data:string -lbl_803BA590 = .data:0x803BA590; // type:object size:0x1F data:string -lbl_803BA5B0 = .data:0x803BA5B0; // type:object size:0xD data:string +@STRING@setModifyRatio__Q23EGG7StateGXFf@0 = .data:0x803BA590; // type:object size:0x1F data:string +@STRING@setModifyRatio__Q23EGG7StateGXFf = .data:0x803BA5B0; // type:object size:0xD data:string lbl_803BA5C0 = .data:0x803BA5C0; // type:object size:0x2C lbl_803BA5EC = .data:0x803BA5EC; // type:object size:0xC lbl_803BA5F8 = .data:0x803BA5F8; // type:object size:0x10 @@ -18777,7 +18784,7 @@ lbl_803C1F78 = .data:0x803C1F78; // type:object size:0x28 lbl_803C1FA0 = .data:0x803C1FA0; // type:object size:0x38 lbl_803C1FD8 = .data:0x803C1FD8; // type:object size:0x28 lbl_803C2000 = .data:0x803C2000; // type:object size:0x38 -lbl_803C2038 = .data:0x803C2038; // type:object size:0xC +__vt__19RPSportsMenuBgModel = .data:0x803C2038; // type:object size:0xC lbl_803C2044 = .data:0x803C2044; // type:object size:0x22 data:string lbl_803C2068 = .data:0x803C2068; // type:object size:0x12 data:string lbl_803C2080 = .data:0x803C2080; // type:object size:0x20 @@ -19902,7 +19909,7 @@ lbl_804A4788 = .bss:0x804A4788; // type:object size:0xC align:4 data:float lbl_804A4794 = .bss:0x804A4794; // type:object size:0xC align:4 data:float lbl_804A47A0 = .bss:0x804A47A0; // type:object size:0xC align:4 data:float lbl_804A47AC = .bss:0x804A47AC; // type:object size:0x54 data:4byte -sGlobalMtx__17RPUtlShadowDrawer = .bss:0x804A4800; // type:object size:0x30 data:4byte +sCameraMtx__17RPUtlShadowDrawer = .bss:0x804A4800; // type:object size:0x30 data:4byte lbl_804A4830 = .bss:0x804A4830; // type:object size:0x18 data:4byte lbl_804A4848 = .bss:0x804A4848; // type:object size:0x20 data:4byte lbl_804A4868 = .bss:0x804A4868; // type:object size:0x18 align:4 data:float @@ -20464,7 +20471,7 @@ lbl_804BDBF0 = .sdata:0x804BDBF0; // type:object size:0x8 sSoundHeapSize__16RPSysHomeMenuMgr = .sdata:0x804BDBF8; // type:object size:0x4 data:4byte sSuccess__17RPSysNWC24Manager = .sdata:0x804BDC00; // type:object size:0x4 data:4byte lbl_804BDC08 = .sdata:0x804BDC08; // type:object size:0x4 data:4byte -lbl_804BDC0C = .sdata:0x804BDC0C; // type:object size:0x4 data:4byte +sRenderPass__13RPGrpRenderer = .sdata:0x804BDC0C; // type:object size:0x4 data:4byte lbl_804BDC10 = .sdata:0x804BDC10; // type:object size:0x8 align:4 data:float lbl_804BDC18 = .sdata:0x804BDC18; // type:object size:0x8 lbl_804BDC20 = .sdata:0x804BDC20; // type:object size:0x8 align:4 data:float @@ -21891,7 +21898,7 @@ sAddrWork__16RPSysCoreAddress = .sbss:0x804BF580; // type:object size:0x6 data:b lbl_804BF588__18RPSysLytDynamicAnm = .sbss:0x804BF588; // type:object size:0x4 align:4 data:4byte OUT_OF_SCREEN_POS__18RPSysCursorDrawMgr = .sbss:0x804BF590; // type:object size:0x8 align:4 data:float spInstance__18RPSysCursorDrawMgr = .sbss:0x804BF598; // type:object size:0x4 data:4byte -lbl_804BF5A0 = .sbss:0x804BF5A0; // type:object size:0x8 data:4byte +spInstance__17RPSysSystemWinMgr = .sbss:0x804BF5A0; // type:object size:0x8 data:4byte spInstance__16RPSysHomeMenuMgr = .sbss:0x804BF5A8; // type:object size:0x4 data:4byte spHomeMenuArcMgr__16RPSysHomeMenuMgr = .sbss:0x804BF5AC; // type:object size:0x4 data:4byte sIsBusy__15RPSysPairingMgr = .sbss:0x804BF5B0; // type:object size:0x1 data:byte @@ -21913,7 +21920,7 @@ spCurrent__17RPGrpModelManager = .sbss:0x804BF5F8; // type:object size:0x8 data: spCurrent__20RPGrpModelResManager = .sbss:0x804BF600; // type:object size:0x8 data:4byte lbl_804BF608 = .sbss:0x804BF608; // type:object size:0x8 data:4byte spCurrent__13RPGrpRenderer = .sbss:0x804BF610; // type:object size:0x4 data:4byte -lbl_804BF614 = .sbss:0x804BF614; // type:object size:0x1 data:byte +sRendering__13RPGrpRenderer = .sbss:0x804BF614; // type:object size:0x1 data:byte lbl_804BF615 = .sbss:0x804BF615; // type:object size:0x1 data:byte gap_11_804BF616_sbss = .sbss:0x804BF616; // type:object size:0x2 scope:global spCurrentView__13RPGrpRenderer = .sbss:0x804BF618; // type:object size:0x4 data:4byte @@ -23640,8 +23647,8 @@ lbl_804C1888 = .sdata2:0x804C1888; // type:object size:0x1 data:byte lbl_804C1889 = .sdata2:0x804C1889; // type:object size:0x1 data:byte lbl_804C188A = .sdata2:0x804C188A; // type:object size:0x1 data:byte lbl_804C188B = .sdata2:0x804C188B; // type:object size:0x1 data:byte -lbl_804C188C = .sdata2:0x804C188C; // type:object size:0x4 align:4 data:float -lbl_804C1890 = .sdata2:0x804C1890; // type:object size:0x8 align:4 data:float +@26961 = .sdata2:0x804C188C; // type:object size:0x4 align:4 data:float +@26962 = .sdata2:0x804C1890; // type:object size:0x4 align:4 data:float @16652 = .sdata2:0x804C1898; // type:object size:0x4 scope:local align:4 data:float lbl_804C18A0 = .sdata2:0x804C18A0; // type:object size:0x1 data:byte lbl_804C18A1 = .sdata2:0x804C18A1; // type:object size:0x1 data:byte diff --git a/configure.py b/configure.py index 4660adf5f..2a8866c6c 100755 --- a/configure.py +++ b/configure.py @@ -580,7 +580,7 @@ def MatchingFor(*versions): Object(Matching, "nw4r/snd/snd_SeqFile.cpp"), Object(Matching, "nw4r/snd/snd_SeqPlayer.cpp"), Object(Matching, "nw4r/snd/snd_SeqSound.cpp"), - Object(Matching, "nw4r/snd/snd_SeqSoundHandle.cpp"), + Object(not MatchingFor("RSPE01_00"), "nw4r/snd/snd_SeqSoundHandle.cpp"), Object(Matching, "nw4r/snd/snd_SeqTrack.cpp"), Object(Matching, "nw4r/snd/snd_Sound3DActor.cpp"), Object(Matching, "nw4r/snd/snd_Sound3DListener.cpp"), @@ -804,7 +804,7 @@ def MatchingFor(*versions): Object(Matching, "egg/core/eggCntFile.cpp"), Object(Matching, "egg/audio/eggAudioArcPlayerMgr.cpp"), Object(Matching, "egg/audio/eggAudioExpMgr.cpp"), - Object(Matching, "egg/audio/eggAudioFxMgr.cpp"), + Object(not MatchingFor("RSPE01_00"), "egg/audio/eggAudioFxMgr.cpp"), Object(Matching, "egg/audio/eggAudioHeapMgr.cpp"), Object(Matching, "egg/audio/eggAudioMgr.cpp"), Object(Matching, "egg/audio/eggAudio3DActor.cpp"), @@ -1052,6 +1052,9 @@ def MatchingFor(*versions): Object(Matching, "revolution/AXFX/AXFXSrcCoef.c"), Object(Matching, "revolution/AXFX/AXFXHooks.c"), Object(Matching, "revolution/BASE/PPCArch.c"), + Object(Matching, "revolution/BTE/gki/common/gki_buffer.c"), + Object(Matching, "revolution/BTE/gki/common/gki_time.c"), + Object(Matching, "revolution/BTE/rvl/gki_ppc.c"), Object(NonMatching, "revolution/BTE/bte_unsplit.o"), Object(Matching, "revolution/DB/db.c"), Object(Matching, "revolution/DSP/dsp.c"), @@ -1276,13 +1279,15 @@ def MatchingFor(*versions): Object(Matching, "Pack/RPGraphics/RPGrpCamera.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpDrawPathManager.cpp"), Object(Matching, "Pack/RPGraphics/RPGrpLightManager.cpp"), - Object(Matching, "Pack/RPGraphics/RPGrpModel.cpp"), + Object(not MatchingFor("RSPE01_00"), "Pack/RPGraphics/RPGrpModel.cpp"), Object(not MatchingFor("RSPE01_00"), "Pack/RPGraphics/RPGrpModelAnm.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpModelAnmImplement.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpModelImplement.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpModelMisc.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpModelManager.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpModelResManager.cpp"), + Object(NonMatching, "Pack/RPGraphics/RPGrpCpuTexture.cpp"), + Object(NonMatching, "Pack/RPGraphics/RPGrpFog.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpRenderer.cpp"), Object(Matching, "Pack/RPGraphics/RPGrpScreen.cpp"), Object(NonMatching, "Pack/RPGraphics/RPGrpView.cpp"), @@ -1309,7 +1314,7 @@ def MatchingFor(*versions): "progress_category": "audio", # str | List[str] "objects": [ Object(NonMatching, "Pack/RPAudio/RPSndAudioMgr.cpp"), - Object(Matching, "Pack/RPAudio/RPSndSpeakerMgr.cpp"), + Object(not MatchingFor("RSPE01_00"), "Pack/RPAudio/RPSndSpeakerMgr.cpp"), Object(Matching, "Pack/RPAudio/RPSndObject.cpp"), Object(Matching, "Pack/RPAudio/RPSndUtility.cpp"), Object(Matching, "Pack/RPAudio/RPSndMoveParam.cpp"), diff --git a/include/Pack/RPGraphics.h b/include/Pack/RPGraphics.h index 87c6b3d33..ffc9041df 100644 --- a/include/Pack/RPGraphics.h +++ b/include/Pack/RPGraphics.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -30,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/include/Pack/RPGraphics/RPGrpCamera.h b/include/Pack/RPGraphics/RPGrpCamera.h index 27f6d845b..192a00b23 100644 --- a/include/Pack/RPGraphics/RPGrpCamera.h +++ b/include/Pack/RPGraphics/RPGrpCamera.h @@ -154,6 +154,19 @@ class RPGrpCamera { void LoadScnCameraMatrix(const nw4r::g3d::ResAnmScn scn, u8 refNumber, f32 frame = 0.0f); + /** + * @brief Getter for position + * + * @return nw4r::math::VEC3 Camera position + */ + nw4r::math::VEC3 GetPosition() { + return mPosition; + } + + void SetPosition(nw4r::math::VEC3 newPos) { + mPosition = newPos; + } + /** * @brief Sets the type of this camera * diff --git a/include/Pack/RPGraphics/RPGrpCpuTexture.h b/include/Pack/RPGraphics/RPGrpCpuTexture.h new file mode 100644 index 000000000..bc48b1e16 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpCpuTexture.h @@ -0,0 +1,156 @@ +#ifndef RP_GRAPHICS_CPU_TEXTURE_H +#define RP_GRAPHICS_CPU_TEXTURE_H + +#include + +#include + +#include + +//! TODO(texline) Confirm this + +/** + * @note Superseded by EGG::CpuTexture in rev 1. + */ +class RPGrpCpuTexture { +private: + u16 mFlags; // at 0x0 + u16 mWidth; // at 0x2 + u16 mHeight; // at 0x4 + u8 mFormat; // at 0x6 + u8 mWrapS; // at 0x7 + u8 mWrapT; // at 0x8 + u8 mMinFilter; // at 0x9 + u8 mMagFilter; // at 0xA + char UNK_0xB[0x10 - 0xB]; + void* mpBuffer; // at 0x10 + +public: + enum EGradationKind { + GRADATION_LINEAR, // y=x + GRADATION_QUADRATIC, // y=x^2 + GRADATION_CUBIC, // y=x^3 + GRADATION_QUARTIC, // y=x^4 + GRADATION_QUINTIC, // y=x^5 + GRADATION_QUADRATIC_EASEOUT, // y=1-(1-x)^2 + GRADATION_QUARTIC_EASEOUT, // y=1-(1-x)^4 + }; + +public: + //! @bug Texture buffer is leaked + virtual ~RPGrpCpuTexture() {} // at 0x8 + virtual void configure(); // at 0xC + virtual void getTexObj(GXTexObj* pObj) const; // at 0x10 + virtual void load(GXTexMapID map); // at 0x14 + + RPGrpCpuTexture(); + RPGrpCpuTexture(u16 width, u16 height, GXTexFmt format); + + void alloc(); + void allocWithHeaderDebug(); + + RPGrpResTIMG* getResTIMG() const; + u32 getTexBufferSize() const; + + void fillNormalMapSphere(); + void fillGradationTable(EGradationKind kind, int dir, u16 tableStart, + u16 tableGoal, const GXColor& c1, const GXColor& c2, + bool wrap, bool setAll); + + void setColor(u16 x, u16 y, GXColor color); + + void invalidate() const; + void flush() const; + + bool checkIsConfigure() const { + return testFlag(cFlag_Configured); + } + bool checkHasHeader() const { + return testFlag(cFlag_HasHeader); + } + + void setFlag(u8 flag) { + mFlags |= flag; + } + void clearFlag(u8 flag) { + mFlags &= ~flag; + } + bool testFlag(u8 flag) const { + return (mFlags & flag) ? true : false; + } + + u16 getWidth() const { + return mWidth; + } + void setWidth(u16 w) { + mWidth = w; + } + + u16 getHeight() const { + return mHeight; + } + void setHeight(u16 h) { + mHeight = h; + } + + GXTexFmt getFormat() const { + return static_cast(mFormat); + } + void setFormat(GXTexFmt format) { + mFormat = format; + } + + GXTexWrapMode getWrapS() const { + return static_cast(mWrapS); + } + void setWrapS(u8 wrap) { + mWrapS = wrap; + } + + GXTexWrapMode getWrapT() const { + return static_cast(mWrapT); + } + void setWrapT(u8 wrap) { + mWrapT = wrap; + } + + GXTexFilter getMinFilter() const { + return static_cast(mMinFilter); + } + void setMinFilter(u8 filter) { + mMinFilter = filter; + } + + GXTexFilter getMagFilter() const { + return static_cast(mMagFilter); + } + void setMagFilter(u8 filter) { + mMagFilter = filter; + } + + void* getBuffer() const { + return mpBuffer; + } + void setBuffer(void* pBuffer) { + mpBuffer = pBuffer; + clearFlag(cFlag_HasHeader); + } + +private: + enum { + cFlag_Configured = 1 << 0, + cFlag_HasHeader = 1 << 1, + }; + +private: + void initResTIMG() const; + + RPGrpResTIMG* getHeader() const { + // clang-format off + return reinterpret_cast( + reinterpret_cast(mpBuffer) - sizeof(RPGrpResTIMG)); + // clang-format on + } +}; + +#endif diff --git a/include/Pack/RPGraphics/RPGrpModel.h b/include/Pack/RPGraphics/RPGrpModel.h index 87bb930b5..2480bee72 100644 --- a/include/Pack/RPGraphics/RPGrpModel.h +++ b/include/Pack/RPGraphics/RPGrpModel.h @@ -53,15 +53,38 @@ class RPGrpModel { }; protected: +#if defined(VERSION_RSPE01_00) + u8 unk0; + u8 unk1; + u16 mFlags; + u16 unk4; + u32 unkFlag; + RPGrpModel* mpEntryNext; // at 0xC + RPGrpModel* mpGenNext; // at 0x10 + nw4r::math::MTX34 mtx14; + nw4r::math::VEC3 mBaseScale; // at 0x44 + RPGrpModelAnm* mpModelAnm; // at 0x50 + RPGrpModelMaterial** mppMaterials; // at 0x54 + RPGrpModelBoundingInfo* mpBoundingInfo; // at 0x58 + RPGrpModelRecord* mpRecord; // at 0x5C + BOOL mReverseCulling; // at 0x60 + IRPGrpModelCallback* mpCallback; // at 0x64 + u8 mDrawScene; // at 0x68 + u8 mDrawGroup; // at 0x69 + u8 mViewNo; // at 0x6A + u8 padding; + u32 unk6C; + +#elif defined(VERSION_RSPE01_01) u8 mViewNo; // at 0x0 u8 mDrawScene; // at 0x1 u8 mDrawGroup; // at 0x2 - char unk3; + u8 unk3; char unk4; char unk5[0x8 - 0x5]; u16 mFlags; // at 0x8 u16 unkA; - u32 unkC; + u32 unkFlag; u32 unk10; RPGrpModel* mpEntryNext; // at 0x14 RPGrpModel* mpGenNext; // at 0x18 @@ -73,6 +96,7 @@ class RPGrpModel { RPGrpModelRecord* mpRecord; // at 0x38 BOOL mReverseCulling; // at 0x3C EGG::ModelEx* mpModelEx; // at 0x40 +#endif public: static RPGrpModel* Construct(RPGrpHandle handle, u8 viewNo, u32 typeOption, @@ -135,9 +159,15 @@ class RPGrpModel { nw4r::math::MTX34* pMtx) const = 0; // at 0x48 virtual void GetViewMtx(nw4r::math::MTX34* pMtx) const = 0; // at 0x4C +#if defined(VERSION_RSPE01_00) virtual u16 GetJointNum() const { // at 0x50 + return 0; // stubbed in rev 0 + } +#elif defined(VERSION_RSPE01_01) + virtual u16 GetJointNum() const { return mpModelEx->getNumNode(); } +#endif virtual const char* GetJointName(u16 idx) const = 0; // at 0x54 virtual u16 GetJointIndex(const char* pName) const = 0; // at 0x58 @@ -146,24 +176,39 @@ class RPGrpModel { virtual const char* GetMaterialName(u16 idx) const = 0; // at 0x60 virtual u16 GetMaterialIndex(const char* pName) const = 0; // at 0x64 +#if defined(VERSION_RSPE01_00) + virtual u16 GetShapeNum() const { // at 0x68 + return 0; + } +#elif defined(VERSION_RSPE01_01) virtual u16 GetShapeNum() const { // at 0x68 return mpModelEx->getNumShape(); } +#endif virtual const char* GetShapeName(u16 idx) const = 0; // at 0x6C virtual u16 GetShapeIndex(const char* pName) const = 0; // at 0x70 +#if defined(VERSION_RSPE01_00) + virtual u16 GetViewMtxNum() const { // at 0x74 + return 0; + } +#elif defined(VERSION_RSPE01_01) virtual u16 GetViewMtxNum() const { // at 0x74 return mpModelEx->getNumViewMtx(); } +#endif +#if defined(VERSION_RSPE01_01) virtual void DrawDirect(u32 drawFlag, nw4r::math::MTX34* pViewMtx) { // at 0x78 mpModelEx->drawShapeDirectly(drawFlag, true, true, pViewMtx); } +#endif virtual void CalcMaterial(); // at 0x7C +#if defined(VERSION_RSPE01_01) virtual void CalcBeforeDraw() { // at 0x80 mpModelEx->setVisible(mFlags & EFlag_Visible); } @@ -181,6 +226,7 @@ class RPGrpModel { const_cast(&rViewMtx)); } } +#endif void RemoveGenList(); void CreateMaterial(u16 idx); @@ -190,6 +236,15 @@ class RPGrpModel { void Calc(); void Entry(); +//! This is a bit hacky, but it's meant for nw4r functions +//! that require a pointer, not the matrix itself (texline) +#if defined(VERSION_RSPE01_00) + nw4r::math::MTX34* GetMtxPtr() { + return &mtx14; + } +#endif + +#if defined(VERSION_RSPE01_01) EGG::ModelEx* GetModelEx() const { return mpModelEx; } @@ -213,6 +268,11 @@ class RPGrpModel { nw4r::g3d::ScnRfl* GetScnRfl() const { return mpModelEx->getScnRfl(); } +#endif + + RPGrpModelAnm* GetModelAnm() const { + return mpModelAnm; + } const nw4r::math::VEC3& GetBaseScale() const { return mBaseScale; @@ -243,6 +303,22 @@ class RPGrpModel { return (mFlags & EFlag_Visible) ? true : false; } + u8 GetDrawScene() const { + return mDrawScene; + } + + void SetDrawScene(u8 drawScene) { + mDrawScene = drawScene; + } + + u8 GetUnk4() const { + return unk4; + } + + u8 GetDrawGroup() const { + return mDrawGroup; + } + /** * @brief Gets the allocator used for model-related allocations */ @@ -266,10 +342,12 @@ class RPGrpModel { virtual void CreateAnm() = 0; // at 0x90 virtual void InternalCalc() = 0; // at 0x94 +#if defined(VERSION_RSPE01_01) virtual void GetShapeMinMax(u16 shapeIdx, nw4r::math::VEC3* pMin, nw4r::math::VEC3* pMax) const { // at 0x98 mpModelEx->getShapeMinMax(shapeIdx, pMin, pMax, false); } +#endif protected: enum { diff --git a/include/Pack/RPGraphics/RPGrpModelAnm.h b/include/Pack/RPGraphics/RPGrpModelAnm.h index 314c6169f..6ebb60de4 100644 --- a/include/Pack/RPGraphics/RPGrpModelAnm.h +++ b/include/Pack/RPGraphics/RPGrpModelAnm.h @@ -133,6 +133,12 @@ class RPGrpModelAnm { } } +#if defined(VERSION_RSPE01_00) + virtual void Calc(); +#elif defined(VERSION_RSPE01_01) + void Calc(); +#endif + virtual void SetEnableChrAnm(bool enable) { // at 0x68 if (!enable) { mFlags |= Flag_DisableChrAnm; @@ -151,8 +157,6 @@ class RPGrpModelAnm { void CreateBuffer(Anm anm, u16 num); - void Calc(); - s8 GetBlendIndex(Anm anm, AnmIdx idx, u8); void InternalRegist(Anm anm, u16 idx); diff --git a/include/Pack/RPGraphics/RPGrpModelG3D.h b/include/Pack/RPGraphics/RPGrpModelG3D.h index aa2febc9d..fcabd43c2 100644 --- a/include/Pack/RPGraphics/RPGrpModelG3D.h +++ b/include/Pack/RPGraphics/RPGrpModelG3D.h @@ -39,6 +39,7 @@ class RPGrpModelG3D : public RPGrpModel, virtual IRPGrpModelCallback* SetCallback(IRPGrpModelCallback* pCallback) override; // at 0x18 +#if defined(VERSION_RSPE01_01) virtual void SetCallbackJointIndex(u16 idx) override { // at 0x24 GetScnMdlSimple()->SetScnMdlCallbackNodeID(idx); } @@ -114,6 +115,7 @@ class RPGrpModelG3D : public RPGrpModel, virtual void Configure() override; // at 0x8C virtual void CreateAnm() override; // at 0x90 virtual void InternalCalc() override; // at 0x94 +#endif virtual void ExecCallback_CALC_WORLD(nw4r::g3d::ScnObj::Timing timing, nw4r::g3d::ScnObj* pObj, u32 param, diff --git a/include/Pack/RPGraphics/RPGrpModelRfl.h b/include/Pack/RPGraphics/RPGrpModelRfl.h index cc15f6746..04b4e4b74 100644 --- a/include/Pack/RPGraphics/RPGrpModelRfl.h +++ b/include/Pack/RPGraphics/RPGrpModelRfl.h @@ -49,6 +49,7 @@ class RPGrpModelRfl : public RPGrpModel, public nw4r::g3d::IScnObjCallback { return 0; } +#if defined(VERSION_RSPE01_01) virtual void GetWorldMtx(u16 /* idx */, nw4r::math::MTX34* pMtx) const override { // at 0x3C @@ -61,12 +62,14 @@ class RPGrpModelRfl : public RPGrpModel, public nw4r::g3d::IScnObjCallback { GetWorldMtx(u16 /* nodeIdx */) const override { // at 0x40 return GetScnObj()->GetMtxPtr(nw4r::g3d::ScnObj::MTX_LOCAL); } +#endif virtual nw4r::math::MTX34* ReferWorldMtx(u16 /* nodeIdx */) const override { // at 0x44 return &spCalcWorldMtxArray[0]; } +#if defined(VERSION_RSPE01_01) virtual void GetViewMtx(nw4r::math::MTX34* pMtx) const override { // at 0x4C GetScnObj()->GetMtx(nw4r::g3d::ScnObj::MTX_VIEW, pMtx); } @@ -75,6 +78,7 @@ class RPGrpModelRfl : public RPGrpModel, public nw4r::g3d::IScnObjCallback { nw4r::math::MTX34* pMtx) const override { // at 0x48 GetViewMtx(pMtx); } +#endif virtual const char* GetJointName(u16 idx) const override; // at 0x54 diff --git a/include/Pack/RPGraphics/RPGrpModelScene.h b/include/Pack/RPGraphics/RPGrpModelScene.h index 2f4fed433..d86ff2b4a 100644 --- a/include/Pack/RPGraphics/RPGrpModelScene.h +++ b/include/Pack/RPGraphics/RPGrpModelScene.h @@ -2,6 +2,10 @@ #define RP_GRAPHICS_MODEL_SCENE_H #include +#include + +#include + //! @addtogroup rp_graphics //! @{ @@ -14,7 +18,18 @@ class RPGrpScreen; */ class RPGrpModelScene { private: - char unk00[0xA4]; + char unk00[0x2]; + char mIdx; // at 0x2 + char unk03; + u8 unk04; + char unk05[0x3]; + u8 unk08; + char unk09[0x3]; + EGG::LightManager* mpLightManager; // at 0xC + EGG::FogManager* mpFogManager; // at 0x10 + char unk14[0x88]; + EGG::ScnRootEx* mpScnRootEx; // at 0x9C + char unkA0[0x4]; public: virtual ~RPGrpModelScene(); // at 0x8 @@ -24,7 +39,17 @@ class RPGrpModelScene { virtual void DrawFinish(); // at 0x18 virtual void PreConditionForRenderingGX() const; // at 0x1C + void g_calc_background(); + void DrawPrepare(const RPGrpCamera* pCamera, const RPGrpScreen* pScreen); + + void setDrawPriority(RPGrpModel* pModel) const; + + /** + * @brief Initializes a scene's projection matrix, + * ambient lights, and fog GX + */ + void setupGX() const; }; //! @} diff --git a/include/Pack/RPGraphics/RPGrpRenderer.h b/include/Pack/RPGraphics/RPGrpRenderer.h index 24fd2ed83..bbc8c9c46 100644 --- a/include/Pack/RPGraphics/RPGrpRenderer.h +++ b/include/Pack/RPGraphics/RPGrpRenderer.h @@ -2,6 +2,9 @@ #define RP_GRAPHICS_RENDERER_H #include +#include +#include + #include //! @addtogroup rp_graphics @@ -17,8 +20,27 @@ class RPGrpView; */ class RPGrpRenderer { public: + enum RenderPassState { + RENDERPASS_SYSCALC, + RENDERPASS_SYSDRAW, + RENDERPASS_DRAWBEFORE, + RENDERPASS_DRAW, + RENDERPASS_DRAWDONE, + RENDERPASS_DRAW2D, + RENDERPASS_3DOPA, + RENDERPASS_3DXLU, + RENDERPASS_SVBEFORE, + RENDERPASS_SV, + RENDERPASS_EFFECT_2, + RENDERPASS_BEGIN, + RENDERPASS_END, + RENDERPASS_NULL, + }; + //! Maximum number of renderer views static const int MAX_VIEW = 32; + static bool sRendering; + static RenderPassState sRenderPass; public: /** @@ -46,6 +68,9 @@ class RPGrpRenderer { return spCurrentScreen; } + /** + * @brief Sets up a GX context for rendering + */ static void Begin(); static void End(); @@ -62,6 +87,9 @@ class RPGrpRenderer { AppendDrawObject(&rObject); } + RPGrpViewRender3D* CreateView3D(u8 viewNo, RPGrpCamera* camera, + RPGrpScreen* screen); + void PreCalculate(); void PostCalculate(); void CalculateInPause(); @@ -76,8 +104,8 @@ class RPGrpRenderer { static RPGrpScreen* spCurrentScreen; char unk0[0xC]; - IRPGrpDrawObject* mpDrawList; // at 0xC - char unk10[0x14 - 0x10]; + IRPGrpDrawObject* mpDrawList; // at 0xC + IRPGrpDrawObject* mpDrawObj; // at 0x10 RPGrpView* mpDrawViews[MAX_VIEW]; // at 0x14 }; diff --git a/include/Pack/RPGraphics/RPGrpResTIMG.h b/include/Pack/RPGraphics/RPGrpResTIMG.h new file mode 100644 index 000000000..4e5ba1679 --- /dev/null +++ b/include/Pack/RPGraphics/RPGrpResTIMG.h @@ -0,0 +1,36 @@ +#ifndef RP_GRAPHICS_RES_TIMG_H +#define RP_GRAPHICS_RES_TIMG_H +#include + +struct RPGrpResTIMG { + + enum JUTTransparency { + JUT_TRANSPARENCY_DISABLE, + JUT_TRANSPARENCY_ENABLE, + }; + + u8 format; // at 0x0 + u8 transparency; // at 0x1 + u16 width; // at 0x2 + u16 height; // at 0x4 + u8 wrapS; // at 0x6 + u8 wrapT; // at 0x7 + u8 tlutName; // at 0x8 + u8 tlutFormat; // at 0x9 + u16 paletteEntryNum; // at 0xA + s32 paletteOffset; // at 0xC + u8 mipMap; // at 0x10 + u8 edgeLODEnable; // at 0x11 + u8 biasClampEnable; // at 0x12 + u8 anisotropy; // at 0x13 + u8 minFilter; // at 0x14 + u8 magFilter; // at 0x15 + s8 minLOD; // at 0x16 + s8 maxLOD; // at 0x17 + u8 mipMapLevel; // at 0x18 + u8 BYTE_0x19; + s16 LODBias; // at 0x1A + s32 imageOffset; // at 0x1C +}; + +#endif diff --git a/include/Pack/RPSports/RPSportsCommon.h b/include/Pack/RPSports/RPSportsCommon.h index f762160ec..4c36f408d 100644 --- a/include/Pack/RPSports/RPSportsCommon.h +++ b/include/Pack/RPSports/RPSportsCommon.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/include/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.h b/include/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.h new file mode 100644 index 000000000..c5b2e1a70 --- /dev/null +++ b/include/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.h @@ -0,0 +1,50 @@ +#ifndef RP_SPORTS_MENU_BG_MODEL_H +#define RP_SPORTS_MENU_BG_MODEL_H +#include + +#include +#include +#include + +class RPSportsMenuBgModel : public RP_DEBUG_STUB_1 { +protected: + /** + * @brief Constructor + */ + RPSportsMenuBgModel(u8 unk, u8 drawScene, u16 flags); + + /** + * @brief Destructor + */ + virtual ~RPSportsMenuBgModel(); + +public: + /** + * @brief Creates background model + * + * @param modelArchive Pointer to archive with model data. Defaults to + * common archive if left blank + */ + void createData(EGG::Archive* modelArchive); + + /** + * @brief Initializes variables and starts animation process + */ + void initCamera(); + + /** + * @brief Calculates view transformation matrix every frame + */ + void calcView(); + +private: + u8 mViewNo; // at 0x4 + u8 mDrawScene; // at 0x5 + u16 mFlags; // at 0x6 + RPGrpModel* mpModel; // at 0x8 + RPGrpCamera* mpCamera; // at 0xC + nw4r::math::VEC3 mEyeView; // at 0x10 + nw4r::math::VEC3 mBaseScale; // at 0x1C +}; + +#endif diff --git a/include/Pack/RPSystem/RPSysGameConfig.h b/include/Pack/RPSystem/RPSysGameConfig.h index 2c845422c..673309476 100644 --- a/include/Pack/RPSystem/RPSysGameConfig.h +++ b/include/Pack/RPSystem/RPSysGameConfig.h @@ -10,6 +10,11 @@ /** * @brief Pack Project Game Config File (`gameConfig.ini`) + * + * @details Some of the listed people did not work (or were not + * credited on Wii Sports, but on other Pack Project games. Some + * names are verified with the Wii Fit config, which contains + * commented kanji spellings. */ class RPSysGameConfig : public RPSysTagParameters { RP_SINGLETON_DECL_EX(RPSysGameConfig); @@ -40,29 +45,29 @@ class RPSysGameConfig : public RPSysTagParameters { RPSysPrimTagParm mRPUserPrint; // at 0x90 #if defined(VERSION_RSPE01_01) - //! Mr. Sumaki print setting + //! Kazuya Sumaki print setting RPSysPrimTagParm mRPSmkPrint; // at 0xA0 - //! Mr. Okamura(?) print setting + //! Yuichiro Okamura(?) print setting RPSysPrimTagParm mRPOkaPrint; // at 0xB0 //! Unknown RPSysPrimTagParm mRPOknPrint; // at 0xC0 - //! Mr. Kasamatsu print setting + //! Shigehiro Kasamatsu print setting RPSysPrimTagParm mRPKasPrint; // at 0xD0 - //! Mr. Matsutani print setting + //! Kenji Matsutani print setting RPSysPrimTagParm mRPMatPrint; // at 0xE0 - //! Mr. Sawaya print setting + //! Yuji Sawatani print setting RPSysPrimTagParm mRPSawPrint; // at 0xF0 - //! Mr. Sakakibara print setting + //! Masaro Sakakibara print setting RPSysPrimTagParm mRPSakPrint; // at 0x100 - //! Mr. Koda print setting + //! Kiyoshi Kohda print setting RPSysPrimTagParm mRPKodPrint; // at 0x110 - //! Mr. Sakaguchi print setting + //! Atsushi Sakaguchi print setting RPSysPrimTagParm mRPGutPrint; // at 0x120 - //! Mr. Sakai print setting + //! Kouji Sakai print setting RPSysPrimTagParm mRPSaiPrint; // at 0x130 - //! Mr. Sumiyoshi print setting + //! Nobuhiro Sumiyoshi print setting RPSysPrimTagParm mRPSumPrint; // at 0x140 - //! Mr. Umemiya print setting + //! Hiroshi Umemiya print setting RPSysPrimTagParm mRPUmePrint; // at 0x150 #endif diff --git a/include/egg/gfxe/eggCpuTexture.h b/include/egg/gfxe/eggCpuTexture.h index 2f5253881..fe4a05a42 100644 --- a/include/egg/gfxe/eggCpuTexture.h +++ b/include/egg/gfxe/eggCpuTexture.h @@ -34,7 +34,7 @@ class CpuTexture { }; public: - // @bug Texture buffer is leaked + //! @bug Texture buffer is leaked virtual ~CpuTexture() {} // at 0x8 virtual void configure(); // at 0xC virtual void getTexObj(GXTexObj* pObj) const; // at 0x10 diff --git a/include/egg/gfxe/eggFogManager.h b/include/egg/gfxe/eggFogManager.h index 887ea665d..202d4c7e7 100644 --- a/include/egg/gfxe/eggFogManager.h +++ b/include/egg/gfxe/eggFogManager.h @@ -29,6 +29,10 @@ class FogManager { void LoadScnFog(const nw4r::g3d::ResAnmScn scn, f32 frame); void DoneDraw(); + Fog* GetFog(int id) { + return mFog[id]; + } + private: enum { cFlag_CalcDone = 1 << 2, diff --git a/include/egg/gfxe/eggLightManager.h b/include/egg/gfxe/eggLightManager.h index 07d3c08aa..2c1748708 100644 --- a/include/egg/gfxe/eggLightManager.h +++ b/include/egg/gfxe/eggLightManager.h @@ -26,6 +26,19 @@ class LightManager : IBinary { void Calc(nw4r::g3d::ScnRoot*); void CalcView(const nw4r::math::MTX34&, u8, nw4r::g3d::ScnRoot*); + /** + * @brief Sets ambient color registers + * + * @details Channel 0 is set to current value of m_pAmbColor0, + * while channel 1 is set to black + */ + void SetChanAmbColor() const; + + /** + * @brief Loads light registers with contents of array index + */ + void LoadObjIndxGX() const; + void DoneDraw(); void LoadScnLightInner(nw4r::g3d::ResAnmScn, f32, u32); @@ -50,7 +63,8 @@ class LightManager : IBinary { u16 m_numLight; // at 0x4 char UNK_0x8[0xC - 0x8]; LightObj** m_ppLightSet; // at 0xC - char UNK_0X10[0x18 - 0x10]; + GXColor* m_pAmbColor0; // at 0x10 + char UNK_0X14[0x18 - 0x14]; u8 m_viewNum; // at 0x18 u8 m_currentView; // at 0x19 char UNK_0x1A[0x20 - 0x1A]; diff --git a/include/egg/gfxe/eggLightObject.h b/include/egg/gfxe/eggLightObject.h index 263b83e3e..6f8e26ad7 100644 --- a/include/egg/gfxe/eggLightObject.h +++ b/include/egg/gfxe/eggLightObject.h @@ -5,6 +5,8 @@ #include #include +#include + #include namespace EGG { @@ -44,13 +46,29 @@ class LightObject : IBinary { void Reset(); void Calc(); + /** + * @brief Calculates direction vectors using camera viewpoint + * + * @param rCameraMtx Matrix used for creating position vector + */ void CalcView(const nw4r::math::MTX34& rCameraMtx); void CalcFinalDirColor(const EGG::LightTexture& rTexture, nw4r::math::VEC3* pDir, GXColor* pColor); + void InitGX(GXLightObj* pObj) const; + + void CopyToG3D_World(nw4r::g3d::ScnRoot& pScnRoot) const; + + void CopyFromG3D(nw4r::g3d::LightAnmResult* pResult, f32 frame); + void CalcDirDist(); + /** + * @brief Calculates attenuation for light object + */ + void CalcAt(); + void SetPosAt(const nw4r::math::VEC3& rPos, const nw4r::math::VEC3& rAt); private: @@ -74,9 +92,9 @@ class LightObject : IBinary { private: u16 mAmbIndex; // at 0x4 - Vector3f mAt; // at 0x8 - Vector3f mPos; // at 0x14 - Vector3f mDir; // at 0x20 + nw4r::math::VEC3 mAt; // at 0x8 + nw4r::math::VEC3 mPos; // at 0x14 + nw4r::math::VEC3 mDir; // at 0x20 GXColor mBrightnessColor; // at 0x2C f32 mIntensity; // at 0x30 LightType mLightType; // at 0x34 diff --git a/include/egg/gfxe/eggLightTexture.h b/include/egg/gfxe/eggLightTexture.h index 6d5f930a6..fac80854c 100644 --- a/include/egg/gfxe/eggLightTexture.h +++ b/include/egg/gfxe/eggLightTexture.h @@ -1,9 +1,9 @@ #ifndef EGG_GFXE_LIGHT_TEXTURE_H #define EGG_GFXE_LIGHT_TEXTURE_H -#include "eggCapTexture.h" -#include "eggIBinary.h" -#include "eggScreen.h" -#include "types_egg.h" +#include + +#include +#include namespace EGG { class LightTexture : public CapTexture, public IBinary { diff --git a/include/egg/gfxe/eggPostEffectBlur.h b/include/egg/gfxe/eggPostEffectBlur.h index 5949ddfcd..febb49ea7 100644 --- a/include/egg/gfxe/eggPostEffectBlur.h +++ b/include/egg/gfxe/eggPostEffectBlur.h @@ -1,8 +1,10 @@ #ifndef EGG_GFXE_POST_EFFECT_BLUR_H #define EGG_GFXE_POST_EFFECT_BLUR_H -#include "eggAssert.h" -#include "eggPostEffectBase.h" -#include "types_egg.h" +#include + +#include +#include + namespace EGG { class PostEffectBlur : public PostEffectBase { diff --git a/include/egg/gfxe/eggPostEffectBlurGather.h b/include/egg/gfxe/eggPostEffectBlurGather.h index 3408905b3..6805d54c4 100644 --- a/include/egg/gfxe/eggPostEffectBlurGather.h +++ b/include/egg/gfxe/eggPostEffectBlurGather.h @@ -1,9 +1,10 @@ #ifndef EGG_GFXE_POST_EFFECT_BLUR_GATHER_H #define EGG_GFXE_POST_EFFECT_BLUR_GATHER_H -#include "eggAssert.h" -#include "eggDrawGX.h" -#include "eggPostEffectBase.h" -#include "types_egg.h" +#include + +#include +#include +#include namespace EGG { class PostEffectBlurGather : public PostEffectBase { diff --git a/include/egg/gfxe/eggPostEffectBlurSimple.h b/include/egg/gfxe/eggPostEffectBlurSimple.h index 011661b7b..c682b920d 100644 --- a/include/egg/gfxe/eggPostEffectBlurSimple.h +++ b/include/egg/gfxe/eggPostEffectBlurSimple.h @@ -1,7 +1,8 @@ #ifndef EGG_GFXE_POST_EFFECT_BLUR_SIMPLE_H #define EGG_GFXE_POST_EFFECT_BLUR_SIMPLE_H -#include "eggPostEffectBase.h" -#include "types_egg.h" +#include + +#include namespace EGG { diff --git a/include/egg/gfxe/eggScnRootEx.h b/include/egg/gfxe/eggScnRootEx.h index 3d5286937..a6890a941 100644 --- a/include/egg/gfxe/eggScnRootEx.h +++ b/include/egg/gfxe/eggScnRootEx.h @@ -58,6 +58,9 @@ class ScnRootEx : public IDrawGX { void SetCurrentCamera(int idx, const nw4r::math::MTX34& rCameraMtx, const Screen& rScreen); + /** + * @brief Calculates view matrices for each 3D object in scene + */ void CalcView(); void GatherDrawScnObj(); diff --git a/include/egg/gfxe/eggScreen.h b/include/egg/gfxe/eggScreen.h index d3587f86d..bab637f51 100644 --- a/include/egg/gfxe/eggScreen.h +++ b/include/egg/gfxe/eggScreen.h @@ -46,7 +46,10 @@ class Screen : public Frustum { CanvasMode canvasMode); Screen(const Screen& rOther); - virtual ~Screen() {} // at 0x8 + virtual ~Screen() {} // at 0x8 + /** + * @brief Sets projection matrix + */ virtual void SetProjectionGX() const; // at 0xC virtual void CopyToG3D(nw4r::g3d::Camera camera) const; // at 0x10 diff --git a/include/egg/gfxe/eggShadowTexture.h b/include/egg/gfxe/eggShadowTexture.h index 88614419b..f63aa22f5 100644 --- a/include/egg/gfxe/eggShadowTexture.h +++ b/include/egg/gfxe/eggShadowTexture.h @@ -1,8 +1,10 @@ #ifndef EGG_GFXE_SHADOW_TEXTURE_H #define EGG_GFXE_SHADOW_TEXTURE_H -#include "eggModelSnapshot.h" -#include "eggPostEffectBase.h" -#include "types_egg.h" +#include + +#include +#include + namespace EGG { class ShadowTexture : public ModelSnapshot { diff --git a/include/egg/gfxe/eggShadowTextureManager.h b/include/egg/gfxe/eggShadowTextureManager.h index bce076e38..b39e23eb3 100644 --- a/include/egg/gfxe/eggShadowTextureManager.h +++ b/include/egg/gfxe/eggShadowTextureManager.h @@ -1,6 +1,6 @@ #ifndef EGG_GFXE_SHADOW_TEXTURE_MANAGER_H #define EGG_GFXE_SHADOW_TEXTURE_MANAGER_H -#include "types_egg.h" +#include namespace EGG { diff --git a/include/egg/gfxe/eggStateGX.h b/include/egg/gfxe/eggStateGX.h index 51f2d36c8..9338615ee 100644 --- a/include/egg/gfxe/eggStateGX.h +++ b/include/egg/gfxe/eggStateGX.h @@ -1,5 +1,7 @@ #ifndef EGG_GFXE_STATE_GX_H #define EGG_GFXE_STATE_GX_H +#include + #include #include @@ -107,6 +109,15 @@ class StateGX { s_heightEfb = height; } + static f32 getModifyRatio() { + return s_modifyRatio; + } + static void setModifyRatio(f32 modify) { +#line 261 + EGG_ASSERT(0.f <= modify && modify <= 1.f); + s_modifyRatio = modify; + } + private: struct GXCache { u32 flags; // at 0x0 diff --git a/include/egg/math/eggMatrix.h b/include/egg/math/eggMatrix.h index d3e4fbc16..84a4879fe 100644 --- a/include/egg/math/eggMatrix.h +++ b/include/egg/math/eggMatrix.h @@ -76,7 +76,10 @@ class Matrix34f : public nw4r::math::MTX34 { f32 z = _20 * rVec.x + _21 * rVec.y + _22 * rVec.z; return Vector3f(x, y, z); } - + /** + * @brief Creates a 3x4 identity matrix. As identity matrices are + * square, the fourth column is zeroed out. + */ void makeIdentity(); void makeQ(const Quatf& rQuat); diff --git a/include/revolution/BTE/bta/ar/bta_ar_int.h b/include/revolution/BTE/bta/ar/bta_ar_int.h deleted file mode 100644 index d2304480a..000000000 --- a/include/revolution/BTE/bta/ar/bta_ar_int.h +++ /dev/null @@ -1,64 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2008-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This is the private interface file for the BTA audio/video registration - * module. - * - ******************************************************************************/ -#ifndef BTA_AR_INT_H -#define BTA_AR_INT_H - -#include "bta_av_api.h" - - -#ifndef BTA_AR_DEBUG -#define BTA_AR_DEBUG FALSE -#endif - -#define BTA_AR_AV_MASK 0x01 -#define BTA_AR_AVK_MASK 0x02 - -/* data associated with BTA_AR */ -typedef struct -{ - tAVDT_CTRL_CBACK *p_av_conn_cback; /* av connection callback function */ - tAVDT_CTRL_CBACK *p_avk_conn_cback; /* avk connection callback function */ - UINT8 avdt_registered; - UINT8 avct_registered; - UINT32 sdp_tg_handle; - UINT32 sdp_ct_handle; - UINT16 ct_categories[2]; - UINT8 tg_registered; - tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the connection. */ -} tBTA_AR_CB; - -/***************************************************************************** -** Global data -*****************************************************************************/ - -/* control block declaration */ -#if BTA_DYNAMIC_MEMORY == FALSE -extern tBTA_AR_CB bta_ar_cb; -#else -extern tBTA_AR_CB *bta_ar_cb_ptr; -#define bta_ar_cb (*bta_ar_cb_ptr) -#endif - -#endif /* BTA_AR_INT_H */ diff --git a/include/revolution/BTE/bta/include/bta_ar_api.h b/include/revolution/BTE/bta/include/bta_ar_api.h deleted file mode 100644 index b451cb453..000000000 --- a/include/revolution/BTE/bta/include/bta_ar_api.h +++ /dev/null @@ -1,140 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2004-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This is the public interface file for the simulatenous advanced - * audio/video streaming (AV) source and sink of BTA, Broadcom's Bluetooth - * application layer for mobile phones. - * - ******************************************************************************/ -#ifndef BTA_AR_API_H -#define BTA_AR_API_H - -#include "avdt_api.h" -#include "avct_api.h" -#include "avrc_api.h" -#include "sdp_api.h" -#include "bta_av_api.h" -#include "bta_sys.h" - -/***************************************************************************** -** Constants and data types -*****************************************************************************/ -/* This event signal to AR user that other profile is connected */ -#define BTA_AR_AVDT_CONN_EVT (AVDT_MAX_EVT + 1) - -/******************************************************************************* -** -** Function bta_ar_init -** -** Description This function is called from bta_sys_init(). -** to initialize the control block -** -** Returns void -** -*******************************************************************************/ -extern void bta_ar_init(void); - -/******************************************************************************* -** -** Function bta_ar_reg_avdt -** -** Description This function is called to register to AVDTP. -** -** Returns void -** -*******************************************************************************/ -extern void bta_ar_reg_avdt(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback, tBTA_SYS_ID sys_id); - -/******************************************************************************* -** -** Function bta_ar_dereg_avdt -** -** Description This function is called to de-register from AVDTP. -** -** Returns void -** -*******************************************************************************/ -extern void bta_ar_dereg_avdt(tBTA_SYS_ID sys_id); - -/******************************************************************************* -** -** Function bta_ar_avdt_conn -** -** Description This function is called to let ar know that some AVDTP profile -** is connected for this sys_id. -** If the other sys modules started a timer for PENDING_EVT, -** the timer can be stopped now. -** -** Returns void -** -*******************************************************************************/ -extern void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, BD_ADDR bd_addr); - -/******************************************************************************* -** -** Function bta_ar_reg_avct -** -** Description This function is called to register to AVCTP. -** -** Returns void -** -*******************************************************************************/ -extern void bta_ar_reg_avct(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask, tBTA_SYS_ID sys_id); - -/******************************************************************************* -** -** Function bta_ar_dereg_avct -** -** Description This function is called to deregister from AVCTP. -** -** Returns void -** -*******************************************************************************/ -extern void bta_ar_dereg_avct(tBTA_SYS_ID sys_id); - -/****************************************************************************** -** -** Function bta_ar_reg_avrc -** -** Description This function is called to register an SDP record for AVRCP. -** -** Returns void -** -******************************************************************************/ -extern void bta_ar_reg_avrc(UINT16 service_uuid, char *p_service_name, - char *p_provider_name, UINT16 categories, tBTA_SYS_ID sys_id); - -/****************************************************************************** -** -** Function bta_ar_dereg_avrc -** -** Description This function is called to de-register/delete an SDP record for AVRCP. -** -** Returns void -** -******************************************************************************/ -extern void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id); - - -#ifdef __cplusplus -} -#endif - -#endif /* BTA_AR_API_H */ diff --git a/include/revolution/BTE/gki/common/gki.h b/include/revolution/BTE/gki/common/gki.h index c9824abbc..2f5995a1e 100644 --- a/include/revolution/BTE/gki/common/gki.h +++ b/include/revolution/BTE/gki/common/gki.h @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Defined out functions unused in RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation @@ -409,7 +419,9 @@ GKI_API extern void GKI_freebuf (void *); GKI_API extern void *GKI_getbuf (UINT16); GKI_API extern UINT16 GKI_get_buf_size (void *); GKI_API extern void *GKI_getpoolbuf (UINT8); +#ifndef REVOLUTION GKI_API extern UINT16 GKI_poolcount (UINT8); +#endif GKI_API extern UINT16 GKI_poolfreecount (UINT8); GKI_API extern UINT16 GKI_poolutilization (UINT8); GKI_API extern void GKI_register_mempool (void *p_mem); @@ -422,7 +434,9 @@ GKI_API extern void *GKI_dequeue (BUFFER_Q *); GKI_API extern void GKI_enqueue (BUFFER_Q *, void *); GKI_API extern void GKI_enqueue_head (BUFFER_Q *, void *); GKI_API extern void *GKI_getfirst (BUFFER_Q *); +#ifndef REVOLUTION GKI_API extern void *GKI_getlast (BUFFER_Q *); +#endif GKI_API extern void *GKI_getnext (void *); GKI_API extern void GKI_init_q (BUFFER_Q *); GKI_API extern BOOLEAN GKI_queue_is_empty(BUFFER_Q *); @@ -443,7 +457,9 @@ GKI_API extern void GKI_start_timer(UINT8, INT32, BOOLEAN); GKI_API extern void GKI_stop_timer (UINT8); GKI_API extern void GKI_timer_update(INT32); GKI_API extern UINT16 GKI_update_timer_list (TIMER_LIST_Q *, INT32); +#ifndef REVOLUTION GKI_API extern UINT32 GKI_get_remaining_ticks (TIMER_LIST_Q *, TIMER_LIST_ENT *); +#endif GKI_API extern UINT16 GKI_wait(UINT16, UINT32); /* Start and Stop system time tick callback @@ -454,7 +470,9 @@ typedef void (SYSTEM_TICK_CBACK)(BOOLEAN); /* Time queue management for system ticks */ +#ifndef REVOLUTION GKI_API extern BOOLEAN GKI_timer_queue_empty (void); +#endif GKI_API extern void GKI_timer_queue_register_callback(SYSTEM_TICK_CBACK *); /* Disable Interrupts, Enable Interrupts diff --git a/include/revolution/BTE/include/bt_target.h b/include/revolution/BTE/include/bt_target.h index 9aa2a97d0..11edabf55 100644 --- a/include/revolution/BTE/include/bt_target.h +++ b/include/revolution/BTE/include/bt_target.h @@ -4,6 +4,10 @@ * 2024/03/25: * - Add #defines for RVL target * + * 2026/09/24: + * - Changed preprocessing directives to remove extraneous APIs + * (with respect to RVL) + * * Compile with REVOLUTION defined to include these changes. * ******************************************************************************/ @@ -233,7 +237,7 @@ #endif #ifndef BTA_AR_INCLUDED -#define BTA_AR_INCLUDED TRUE +#define BTA_AR_INCLUDED FALSE #endif #ifndef BTA_AV_INCLUDED @@ -317,11 +321,11 @@ #endif #ifndef ANDROID_APP_INCLUDED -#define ANDROID_APP_INCLUDED TRUE +#define ANDROID_APP_INCLUDED FALSE #endif #ifndef ANDROID_USE_LOGCAT -#define ANDROID_USE_LOGCAT TRUE +#define ANDROID_USE_LOGCAT FALSE #endif #ifndef LINUX_GKI_INCLUDED @@ -337,7 +341,7 @@ #endif #ifndef GKI_PTHREAD_JOINABLE -#define GKI_PTHREAD_JOINABLE TRUE +#define GKI_PTHREAD_JOINABLE FALSE #endif #ifndef LINUX_DRV_INCLUDED @@ -3447,7 +3451,7 @@ Range: Minimum 12000 (12 secs) on BR/EDR when supporting PBF. ******************************************************************************/ #ifndef AVCT_INCLUDED -#define AVCT_INCLUDED TRUE +#define AVCT_INCLUDED FALSE #endif /* Number of simultaneous ACL links to different peer devices. */ diff --git a/include/revolution/BTE/stack/include/l2c_api.h b/include/revolution/BTE/stack/include/l2c_api.h index 618ea8d54..654c9268d 100644 --- a/include/revolution/BTE/stack/include/l2c_api.h +++ b/include/revolution/BTE/stack/include/l2c_api.h @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Defined out unused functions for RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation @@ -61,6 +71,7 @@ typedef UINT8 tL2CAP_CHNL_PRIORITY; +#ifndef REVOLUTION /* Values for Tx/Rx data rate parameter to L2CA_SetChnlDataRate */ #define L2CAP_CHNL_DATA_RATE_HIGH 3 #define L2CAP_CHNL_DATA_RATE_MEDIUM 2 @@ -68,6 +79,7 @@ typedef UINT8 tL2CAP_CHNL_PRIORITY; #define L2CAP_CHNL_DATA_RATE_NO_TRAFFIC 0 typedef UINT8 tL2CAP_CHNL_DATA_RATE; +#endif /* Data Packet Flags (bits 2-15 are reserved) */ /* layer specific 14-15 bits are used for FCR SAR */ @@ -694,9 +706,12 @@ L2C_API extern BOOLEAN L2CA_RegForNoCPEvt(tL2CA_NOCP_CB *p_cb, BD_ADDR p_bda); ** Returns TRUE if a valid channel, else FALSE ** *******************************************************************************/ +#ifndef REVOLUTION L2C_API extern BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx); + typedef void (tL2CA_RESERVE_CMPL_CBACK) (void); +#endif /******************************************************************************* ** diff --git a/include/revolution/BTE/stack/l2cap/l2c_int.h b/include/revolution/BTE/stack/l2cap/l2c_int.h index 609c8251e..b34caef2a 100644 --- a/include/revolution/BTE/stack/l2cap/l2c_int.h +++ b/include/revolution/BTE/stack/l2cap/l2c_int.h @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Removed l2c_fcr functionality for RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation @@ -151,6 +161,7 @@ typedef enum #define L2CAP_MAX_FCR_CFG_TRIES 2 /* Config attempts before disconnecting */ +#ifndef REVOLUTION /* Only compiled in when in test mode. Production devices must not include */ #if L2CAP_CORRUPT_ERTM_PKTS == TRUE @@ -239,7 +250,7 @@ typedef struct #endif } tL2C_FCRB; - +#endif // REVOLUTION /* Define a registration control block. Every application (e.g. RFCOMM, SDP, ** TCS etc) that registers with L2CAP is assigned one of these. @@ -315,9 +326,11 @@ typedef struct t_l2c_ccb BOOLEAN cong_sent; /* Set when congested status sent */ UINT16 buff_quota; /* Buffer quota before sending congestion */ +#ifndef REVOLUTION tL2CAP_CHNL_PRIORITY ccb_priority; /* Channel priority */ tL2CAP_CHNL_DATA_RATE tx_data_rate; /* Channel Tx data rate */ tL2CAP_CHNL_DATA_RATE rx_data_rate; /* Channel Rx data rate */ +#endif /* Fields used for eL2CAP */ tL2CAP_ERTM_INFO ertm_info; @@ -702,7 +715,9 @@ extern void l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hc extern void l2c_link_sec_comp (BD_ADDR p_bda, void *p_ref_data, UINT8 status); extern void l2c_link_segments_xmitted (BT_HDR *p_msg); extern void l2c_pin_code_request (BD_ADDR bd_addr); +#ifndef REVOLUTION extern void l2c_link_adjust_chnl_allocation (void); +#endif #if (BLE_INCLUDED == TRUE) extern void l2c_link_processs_ble_num_bufs (UINT16 num_lm_acl_bufs); @@ -730,7 +745,7 @@ L2C_API extern BOOLEAN l2cap_link_chk_pkt_end (void); /* Called at end L2C_API extern void l2c_enqueue_peer_data (tL2C_CCB *p_ccb, BT_HDR *p_buf); - +#ifndef REVOLUTION /* Functions provided by l2c_fcr.c ************************************ */ @@ -752,6 +767,7 @@ extern BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg extern UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg); extern void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb); extern void l2c_fcr_stop_timer (tL2C_CCB *p_ccb); +#endif /* Functions provided by l2c_ble.c ************************************ diff --git a/src/Pack/RPGraphics/RPGrpCpuTexture.cpp b/src/Pack/RPGraphics/RPGrpCpuTexture.cpp new file mode 100644 index 000000000..721063bf3 --- /dev/null +++ b/src/Pack/RPGraphics/RPGrpCpuTexture.cpp @@ -0,0 +1,228 @@ +#include + +RPGrpCpuTexture::RPGrpCpuTexture() + : mFlags(NULL), + mWrapT(GX_CLAMP), + mWrapS(GX_CLAMP), + mMagFilter(GX_LINEAR), + mMinFilter(GX_LINEAR) {} + +void blendColor(GXColor* pColor, const GXColor& c1, const GXColor& c2, + f32 scale) { + + if (scale <= 0.0f) { + *pColor = c1; + } else if (scale >= 1.0f) { + *pColor = c2; + } else { + pColor->r = c1.r + scale * (c2.r - c1.r); + pColor->g = c1.g + scale * (c2.g - c1.g); + pColor->b = c1.b + scale * (c2.b - c1.b); + pColor->a = c1.a + scale * (c2.a - c1.a); + } +} + +void makeGradationTable(RPGrpCpuTexture::EGradationKind kind, GXColor* pTable, + u16 tableSize, u16 tableStart, u16 tableGoal, + const GXColor& c1, const GXColor& c2) { + + for (int i = 0; i < tableStart + 1; i++) { + pTable[i] = c1; + } + + for (int i = tableGoal - 1; i < tableSize; i++) { + pTable[i] = c2; + } + + for (int i = tableStart + 1; i < tableGoal - 1; i++) { + f32 scale = static_cast(i - tableStart) / + static_cast(tableGoal - tableStart); + + switch (kind) { + case RPGrpCpuTexture::GRADATION_LINEAR: { + break; + } + + case RPGrpCpuTexture::GRADATION_QUADRATIC: { + scale *= scale; + break; + } + + case RPGrpCpuTexture::GRADATION_CUBIC: { + scale *= scale; + scale *= scale; + break; + } + + case RPGrpCpuTexture::GRADATION_QUARTIC: { + scale *= scale; + scale *= scale; + scale *= scale; + break; + } + + case RPGrpCpuTexture::GRADATION_QUINTIC: { + scale *= scale; + scale *= scale; + scale *= scale; + scale *= scale; + break; + } + + case RPGrpCpuTexture::GRADATION_QUADRATIC_EASEOUT: { + f32 minusOne = scale - 1.0f; + scale = -minusOne * minusOne + 1.0f; + break; + } + + case RPGrpCpuTexture::GRADATION_QUARTIC_EASEOUT: { + f32 minusOne = scale - 1.0f; + scale = -minusOne * minusOne * minusOne * minusOne + 1.0f; + break; + } + } + + blendColor(&pTable[i], c1, c2, scale); + } +} + +void RPGrpCpuTexture::configure() { + mFlags = cFlag_Configured; +} + +void RPGrpCpuTexture::getTexObj(GXTexObj* pObj) const { + GXInitTexObj(pObj, getBuffer(), getWidth(), getHeight(), getFormat(), + getWrapS(), getWrapT(), GX_FALSE); + + GXInitTexObjLOD(pObj, getMinFilter(), getMagFilter(), 0.0f, 0.0f, 0.0f, + GX_FALSE, GX_FALSE, GX_ANISO_1); +} + +void RPGrpCpuTexture::load(GXTexMapID map) { + GXTexObj obj; + getTexObj(&obj); + + GXLoadTexObj(&obj, map); +} + +void RPGrpCpuTexture::invalidate() const { + DCInvalidateRange(mpBuffer, getTexBufferSize()); +} + +void RPGrpCpuTexture::flush() const { + DCFlushRange(mpBuffer, getTexBufferSize()); +} + +u32 RPGrpCpuTexture::getTexBufferSize() const { + return GXGetTexBufferSize(getWidth(), getHeight(), getFormat(), GX_FALSE, + 1); +} + +void RPGrpCpuTexture::initResTIMG() const { + RPGrpResTIMG* pHeader = getHeader(); + + pHeader->format = getFormat(); + pHeader->transparency = RPGrpResTIMG::JUT_TRANSPARENCY_DISABLE; + pHeader->width = getWidth(); + pHeader->height = getHeight(); + pHeader->wrapS = getWrapS(); + pHeader->wrapT = getWrapT(); + pHeader->tlutName = GX_TLUT0; + pHeader->tlutFormat = GX_TL_IA8; + pHeader->paletteEntryNum = 0; + pHeader->paletteOffset = 0; + pHeader->mipMap = GX_FALSE; + pHeader->edgeLODEnable = GX_FALSE; + pHeader->biasClampEnable = GX_FALSE; + pHeader->anisotropy = GX_ANISO_1; + pHeader->minFilter = getMinFilter(); + pHeader->magFilter = getMagFilter(); + pHeader->minLOD = 0; + pHeader->maxLOD = 0; + pHeader->mipMapLevel = 1; + pHeader->LODBias = 0; + pHeader->imageOffset = sizeof(RPGrpResTIMG); +} + +void RPGrpCpuTexture::fillGradationTable(EGradationKind kind, int dir, + u16 tableStart, u16 tableGoal, + const GXColor& c1, const GXColor& c2, + bool wrap, bool setAll) { + + bool isSLine = dir == 's' || dir == 'S'; + + u16 tableSize = isSLine ? getWidth() : getHeight(); + + u16 tableHeight = isSLine ? getHeight() : getWidth(); + u16 tableMid = tableSize / 2; + + GXColor table[1024]; + makeGradationTable(kind, table, tableSize, tableStart, tableGoal, c1, c2); + + if (wrap) { + GXColor colors[256]; + + for (int i = 0; i < tableSize; i++) { + colors[i] = table[i < tableMid ? i + tableMid : i - tableMid]; + } + + for (int i = 0; i < tableSize; i++) { + table[i] = colors[i]; + } + } + + u16 setStart = setAll ? 0 : tableStart; + u16 setGoal = setAll ? tableSize : tableGoal; + + for (u16 x = setStart; x < setGoal; x++) { + for (u16 y = 0; y < tableHeight; y++) { + setColor(y, x, table[x]); + } + } + flush(); +} + +void RPGrpCpuTexture::alloc() { + u8* pBuffer = new (32) u8[getTexBufferSize()]; + setBuffer(pBuffer); +} + +void RPGrpCpuTexture::allocWithHeaderDebug() { + + u8* pBuffer = new (32) u8[getTexBufferSize() + sizeof(RPGrpResTIMG)]; + + setBuffer(pBuffer + sizeof(RPGrpResTIMG)); + setFlag(cFlag_HasHeader); + initResTIMG(); +} + +void RPGrpCpuTexture::setColor(u16 x, u16 y, GXColor color) { + switch (getFormat()) { + case GX_TF_RGBA8: { + int offset = ((x >> 2) + (y >> 2) * (getWidth() / 4)) * 0x40 + // block + (y & 3) * 8 + (x & 3) * 2; // pixel + + u8* pData = static_cast(getBuffer()) + offset; + + pData[0] = color.a; + pData[1] = color.r; + pData[32] = color.g; + pData[33] = color.b; + break; + } + + case GX_TF_I8: { + int offset = (x & 0x7) + (y & 0x3) * 8; // pixel + offset += ((x >> 3) + ((y >> 2) * (getWidth() / 8))) * 32; // block + + u8* pData = static_cast(getBuffer()) + offset; + + pData[0] = color.r; + break; + } + + default: { + break; + } + } +} diff --git a/src/Pack/RPGraphics/RPGrpModel.cpp b/src/Pack/RPGraphics/RPGrpModel.cpp index e05b51c4c..c773d02a4 100644 --- a/src/Pack/RPGraphics/RPGrpModel.cpp +++ b/src/Pack/RPGraphics/RPGrpModel.cpp @@ -19,11 +19,13 @@ const nw4r::math::_VEC3 RPGrpModel::GEOMETRY_MAGNIFY[/* ??? */] = { {0.0f, 0.0f, 0.0f}, }; +#ifdef VERSION_RSPE01_01 RPGrpModel* RPGrpModel::Construct(RPGrpHandle handle, u8 viewNo, u32 typeOption, u32 bufferOption) { RPGrpModel* p = NULL; switch (RPGrpModelResManager::GetCurrent()->GetType(handle)) { + case RPGrpModelResManager::Type_ResMdl: { p = new RPGrpModelG3D(handle, viewNo, typeOption, bufferOption); break; @@ -59,8 +61,39 @@ RPGrpModel* RPGrpModel::Construct(RPGrpHandle handle, const char* pName, p->CreateAnm(); return p; } +#endif RPGrpModel::RPGrpModel(u8 viewNo) +#if defined(VERSION_RSPE01_00) + : unk0(0), + unk1(0), + mFlags(1), + unk4(0), + unkFlag(0), + mpEntryNext(NULL), + mpGenNext(NULL), + mBaseScale(1.0f, 1.0f, 1.0f), + mpModelAnm(NULL), + mppMaterials(NULL), + mpBoundingInfo(NULL), + mpRecord(NULL), + mReverseCulling(FALSE), + mpCallback(NULL), + mDrawGroup(8), + mDrawScene(8), + mViewNo(viewNo), + unk6C(NULL) { + + mpGenNext = spGenList; + spGenList = this; + nw4r::math::MTX34Identity(&mtx14); + //! @bug only in rev 0: mBaseScale was already initialized + mBaseScale.z = 1.0f; + mBaseScale.y = 1.0f; + mBaseScale.x = 1.0f; +} + +#elif defined(VERSION_RSPE01_01) : mViewNo(viewNo), mDrawScene(0), mDrawGroup(0), @@ -68,7 +101,7 @@ RPGrpModel::RPGrpModel(u8 viewNo) unk4(8), mFlags(EFlag_Visible), unkA(0), - unkC(0), + unkFlag(0), unk10(0), mpEntryNext(NULL), mpGenNext(NULL), @@ -84,6 +117,7 @@ RPGrpModel::RPGrpModel(u8 viewNo) mpGenNext = spGenList; spGenList = this; } +#endif RPGrpModel::~RPGrpModel() {} @@ -147,10 +181,12 @@ void RPGrpModel::UpdateFrame() { mpModelAnm->UpdateFrame(); } +#if defined(VERSION_RSPE01_01) nw4r::g3d::ScnObj* pScnObj = GetScnObj(); if (pScnObj != NULL) { pScnObj->G3dProc(nw4r::g3d::G3dObj::G3DPROC_UPDATEFRAME, 0, NULL); } +#endif } void RPGrpModel::Calc() { @@ -180,15 +216,19 @@ void RPGrpModel::Entry() { mFlags |= EFlag_Entered; } +//! TODO(texline) vtable is different in rev 0 +//! (offset should be 0x4c there, but is 0x5c) void RPGrpModel::CalcMaterial() { for (int i = 0; i < GetMaterialNum(); i++) { mppMaterials[i]->Calc(); } } +#if defined(VERSION_RSPE01_01) u16 RPGrpModel::GetMaterialNum() const { return mpModelEx->getNumMaterial(); } +#endif void RPGrpModel::SetReverseCulling(bool reverse) { if (reverse == mReverseCulling) { @@ -211,6 +251,7 @@ void RPGrpModel::SetReverseCulling(bool reverse) { mReverseCulling = reverse; } +#if defined(VERSION_RSPE01_01) u16 RPGrpModel::ReplaceTexture(const char* pName, const RPGrpTexture& rTexture, bool keepFilterWrap) { @@ -218,6 +259,7 @@ u16 RPGrpModel::ReplaceTexture(const char* pName, const RPGrpTexture& rTexture, return mpModelEx->replaceTexture(pName, texObj, keepFilterWrap, NULL, 0, true); } +#endif void RPGrpModel::RemoveGenList() { RPGrpModel* pIt = spGenList; diff --git a/src/Pack/RPGraphics/RPGrpModelImplement.cpp b/src/Pack/RPGraphics/RPGrpModelImplement.cpp index dbe2b5af3..3d7cbfa46 100644 --- a/src/Pack/RPGraphics/RPGrpModelImplement.cpp +++ b/src/Pack/RPGraphics/RPGrpModelImplement.cpp @@ -21,7 +21,9 @@ RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, u8 viewNo, u32 typeOption, bufferOption, viewNo); } +#if defined(VERSION_RSPE01_01) mpModelEx = new EGG::ModelEx(pScnObj); +#endif } RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, int idx, u8 viewNo, @@ -45,7 +47,9 @@ RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, int idx, u8 viewNo, bufferOption, viewNo); } +#if defined(VERSION_RSPE01_01) mpModelEx = new EGG::ModelEx(pScnObj); +#endif } RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, const char* pName, u8 viewNo, @@ -69,9 +73,12 @@ RPGrpModelG3D::RPGrpModelG3D(RPGrpHandle handle, const char* pName, u8 viewNo, bufferOption, viewNo); } +#if defined(VERSION_RSPE01_01) mpModelEx = new EGG::ModelEx(pScnObj); +#endif } +#ifdef VERSION_RSPE01_01 void RPGrpModelG3D::Configure() { RPGrpModel::Configure(); @@ -90,12 +97,13 @@ void RPGrpModelG3D::Configure() { void RPGrpModelG3D::CreateAnm() { mpModelAnm = RPGrpModelAnmG3D::Construct(this); } +#endif IRPGrpModelCallback* RPGrpModelG3D::SetCallback(IRPGrpModelCallback* pCallback) { IRPGrpModelCallback* pOldCallback = mpCallback; mpCallback = pCallback; - +#if defined(VERSION_RSPE01_01) if (pCallback == NULL) { GetScnMdlSimple()->DisableScnMdlCallbackTiming( nw4r::g3d::ScnObj::CALLBACK_TIMING_ALL); @@ -103,10 +111,12 @@ RPGrpModelG3D::SetCallback(IRPGrpModelCallback* pCallback) { GetScnMdlSimple()->EnableScnMdlCallbackTiming( nw4r::g3d::ScnObj::CALLBACK_TIMING_ALL); } +#endif return pOldCallback; } +#if defined(VERSION_RSPE01_01) void RPGrpModelG3D::InternalCalc() { if (!mReverseCulling) { if (GetScnLeaf() != NULL) { @@ -164,6 +174,7 @@ bool RPGrpModelG3D::IsJointVisible(u32 idx) const { return GetScnMdlSimple()->GetResMdl().GetResNode(idx).IsVisible(); } } +#endif void RPGrpModelG3D::ExecCallback_CALC_WORLD( nw4r::g3d::ScnObj::Timing /* timing */, nw4r::g3d::ScnObj* /* pObj */, @@ -173,7 +184,7 @@ void RPGrpModelG3D::ExecCallback_CALC_MAT(nw4r::g3d::ScnObj::Timing timing, nw4r::g3d::ScnObj* /* pObj */, u32 /* param */, void* /* pInfo */) { - if (!(unkC & 0x40)) { + if (!(unkFlag & 0x40)) { if (timing & nw4r::g3d::ScnObj::CALLBACK_TIMING_A) { CalcMaterial(); } diff --git a/src/Pack/RPGraphics/RPGrpModelResManager.cpp b/src/Pack/RPGraphics/RPGrpModelResManager.cpp index e20fe86bf..316d17984 100644 --- a/src/Pack/RPGraphics/RPGrpModelResManager.cpp +++ b/src/Pack/RPGraphics/RPGrpModelResManager.cpp @@ -167,7 +167,7 @@ void* RPGrpModelResManager::GetPtr(Type type, RPGrpHandle handle, } case Type_ResAnmScn: { - return mpResList[handle].pResFile->Get().GetResAnmShp(pName).ptr(); + return mpResList[handle].pResFile->Get().GetResAnmScn(pName).ptr(); } default: { @@ -223,7 +223,7 @@ void* RPGrpModelResManager::GetPtr(Type type, RPGrpHandle handle, } case Type_ResAnmScn: { - return mpResList[handle].pResFile->Get().GetResAnmShp(index).ptr(); + return mpResList[handle].pResFile->Get().GetResAnmScn(index).ptr(); } default: { @@ -404,7 +404,7 @@ bool RPGrpModelResManager::HasFile(Type type, RPGrpHandle handle, } case Type_ResAnmScn: { - return mpResList[handle].pResFile->Get().GetResAnmShp(pName).IsValid(); + return mpResList[handle].pResFile->Get().GetResAnmScn(pName).IsValid(); } default: { diff --git a/src/Pack/RPGraphics/RPGrpModelRfl.cpp b/src/Pack/RPGraphics/RPGrpModelRfl.cpp index 7111faac3..235ff9920 100644 --- a/src/Pack/RPGraphics/RPGrpModelRfl.cpp +++ b/src/Pack/RPGraphics/RPGrpModelRfl.cpp @@ -21,6 +21,7 @@ nw4r::math::MTX34 RPGrpModelRfl::lbl_804A4608( ); // clang-format on +#if defined(VERSION_RSPE01_01) RPGrpModelRfl* RPGrpModelRfl::Construct(RFLDataSource src, u16 index, RFLMiddleDB* pMiddleDB, RFLResolution resolution, u32 exprFlags, @@ -50,6 +51,7 @@ RPGrpModelRfl* RPGrpModelRfl::Construct(RFLDataSource src, u16 index, return p; } +#endif RPGrpModelRfl::RPGrpModelRfl(RFLResolution resolution, u32 exprFlags, u8 viewNo) : RPGrpModel(viewNo), @@ -66,7 +68,9 @@ RPGrpModelRfl::RPGrpModelRfl(RFLResolution resolution, u32 exprFlags, u8 viewNo) *static_cast(pScnRfl->GetUserData()) = this; +#if defined(VERSION_RSPE01_01) mpModelEx = new EGG::ModelEx(pScnRfl); +#endif } void RPGrpModelRfl::Configure() { @@ -82,9 +86,11 @@ void RPGrpModelRfl::Configure() { sDrawCoreSetting.posNrmMtxID = GX_PNMTX0; sDrawCoreSetting.reverseCulling = false; +#if defined(VERSION_RSPE01_01) GetScnRfl()->SetLightSetIdx(LIGHT_SET_IDX); GetScnRfl()->SetFogIdx(FOG_IDX); GetScnRfl()->SetAmbientColor((GXColor){255, 255, 255, 255}); +#endif mBrightnessColor = (GXColor){255, 255, 255, 255}; InternalCalc(); @@ -108,6 +114,7 @@ u16 RPGrpModelRfl::ReplaceTexture(const char* pName, return 1; } +#if defined(VERSION_RSPE01_01) void RPGrpModelRfl::InternalCalc() { if (!mReverseCulling) { nw4r::math::VEC3 scale(mBaseScale.x * sBaseScale, @@ -148,7 +155,9 @@ void RPGrpModelRfl::InternalCalc() { spCalcWorldMtxArray = NULL; } } +#endif +#if defined(VERSION_RSPE01_01) void RPGrpModelRfl::CalcBeforeDraw() { RPGrpModel::CalcBeforeDraw(); @@ -159,6 +168,7 @@ void RPGrpModelRfl::CalcBeforeDraw() { mFlagsRfl &= ~0x200; } } +#endif void RPGrpModelRfl::DrawProc(nw4r::g3d::ScnRfl* pScnRfl, const RFLCharModel* pModel, u32 diffMask, @@ -188,7 +198,7 @@ void RPGrpModelRfl::DrawGX(const RFLCharModel* pModel, u32 diffMask, bool useMat = !(EGG::ModelEx::getDrawFlag() & EGG::ModelEx::cDrawFlag_IgnoreMaterial); - bool bVar3 = ((unkC & 0x20) || (mFlagsRfl & 0x8)) && mDrawGroup == 1; + bool bVar3 = ((unkFlag & 0x20) || (mFlagsRfl & 0x8)) && mDrawGroup == 1; bool bVar2 = !(mFlagsRfl & 0x400) || mDrawGroup == 1; bool bVar3_2 = opa && (mFlagsRfl & 0x40); @@ -252,7 +262,9 @@ void RPGrpModelRfl::DrawGX(const RFLCharModel* pModel, u32 diffMask, } nw4r::math::MTX34 viewMtx; +#if defined(VERSION_RSPE01_01) GetScnRfl()->GetMtx(nw4r::g3d::ScnObj::MTX_VIEW, &viewMtx); +#endif viewMtx._03 = viewMtx._13 = viewMtx._23 = 0.0f; GXLoadTexMtxImm(viewMtx, GX_TEXMTX0, GX_MTX_3x4); @@ -407,6 +419,7 @@ void RPGrpModelRfl::DrawGX(const RFLCharModel* pModel, u32 diffMask, } } +#if defined(VERSION_RSPE01_01) const char* RPGrpModelRfl::GetJointName(u16 /* idx */) const { static const char JOINT_NAME[] = "dummy"; return JOINT_NAME; @@ -421,3 +434,4 @@ const char* RPGrpModelRfl::GetShapeName(u16 /* idx */) const { static const char SHAPE_NAME[] = "dummy"; return SHAPE_NAME; } +#endif diff --git a/src/Pack/RPGraphics/RPGrpModelScene.cpp b/src/Pack/RPGraphics/RPGrpModelScene.cpp new file mode 100644 index 000000000..34a54f820 --- /dev/null +++ b/src/Pack/RPGraphics/RPGrpModelScene.cpp @@ -0,0 +1,21 @@ +#include + +RPGrpModelScene::~RPGrpModelScene() {} + +void RPGrpModelScene::CalcView() { + mpScnRootEx->UpdateFrame(); + mpScnRootEx->CalcWorld(); +} + +void RPGrpModelScene::g_calc_background() { + mIdx = 0; + mpScnRootEx->CalcVtx(); + mpScnRootEx->CalcMaterial(); +} + +void RPGrpModelScene::setupGX() const { + mpScnRootEx->getScreen().SetProjectionGX(); + mpLightManager->SetChanAmbColor(); + mpLightManager->LoadObjIndxGX(); + mpFogManager->GetFog(0)->SetGX(); +} diff --git a/src/Pack/RPGraphics/RPGrpRenderer.cpp b/src/Pack/RPGraphics/RPGrpRenderer.cpp new file mode 100644 index 000000000..9a1aaa500 --- /dev/null +++ b/src/Pack/RPGraphics/RPGrpRenderer.cpp @@ -0,0 +1,53 @@ +#include +#include + +static bool renderState; + +void RPGrpRenderer::Begin() { + f32 modify; + + sRendering = FALSE; + sRenderPass = RENDERPASS_BEGIN; + spCurrentScreen = &RPGrpScreen::GetRootScreen(); + EGG::GfxEngine::beginDraw(); + modify = RP_GET_INSTANCE(RPSysSystem)->getModifyRatio(); + EGG::StateGX::setModifyRatio(modify); +} + +void RPGrpRenderer::StartDebugDraw() { + EGG::Matrix34f mtx; + + RPGrpScreen clone(RPGrpScreen::GetRootScreen()); + clone.SetNearZ(0.0f); + clone.SetFarZ(1.0f); + clone.SetProjectionType(EGG::Frustum::PROJ_ORTHO); + clone.SetProjectionGX(); + + nw4r::math::MTX34Identity(&mtx); + GXLoadPosMtxImm(mtx, GX_PNMTX0); + GXLoadNrmMtxImm(mtx, GX_PNMTX0); +} + +void RPGrpRenderer::End() { + sRenderPass = RENDERPASS_END; +} + +RPGrpViewRender3D* RPGrpRenderer::CreateView3D(u8 viewNo, RPGrpCamera* camera, + RPGrpScreen* screen) { + RPGrpViewRender3D* render = new RPGrpViewRender3D(viewNo); + + render->Configure(); + render->AttachCamera(camera); + render->AttachScreen(screen); + + return render; +} + +void RPGrpRenderer::AppendDrawObject(IRPGrpDrawObject* pObject) { + if (pObject) { + mpDrawObj = pObject; + } else { + mpDrawObj = pObject; + mpDrawList = pObject; + } +} diff --git a/src/Pack/RPKernel/RPSysKokeshiIcon.cpp b/src/Pack/RPKernel/RPSysKokeshiIcon.cpp index ab703d688..443e7eedb 100644 --- a/src/Pack/RPKernel/RPSysKokeshiIcon.cpp +++ b/src/Pack/RPKernel/RPSysKokeshiIcon.cpp @@ -234,6 +234,7 @@ void RPSysKokeshiIcon::MakeTexture(RPGrpModel* pModel, BeginMakeTexture(); { pScnRoot->Clear(); +#if defined(VERSION_RSPE01_01) nw4r::g3d::ScnObj* pScnObj = NULL; if (pModel->GetKind() == RPGrpModel::Kind_RFL) { @@ -243,6 +244,7 @@ void RPSysKokeshiIcon::MakeTexture(RPGrpModel* pModel, } pScnRoot->PushBack(pScnObj); +#endif pScnRoot->CalcWorld(); pScnRoot->CalcMaterial(); diff --git a/src/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.cpp b/src/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.cpp new file mode 100644 index 000000000..da5d6893b --- /dev/null +++ b/src/Pack/RPSports/RPSportsCommon/RPSportsMenuBgModel.cpp @@ -0,0 +1,108 @@ +#include + +#include + +RPSportsMenuBgModel::~RPSportsMenuBgModel() {} + +RPSportsMenuBgModel::RPSportsMenuBgModel(u8 viewNo, u8 drawScene, u16 flags) + : mViewNo(viewNo), mDrawScene(drawScene), mFlags(flags), mpModel(NULL) { + RPGrpScreen* screen; + + mpCamera = new RPGrpCamera; + mpCamera->SetCameraType(RPGrpCamera::ECameraType_LookAt); + screen = new RPGrpScreen; + screen->SetCanvasMode(EGG::Frustum::CANVAS_CC); + screen->SetFovy(30.0f); + RPGrpRenderer::GetCurrent()->CreateView3D(viewNo, mpCamera, screen); +} + +void RPSportsMenuBgModel::createData(EGG::Archive* modelArchive) { + void* modelFile; + RPGrpHandle resFileHandle; + void* resModelPtr; + RPGrpHandle resModelHandle; + void* resAnmChrPtr; + void* resAnmTexSrtPtr; + void* resAnmClrPtr; + +#define RP_CREATE_MDL_DATA(type, data) \ + RPGrpModelResManager::GetCurrent()->CreateData(type, data); +#define RP_GET_MDL_PTR(type) \ + RPGrpModelResManager::GetCurrent()->GetPtr(type, resFileHandle, \ + "menu_BG_model"); + + if (modelArchive == NULL) { + modelArchive = + RP_GET_INSTANCE(RPSysResourceManager)->LoadGameCommonArchive(); + } + modelFile = + RP_GET_INSTANCE(RPSysResourceManager) + ->GetFileFromArchive(modelArchive, "G3D/menu_BG_model.brres"); + resFileHandle = + RP_CREATE_MDL_DATA(RPGrpModelResManager::Type_ResFile, modelFile); + + resModelPtr = RP_GET_MDL_PTR(RPGrpModelResManager::Type_ResFile); + resModelHandle = + RP_CREATE_MDL_DATA(RPGrpModelResManager::Type_ResMdl, resModelPtr); + + resAnmChrPtr = RP_GET_MDL_PTR(RPGrpModelResManager::Type_ResAnmChr); + RP_CREATE_MDL_DATA(RPGrpModelResManager::Type_ResAnmChr, resAnmChrPtr); + + resAnmTexSrtPtr = RP_GET_MDL_PTR(RPGrpModelResManager::Type_ResAnmTexSrt); + RP_CREATE_MDL_DATA(RPGrpModelResManager::Type_ResAnmTexSrt, + resAnmTexSrtPtr); + + resAnmClrPtr = RP_GET_MDL_PTR(RPGrpModelResManager::Type_ResAnmClr); + RP_CREATE_MDL_DATA(RPGrpModelResManager::Type_ResAnmClr, resAnmClrPtr); + + mpModel = RPGrpModel::Construct(resModelHandle, 1, 0, 0); + + mpModel->GetModelAnm()->CreateBuffer(RPGrpModelAnm::Anm_Chr, 1); + mpModel->GetModelAnm()->CreateBuffer(RPGrpModelAnm::Anm_TexSrt, 1); + mpModel->GetModelAnm()->CreateBuffer(RPGrpModelAnm::Anm_Clr, 1); + mpModel->GetModelAnm()->Regist(RPGrpModelAnm::Anm_Chr, 0, 0); + mpModel->GetModelAnm()->Regist(RPGrpModelAnm::Anm_TexSrt, 0, 0); + mpModel->GetModelAnm()->Regist(RPGrpModelAnm::Anm_Clr, 0, 0); + mpModel->SetDrawScene(mDrawScene); +} + +void RPSportsMenuBgModel::initCamera() { + nw4r::math::VEC3 camPos(0.0f, 0.0f, 65.0f); + mpCamera->SetPosition(camPos); + mEyeView.x = 0.0f; + mEyeView.y = 0.0f; + mEyeView.z = 0.0f; + mBaseScale.x = 1.0f; + mBaseScale.y = 1.0f; + mBaseScale.z = 1.0f; + + mpModel->GetModelAnm()->Start(RPGrpModelAnm::Anm_Chr, 0); + mpModel->GetModelAnm()->Start(RPGrpModelAnm::Anm_TexSrt, 0); + mpModel->GetModelAnm()->Start(RPGrpModelAnm::Anm_Clr, 0); + mpModel->GetModelAnm()->SetFrame(RPGrpModelAnm::Anm_Clr, (f32)0, 0.0f); + mpModel->GetModelAnm()->SetUpdateRate(RPGrpModelAnm::Anm_Clr, 0, 0.0f); +} + +void RPSportsMenuBgModel::calcView() { + EGG::Matrix34f billboard; + + mpCamera->CalcMatrix(); + billboard.makeIdentity(); + + billboard._03 = mEyeView.x; + billboard._13 = mEyeView.y; + billboard._23 = mEyeView.z; + +#if defined(VERSION_RSPE01_00) + nw4r::math::MTX34Copy(mpModel->GetMtxPtr(), &billboard); +#elif defined(VERSION_RSPE01_01) + nw4r::g3d::ScnObj* scnObj = mpModel->GetModelEx()->getScnObj(); + if (scnObj) { + scnObj->SetMtx(nw4r::g3d::ScnObj::MTX_LOCAL, &billboard); + } +#endif + mpModel->SetBaseScale(mBaseScale); + mpModel->UpdateFrame(); + mpModel->Calc(); + mpModel->Entry(); +} diff --git a/src/egg/gfxe/eggLightManager.cpp b/src/egg/gfxe/eggLightManager.cpp new file mode 100644 index 000000000..0f879bbb0 --- /dev/null +++ b/src/egg/gfxe/eggLightManager.cpp @@ -0,0 +1,10 @@ +#include + +namespace EGG { +void LightManager::SetChanAmbColor() const { + GXColor localColor = *m_pAmbColor0; + + GXSetChanAmbColor(GX_COLOR0A0, localColor); + GXSetChanAmbColor(GX_COLOR1A1, DrawGX::BLACK); +} +} // namespace EGG diff --git a/src/egg/gfxe/eggLightObject.cpp b/src/egg/gfxe/eggLightObject.cpp new file mode 100644 index 000000000..dce799f9b --- /dev/null +++ b/src/egg/gfxe/eggLightObject.cpp @@ -0,0 +1,63 @@ +#include + +namespace EGG { + +void LightObject::Calc() { + mLightVector = mDir; + + mLightColor.a = mBrightnessColor.a; +} + +void LightObject::CalcView(const nw4r::math::MTX34& cameraMTX) { + nw4r::math::VEC3 camVec; + nw4r::math::VEC3 sumVec; + + if (mLightType == cLightType_Dir) { + camVec.z = -cameraMTX._22; + camVec.x = -cameraMTX._20; + camVec.y = -cameraMTX._21; + + if (nw4r::math::VEC3Len(&camVec) > 0.0f) { + C_VECHalfAngle(mDir, camVec, sumVec); + PSVECScale(sumVec, mLightVector, -1.0f); + } else { + mLightVector.y = 0.0f; + mLightVector.x = 0.0f; + mLightVector.z = 1.0f; + } + } +} + +void LightObject::InitGX(GXLightObj* pObj) const { +#line 281 + EGG_ASSERT(pObj); + if ((mFlags & 1) && (mFlags & 64)) { + GXInitLightColor(pObj, mLightColor); + //! TODO(texline) Variables are incomplete + } +} + +void LightObject::CalcDirDist() { + mDir.x = mAt.x - mPos.x; + mDir.y = mAt.y - mPos.y; + mDir.z = mAt.z - mPos.z; + + mDistance = nw4r::math::VEC3Len(&mDir); + if (mDistance > 0.0f) { + mDir /= mDistance; + } else { + mDir.z = 0.0f; + mDir.y = 0.0f; + mDir.x = 0.0f; + } +} + +void LightObject::CalcAt() { + //! Calculating all variables at once leads to (non-matching) paired singles + //! operations + mAt.x = (mDir.x * mDistance) + mPos.x; + mAt.y = (mDir.y * mDistance) + mPos.y; + mAt.z = (mDir.z * mDistance) + mPos.z; +} + +} // namespace EGG diff --git a/src/revolution/BTE/bta/ar/bta_ar.c b/src/revolution/BTE/bta/ar/bta_ar.c deleted file mode 100644 index 89b732ab8..000000000 --- a/src/revolution/BTE/bta/ar/bta_ar.c +++ /dev/null @@ -1,348 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2008-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This is the implementation for the audio/video registration module. - * - ******************************************************************************/ - -#include -#include "bta_ar_api.h" -#include "bta_ar_int.h" - - -/* AV control block */ -#if BTA_DYNAMIC_MEMORY == FALSE -tBTA_AR_CB bta_ar_cb; -#endif - -/******************************************************************************* -** -** Function bta_ar_id -** -** Description This function maps sys_id to ar id mask. -** -** Returns void -** -*******************************************************************************/ -static UINT8 bta_ar_id(tBTA_SYS_ID sys_id) -{ - UINT8 mask = 0; - if (sys_id == BTA_ID_AV) - { - mask = BTA_AR_AV_MASK; - } - else if (sys_id == BTA_ID_AVK) - { - mask = BTA_AR_AVK_MASK; - } - - return mask; -} - -/******************************************************************************* -** -** Function bta_ar_init -** -** Description This function is called to register to AVDTP. -** -** Returns void -** -*******************************************************************************/ -void bta_ar_init(void) -{ - /* initialize control block */ - memset(&bta_ar_cb, 0, sizeof(tBTA_AR_CB)); -} - -/******************************************************************************* -** -** Function bta_ar_reg_avdt -** -** Description This function is called to register to AVDTP. -** -** Returns void -** -*******************************************************************************/ -static void bta_ar_avdt_cback(UINT8 handle, BD_ADDR bd_addr, UINT8 event, tAVDT_CTRL *p_data) -{ - /* route the AVDT registration callback to av or avk */ - if (bta_ar_cb.p_av_conn_cback) - (*bta_ar_cb.p_av_conn_cback)(handle, bd_addr, event, p_data); - if (bta_ar_cb.p_avk_conn_cback) - (*bta_ar_cb.p_avk_conn_cback)(handle, bd_addr, event, p_data); -} - -/******************************************************************************* -** -** Function bta_ar_reg_avdt -** -** Description AR module registration to AVDT. -** -** Returns void -** -*******************************************************************************/ -void bta_ar_reg_avdt(tAVDT_REG *p_reg, tAVDT_CTRL_CBACK *p_cback, tBTA_SYS_ID sys_id) -{ - UINT8 mask = 0; - - if (sys_id == BTA_ID_AV) - { - bta_ar_cb.p_av_conn_cback = p_cback; - mask = BTA_AR_AV_MASK; - } - else if (sys_id == BTA_ID_AVK) - { - bta_ar_cb.p_avk_conn_cback = p_cback; - mask = BTA_AR_AVK_MASK; - } -#if (BTA_AR_DEBUG == TRUE) - else - { - APPL_TRACE_ERROR1("bta_ar_reg_avdt: the registration is from wrong sys_id:%d", sys_id); - } -#endif - - if (mask) - { - if (bta_ar_cb.avdt_registered == 0) - { - AVDT_Register(p_reg, bta_ar_avdt_cback); - } - bta_ar_cb.avdt_registered |= mask; - } -} - -/******************************************************************************* -** -** Function bta_ar_dereg_avdt -** -** Description This function is called to de-register from AVDTP. -** -** Returns void -** -*******************************************************************************/ -void bta_ar_dereg_avdt(tBTA_SYS_ID sys_id) -{ - UINT8 mask = 0; - - if (sys_id == BTA_ID_AV) - { - bta_ar_cb.p_av_conn_cback = NULL; - mask = BTA_AR_AV_MASK; - } - else if (sys_id == BTA_ID_AVK) - { - bta_ar_cb.p_avk_conn_cback = NULL; - mask = BTA_AR_AVK_MASK; - } - bta_ar_cb.avdt_registered &= ~mask; - - if (bta_ar_cb.avdt_registered == 0) - AVDT_Deregister(); -} - -/******************************************************************************* -** -** Function bta_ar_avdt_conn -** -** Description This function is called to let ar know that some AVDTP profile -** is connected for this sys_id. -** If the other sys modules started a timer for PENDING_EVT, -** the timer can be stopped now. -** -** Returns void -** -*******************************************************************************/ -void bta_ar_avdt_conn(tBTA_SYS_ID sys_id, BD_ADDR bd_addr) -{ - UINT8 event = BTA_AR_AVDT_CONN_EVT; - tAVDT_CTRL data; - - if (sys_id == BTA_ID_AV) - { - if (bta_ar_cb.p_avk_conn_cback) - { - (*bta_ar_cb.p_avk_conn_cback)(0, bd_addr, event, &data); - } - } - else if (sys_id == BTA_ID_AVK) - { - if (bta_ar_cb.p_av_conn_cback) - { - (*bta_ar_cb.p_av_conn_cback)(0, bd_addr, event, &data); - } - } -} - -/******************************************************************************* -** -** Function bta_ar_reg_avct -** -** Description This function is called to register to AVCTP. -** -** Returns void -** -*******************************************************************************/ -void bta_ar_reg_avct(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask, tBTA_SYS_ID sys_id) -{ - UINT8 mask = bta_ar_id (sys_id); - - if (mask) - { - if (bta_ar_cb.avct_registered == 0) - { - AVCT_Register(mtu, mtu_br, sec_mask); - } - bta_ar_cb.avct_registered |= mask; - } -} - -/******************************************************************************* -** -** Function bta_ar_dereg_avct -** -** Description This function is called to deregister from AVCTP. -** -** Returns void -** -*******************************************************************************/ -void bta_ar_dereg_avct(tBTA_SYS_ID sys_id) -{ - UINT8 mask = bta_ar_id (sys_id); - - bta_ar_cb.avct_registered &= ~mask; - - if (bta_ar_cb.avct_registered == 0) - AVCT_Deregister(); -} - -/****************************************************************************** -** -** Function bta_ar_reg_avrc -** -** Description This function is called to register an SDP record for AVRCP. -** -** Returns void -** -******************************************************************************/ -void bta_ar_reg_avrc(UINT16 service_uuid, char *service_name, char *provider_name, - UINT16 categories, tBTA_SYS_ID sys_id) -{ - UINT8 mask = bta_ar_id (sys_id); - UINT8 temp[8], *p; - - if (!mask || !categories) - return; - - if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET) - { - if (bta_ar_cb.sdp_tg_handle == 0) - { - bta_ar_cb.tg_registered = mask; - bta_ar_cb.sdp_tg_handle = SDP_CreateRecord(); - AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_tg_handle); -#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE) - bta_sys_add_uuid(service_uuid); -#endif - } - /* only one TG is allowed (first-come, first-served). - * If sdp_tg_handle is non-0, ignore this request */ - } - else if ((service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL) || (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_CONTROL)) - { - bta_ar_cb.ct_categories [mask - 1] = categories; - categories = bta_ar_cb.ct_categories[0]|bta_ar_cb.ct_categories[1]; - if (bta_ar_cb.sdp_ct_handle == 0) - { - bta_ar_cb.sdp_ct_handle = SDP_CreateRecord(); - AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_ct_handle); -#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE) - bta_sys_add_uuid(service_uuid); -#endif - } - else - { - /* multiple CTs are allowed. - * Change supported categories on the second one */ - p = temp; - UINT16_TO_BE_STREAM(p, categories); - SDP_AddAttribute(bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE, - (UINT32)2, (UINT8*)temp); - } - } -} - -/****************************************************************************** -** -** Function bta_ar_dereg_avrc -** -** Description This function is called to de-register/delete an SDP record for AVRCP. -** -** Returns void -** -******************************************************************************/ -void bta_ar_dereg_avrc(UINT16 service_uuid, tBTA_SYS_ID sys_id) -{ - UINT8 mask = bta_ar_id (sys_id); - UINT16 categories = 0; - UINT8 temp[8], *p; - - if (!mask) - return; - - if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET) - { - if (bta_ar_cb.sdp_tg_handle && mask == bta_ar_cb.tg_registered) - { - bta_ar_cb.tg_registered = 0; - SDP_DeleteRecord(bta_ar_cb.sdp_tg_handle); - bta_ar_cb.sdp_tg_handle = 0; -#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE) - bta_sys_remove_uuid(service_uuid); -#endif - } - } - else if (service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL) - { - if (bta_ar_cb.sdp_ct_handle) - { - bta_ar_cb.ct_categories [mask - 1] = 0; - categories = bta_ar_cb.ct_categories[0]|bta_ar_cb.ct_categories[1]; - if (!categories) - { - /* no CT is still registered - cleaup */ - SDP_DeleteRecord(bta_ar_cb.sdp_ct_handle); - bta_ar_cb.sdp_ct_handle = 0; -#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE) - bta_sys_remove_uuid(service_uuid); -#endif - } - else - { - /* change supported categories to the remaning one */ - p = temp; - UINT16_TO_BE_STREAM(p, categories); - SDP_AddAttribute(bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE, - (UINT32)2, (UINT8*)temp); - } - } - } - -} diff --git a/src/revolution/BTE/bta/av/bta_av_main.c b/src/revolution/BTE/bta/av/bta_av_main.c index 085362dd4..175060c2d 100644 --- a/src/revolution/BTE/bta/av/bta_av_main.c +++ b/src/revolution/BTE/bta/av/bta_av_main.c @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Removed AR functionality for RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 2004-2012 Broadcom Corporation @@ -506,9 +516,6 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) reg.sig_tout = BTA_AV_SIG_TOUT; reg.idle_tout = BTA_AV_IDLE_TOUT; reg.sec_mask = bta_av_cb.sec_mask; -#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE) - bta_ar_reg_avdt(®, bta_av_conn_cback, BTA_ID_AV); -#endif bta_sys_role_chg_register(&bta_av_sys_rs_cback); /* create remote control TG service if required */ diff --git a/src/revolution/BTE/gki/common/gki_buffer.c b/src/revolution/BTE/gki/common/gki_buffer.c index 506adefaa..9947d8813 100644 --- a/src/revolution/BTE/gki/common/gki_buffer.c +++ b/src/revolution/BTE/gki/common/gki_buffer.c @@ -5,6 +5,9 @@ * - Remove #include of log.h (external Android dependency) * - Modified gki_init_free_queue to match RVL version * - Modified GKI_enqueue to match RVL version + * + * 2026/09/24: + * - Defined out functions unused for RVL * * Compile with REVOLUTION defined to include these changes. * @@ -989,10 +992,12 @@ void *GKI_getfirst (BUFFER_Q *p_q) ** Returns NULL if queue is empty, else buffer address ** *******************************************************************************/ +#ifndef REVOLUTION void *GKI_getlast (BUFFER_Q *p_q) { return (p_q->p_last); } +#endif /******************************************************************************* ** @@ -1231,6 +1236,7 @@ void *GKI_igetpoolbuf (UINT8 pool_id) ** Returns the total number of buffers in the pool ** *******************************************************************************/ +#ifndef REVOLUTION UINT16 GKI_poolcount (UINT8 pool_id) { if (pool_id >= GKI_NUM_TOTAL_BUF_POOLS) @@ -1238,7 +1244,7 @@ UINT16 GKI_poolcount (UINT8 pool_id) return (gki_cb.com.freeq[pool_id].total); } - +#endif /******************************************************************************* ** ** Function GKI_poolfreecount @@ -1504,4 +1510,3 @@ UINT16 GKI_poolutilization (UINT8 pool_id) return ((Q->cur_cnt * 100) / Q->total); } - diff --git a/src/revolution/BTE/gki/common/gki_time.c b/src/revolution/BTE/gki/common/gki_time.c index 67cb7b06f..4d5558f92 100644 --- a/src/revolution/BTE/gki/common/gki_time.c +++ b/src/revolution/BTE/gki/common/gki_time.c @@ -7,6 +7,9 @@ * - Modified GKI_stop_timer to match RVL version * - Modified GKI_add_to_timer_list to match RVL version * - Modified GKI_remove_from_timer_list to match RVL version + * + * 2026/09/24: + * - Defined out functions unused for RVL * * Compile with REVOLUTION defined to include these changes. * @@ -117,6 +120,7 @@ void gki_timers_init(void) ** Returns TRUE if at least one time is running in the system, FALSE else. ** *******************************************************************************/ +#ifndef REVOLUTION BOOLEAN gki_timers_is_timer_running(void) { UINT8 tt; @@ -155,6 +159,7 @@ BOOLEAN gki_timers_is_timer_running(void) return FALSE; } +#endif /******************************************************************************* ** @@ -620,6 +625,7 @@ void GKI_timer_update (INT32 ticks_since_last_update) ** Returns BOOLEAN ** *******************************************************************************/ +#ifndef REVOLUTION BOOLEAN GKI_timer_queue_empty (void) { UINT8 tt; @@ -632,6 +638,7 @@ BOOLEAN GKI_timer_queue_empty (void) return TRUE; } +#endif /******************************************************************************* ** @@ -784,6 +791,7 @@ UINT16 GKI_update_timer_list (TIMER_LIST_Q *p_timer_listq, INT32 num_units_since ** remaining ticks if success ** *******************************************************************************/ +#ifndef REVOLUTION UINT32 GKI_get_remaining_ticks (TIMER_LIST_Q *p_timer_listq, TIMER_LIST_ENT *p_target_tle) { TIMER_LIST_ENT *p_tle; @@ -818,6 +826,7 @@ UINT32 GKI_get_remaining_ticks (TIMER_LIST_Q *p_timer_listq, TIMER_LIST_ENT *p_ return (rem_ticks); } +#endif /******************************************************************************* ** diff --git a/src/revolution/BTE/stack/avct/avct_api.c b/src/revolution/BTE/stack/avct/avct_api.c deleted file mode 100644 index 7e37a908f..000000000 --- a/src/revolution/BTE/stack/avct/avct_api.c +++ /dev/null @@ -1,465 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2003-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This module contains API of the audio/video control transport protocol. - * - ******************************************************************************/ - -#include -#include "data_types.h" -#include "bt_target.h" -#include "gki.h" -#include "l2c_api.h" -#include "l2cdefs.h" -#include "btm_api.h" -#include "avct_api.h" -#include "avct_int.h" - -/* Control block for AVCT */ -#if AVCT_DYNAMIC_MEMORY == FALSE -tAVCT_CB avct_cb; -#endif - -/******************************************************************************* -** -** Function AVCT_Register -** -** Description This is the system level registration function for the -** AVCTP protocol. This function initializes AVCTP and -** prepares the protocol stack for its use. This function -** must be called once by the system or platform using AVCTP -** before the other functions of the API an be used. -** -** -** Returns void -** -*******************************************************************************/ -void AVCT_Register(UINT16 mtu, UINT16 mtu_br, UINT8 sec_mask) -{ - AVCT_TRACE_API0("AVCT_Register"); - - /* register PSM with L2CAP */ - L2CA_Register(AVCT_PSM, (tL2CAP_APPL_INFO *) &avct_l2c_appl); - - /* set security level */ - BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVCTP, sec_mask, AVCT_PSM, 0, 0); - BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVCTP, sec_mask, AVCT_PSM, 0, 0); - - /* initialize AVCTP data structures */ - memset(&avct_cb, 0, sizeof(tAVCT_CB)); - -#if (AVCT_BROWSE_INCLUDED == TRUE) - /* Include the browsing channel which uses eFCR */ - L2CA_Register(AVCT_BR_PSM, (tL2CAP_APPL_INFO *) &avct_l2c_br_appl); - - BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0); - BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_AVCTP_BROWSE, sec_mask, AVCT_BR_PSM, 0, 0); - - if (mtu_br < AVCT_MIN_BROWSE_MTU) - mtu_br = AVCT_MIN_BROWSE_MTU; - avct_cb.mtu_br = mtu_br; -#endif - -#if defined(AVCT_INITIAL_TRACE_LEVEL) - avct_cb.trace_level = AVCT_INITIAL_TRACE_LEVEL; -#else - avct_cb.trace_level = BT_TRACE_LEVEL_NONE; -#endif - - if (mtu < AVCT_MIN_CONTROL_MTU) - mtu = AVCT_MIN_CONTROL_MTU; - /* store mtu */ - avct_cb.mtu = mtu; -} - -/******************************************************************************* -** -** Function AVCT_Deregister -** -** Description This function is called to deregister use AVCTP protocol. -** It is called when AVCTP is no longer being used by any -** application in the system. Before this function can be -** called, all connections must be removed with -** AVCT_RemoveConn(). -** -** -** Returns void -** -*******************************************************************************/ -void AVCT_Deregister(void) -{ - AVCT_TRACE_API0("AVCT_Deregister"); - - /* deregister PSM with L2CAP */ - L2CA_Deregister(AVCT_PSM); -} - -/******************************************************************************* -** -** Function AVCT_CreateConn -** -** Description Create an AVCTP connection. There are two types of -** connections, initiator and acceptor, as determined by -** the p_cc->role parameter. When this function is called to -** create an initiator connection, an AVCTP connection to -** the peer device is initiated if one does not already exist. -** If an acceptor connection is created, the connection waits -** passively for an incoming AVCTP connection from a peer device. -** -** -** Returns AVCT_SUCCESS if successful, otherwise error. -** -*******************************************************************************/ -UINT16 AVCT_CreateConn(UINT8 *p_handle, tAVCT_CC *p_cc, BD_ADDR peer_addr) -{ - UINT16 result = AVCT_SUCCESS; - tAVCT_CCB *p_ccb; - tAVCT_LCB *p_lcb; - - AVCT_TRACE_API2("AVCT_CreateConn: %d, control:%d", p_cc->role, p_cc->control); - - /* Allocate ccb; if no ccbs, return failure */ - if ((p_ccb = avct_ccb_alloc(p_cc)) == NULL) - { - result = AVCT_NO_RESOURCES; - } - else - { - /* get handle */ - *p_handle = avct_ccb_to_idx(p_ccb); - - /* if initiator connection */ - if (p_cc->role == AVCT_INT) - { - /* find link; if none allocate a new one */ - if ((p_lcb = avct_lcb_by_bd(peer_addr)) == NULL) - { - if ((p_lcb = avct_lcb_alloc(peer_addr)) == NULL) - { - /* no link resources; free ccb as well */ - avct_ccb_dealloc(p_ccb, AVCT_NO_EVT, 0, NULL); - result = AVCT_NO_RESOURCES; - } - } - /* check if PID already in use */ - else if (avct_lcb_has_pid(p_lcb, p_cc->pid)) - { - avct_ccb_dealloc(p_ccb, AVCT_NO_EVT, 0, NULL); - result = AVCT_PID_IN_USE; - } - - if (result == AVCT_SUCCESS) - { - /* bind lcb to ccb */ - p_ccb->p_lcb = p_lcb; - AVCT_TRACE_DEBUG1("ch_state: %d", p_lcb->ch_state); - avct_lcb_event(p_lcb, AVCT_LCB_UL_BIND_EVT, (tAVCT_LCB_EVT *) &p_ccb); - } - } - } - return result; -} - -/******************************************************************************* -** -** Function AVCT_RemoveConn -** -** Description Remove an AVCTP connection. This function is called when -** the application is no longer using a connection. If this -** is the last connection to a peer the L2CAP channel for AVCTP -** will be closed. -** -** -** Returns AVCT_SUCCESS if successful, otherwise error. -** -*******************************************************************************/ -UINT16 AVCT_RemoveConn(UINT8 handle) -{ - UINT16 result = AVCT_SUCCESS; - tAVCT_CCB *p_ccb; - - AVCT_TRACE_API0("AVCT_RemoveConn"); - - /* map handle to ccb */ - if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) - { - result = AVCT_BAD_HANDLE; - } - /* if connection not bound to lcb, dealloc */ - else if (p_ccb->p_lcb == NULL) - { - avct_ccb_dealloc(p_ccb, AVCT_NO_EVT, 0, NULL); - } - /* send unbind event to lcb */ - else - { - avct_lcb_event(p_ccb->p_lcb, AVCT_LCB_UL_UNBIND_EVT, (tAVCT_LCB_EVT *) &p_ccb); - } - return result; -} - -/******************************************************************************* -** -** Function AVCT_CreateBrowse -** -** Description Create an AVCTP Browse channel. There are two types of -** connections, initiator and acceptor, as determined by -** the role parameter. When this function is called to -** create an initiator connection, the Browse channel to -** the peer device is initiated if one does not already exist. -** If an acceptor connection is created, the connection waits -** passively for an incoming AVCTP connection from a peer device. -** -** -** Returns AVCT_SUCCESS if successful, otherwise error. -** -*******************************************************************************/ -UINT16 AVCT_CreateBrowse (UINT8 handle, UINT8 role) -{ -#if (AVCT_BROWSE_INCLUDED == TRUE) - UINT16 result = AVCT_SUCCESS; - tAVCT_CCB *p_ccb; - tAVCT_BCB *p_bcb; - int index; - - AVCT_TRACE_API1("AVCT_CreateBrowse: %d", role); - - /* map handle to ccb */ - if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) - { - return AVCT_BAD_HANDLE; - } - else - { - /* mark this CCB as supporting browsing channel */ - if ((p_ccb->allocated & AVCT_ALOC_BCB) == 0) - { - p_ccb->allocated |= AVCT_ALOC_BCB; - } - } - - /* if initiator connection */ - if (role == AVCT_INT) - { - /* the link control block must exist before this function is called as INT. */ - if (p_ccb->p_lcb == NULL) - { - result = AVCT_NOT_OPEN; - } - else - { - /* find link; if none allocate a new one */ - index = p_ccb->p_lcb->allocated; - if (index > AVCT_NUM_LINKS) - { - result = AVCT_BAD_HANDLE; - } - else - { - p_bcb = &avct_cb.bcb[index - 1]; - p_bcb->allocated = index; - } - } - - if (result == AVCT_SUCCESS) - { - /* bind bcb to ccb */ - p_ccb->p_bcb = p_bcb; - AVCT_TRACE_DEBUG1("ch_state: %d", p_bcb->ch_state); - avct_bcb_event(p_bcb, AVCT_LCB_UL_BIND_EVT, (tAVCT_LCB_EVT *) &p_ccb); - } - } - - return result; -#else - return AVCT_NO_RESOURCES; -#endif -} - -/******************************************************************************* -** -** Function AVCT_RemoveBrowse -** -** Description Remove an AVCTP Browse channel. This function is called when -** the application is no longer using a connection. If this -** is the last connection to a peer the L2CAP channel for AVCTP -** will be closed. -** -** -** Returns AVCT_SUCCESS if successful, otherwise error. -** -*******************************************************************************/ -UINT16 AVCT_RemoveBrowse (UINT8 handle) -{ -#if (AVCT_BROWSE_INCLUDED == TRUE) - UINT16 result = AVCT_SUCCESS; - tAVCT_CCB *p_ccb; - - AVCT_TRACE_API0("AVCT_RemoveBrowse"); - - /* map handle to ccb */ - if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) - { - result = AVCT_BAD_HANDLE; - } - else if (p_ccb->p_bcb != NULL) - /* send unbind event to bcb */ - { - avct_bcb_event(p_ccb->p_bcb, AVCT_LCB_UL_UNBIND_EVT, (tAVCT_LCB_EVT *) &p_ccb); - } - return result; -#else - return AVCT_NO_RESOURCES; -#endif -} - -/******************************************************************************* -** -** Function AVCT_GetBrowseMtu -** -** Description Get the peer_mtu for the AVCTP Browse channel of the given -** connection. -** -** Returns the peer browsing channel MTU. -** -*******************************************************************************/ -UINT16 AVCT_GetBrowseMtu (UINT8 handle) -{ - UINT16 peer_mtu = AVCT_MIN_BROWSE_MTU; -#if (AVCT_BROWSE_INCLUDED == TRUE) - tAVCT_CCB *p_ccb; - - if ((p_ccb = avct_ccb_by_idx(handle)) != NULL && p_ccb->p_bcb != NULL) - { - peer_mtu = p_ccb->p_bcb->peer_mtu; - } -#endif - return peer_mtu; -} - -/******************************************************************************* -** -** Function AVCT_GetPeerMtu -** -** Description Get the peer_mtu for the AVCTP channel of the given -** connection. -** -** Returns the peer MTU size. -** -*******************************************************************************/ -UINT16 AVCT_GetPeerMtu (UINT8 handle) -{ - UINT16 peer_mtu = L2CAP_DEFAULT_MTU; - tAVCT_CCB *p_ccb; - - /* map handle to ccb */ - if ((p_ccb = avct_ccb_by_idx(handle)) != NULL) - { - if (p_ccb->p_lcb) - { - peer_mtu = p_ccb->p_lcb->peer_mtu; - } - } - - return peer_mtu; -} - -/******************************************************************************* -** -** Function AVCT_MsgReq -** -** Description Send an AVCTP message to a peer device. In calling -** AVCT_MsgReq(), the application should keep track of the -** congestion state of AVCTP as communicated with events -** AVCT_CONG_IND_EVT and AVCT_UNCONG_IND_EVT. If the -** application calls AVCT_MsgReq() when AVCTP is congested -** the message may be discarded. The application may make its -** first call to AVCT_MsgReq() after it receives an -** AVCT_CONNECT_CFM_EVT or AVCT_CONNECT_IND_EVT on control channel or -** AVCT_BROWSE_CONN_CFM_EVT or AVCT_BROWSE_CONN_IND_EVT on browsing channel. -** -** p_msg->layer_specific must be set to -** AVCT_DATA_CTRL for control channel traffic; -** AVCT_DATA_BROWSE for for browse channel traffic. -** -** Returns AVCT_SUCCESS if successful, otherwise error. -** -*******************************************************************************/ -UINT16 AVCT_MsgReq(UINT8 handle, UINT8 label, UINT8 cr, BT_HDR *p_msg) -{ - UINT16 result = AVCT_SUCCESS; - tAVCT_CCB *p_ccb; - tAVCT_UL_MSG ul_msg; - - AVCT_TRACE_API0("AVCT_MsgReq"); - - /* verify p_msg parameter */ - if (p_msg == NULL) - { - return AVCT_NO_RESOURCES; - } - AVCT_TRACE_API1("len: %d", p_msg->len); - - /* map handle to ccb */ - if ((p_ccb = avct_ccb_by_idx(handle)) == NULL) - { - result = AVCT_BAD_HANDLE; - GKI_freebuf(p_msg); - } - /* verify channel is bound to link */ - else if (p_ccb->p_lcb == NULL) - { - result = AVCT_NOT_OPEN; - GKI_freebuf(p_msg); - } - - if (result == AVCT_SUCCESS) - { - ul_msg.p_buf = p_msg; - ul_msg.p_ccb = p_ccb; - ul_msg.label = label; - ul_msg.cr = cr; - -#if (AVCT_BROWSE_INCLUDED == TRUE) - /* send msg event to bcb */ - if (p_msg->layer_specific == AVCT_DATA_BROWSE) - { - if (p_ccb->p_bcb == NULL && (p_ccb->allocated & AVCT_ALOC_BCB) == 0) - { - /* BCB channel is not open and not allocated */ - result = AVCT_BAD_HANDLE; - GKI_freebuf(p_msg); - } - else - { - p_ccb->p_bcb = avct_bcb_by_lcb(p_ccb->p_lcb); - avct_bcb_event(p_ccb->p_bcb, AVCT_LCB_UL_MSG_EVT, (tAVCT_LCB_EVT *) &ul_msg); - } - } - /* send msg event to lcb */ - else -#endif - { - avct_lcb_event(p_ccb->p_lcb, AVCT_LCB_UL_MSG_EVT, (tAVCT_LCB_EVT *) &ul_msg); - } - } - return result; -} - diff --git a/src/revolution/BTE/stack/avct/avct_ccb.c b/src/revolution/BTE/stack/avct/avct_ccb.c deleted file mode 100644 index 09051b1b9..000000000 --- a/src/revolution/BTE/stack/avct/avct_ccb.c +++ /dev/null @@ -1,150 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2003-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This module contains functions which operate on the AVCTP connection - * control block. - * - ******************************************************************************/ - -#include -#include "data_types.h" -#include "bt_target.h" -#include "avct_api.h" -#include "avct_int.h" - -/******************************************************************************* -** -** Function avct_ccb_alloc -** -** Description Allocate a connection control block; copy parameters to ccb. -** -** -** Returns pointer to the ccb, or NULL if none could be allocated. -** -*******************************************************************************/ -tAVCT_CCB *avct_ccb_alloc(tAVCT_CC *p_cc) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (!p_ccb->allocated) - { - p_ccb->allocated = AVCT_ALOC_LCB; - memcpy(&p_ccb->cc, p_cc, sizeof(tAVCT_CC)); - AVCT_TRACE_DEBUG1("avct_ccb_alloc %d", i); - break; - } - } - - if (i == AVCT_NUM_CONN) - { - /* out of ccbs */ - p_ccb = NULL; - AVCT_TRACE_WARNING0("Out of ccbs"); - } - return p_ccb; -} - -/******************************************************************************* -** -** Function avct_ccb_dealloc -** -** Description Deallocate a connection control block and call application -** callback. -** -** -** Returns void. -** -*******************************************************************************/ -void avct_ccb_dealloc(tAVCT_CCB *p_ccb, UINT8 event, UINT16 result, BD_ADDR bd_addr) -{ - tAVCT_CTRL_CBACK *p_cback = p_ccb->cc.p_ctrl_cback; - - AVCT_TRACE_DEBUG1("avct_ccb_dealloc %d", avct_ccb_to_idx(p_ccb)); -#if (AVCT_BROWSE_INCLUDED == TRUE) - if(p_ccb->p_bcb == NULL) - memset(p_ccb, 0, sizeof(tAVCT_CCB)); - else - { - /* control channel is down, but the browsing channel is still connected 0 disconnect it now */ - avct_bcb_event(p_ccb->p_bcb, AVCT_LCB_UL_UNBIND_EVT, (tAVCT_LCB_EVT *) &p_ccb); - p_ccb->p_lcb = NULL; - } -#else - memset(p_ccb, 0, sizeof(tAVCT_CCB)); -#endif - - if (event != AVCT_NO_EVT) - { - (*p_cback)(avct_ccb_to_idx(p_ccb), event, result, bd_addr); - } -} - -/******************************************************************************* -** -** Function avct_ccb_to_idx -** -** Description Given a pointer to an ccb, return its index. -** -** -** Returns Index of ccb. -** -*******************************************************************************/ -UINT8 avct_ccb_to_idx(tAVCT_CCB *p_ccb) -{ - /* use array arithmetic to determine index */ - return (UINT8) (p_ccb - avct_cb.ccb); -} - -/******************************************************************************* -** -** Function avct_ccb_by_idx -** -** Description Return ccb pointer based on ccb index (or handle). -** -** -** Returns pointer to the ccb, or NULL if none found. -** -*******************************************************************************/ -tAVCT_CCB *avct_ccb_by_idx(UINT8 idx) -{ - tAVCT_CCB *p_ccb; - - /* verify index */ - if (idx < AVCT_NUM_CONN) - { - p_ccb = &avct_cb.ccb[idx]; - - /* verify ccb is allocated */ - if (!p_ccb->allocated) - { - p_ccb = NULL; - AVCT_TRACE_WARNING1("ccb %d not allocated", idx); - } - } - else - { - p_ccb = NULL; - AVCT_TRACE_WARNING1("No ccb for idx %d", idx); - } - return p_ccb; -} diff --git a/src/revolution/BTE/stack/avct/avct_l2c.c b/src/revolution/BTE/stack/avct/avct_l2c.c deleted file mode 100644 index ef0f5fce0..000000000 --- a/src/revolution/BTE/stack/avct/avct_l2c.c +++ /dev/null @@ -1,434 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2003-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This AVCTP module interfaces to L2CAP - * - ******************************************************************************/ - -#include -#include "data_types.h" -#include "bt_target.h" -#include "avct_api.h" -#include "avct_int.h" -#include "l2c_api.h" -#include "l2cdefs.h" - -/* Configuration flags. */ -#define AVCT_L2C_CFG_IND_DONE (1<<0) -#define AVCT_L2C_CFG_CFM_DONE (1<<1) - -/* callback function declarations */ -void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id); -void avct_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result); -void avct_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg); -void avct_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg); -void avct_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed); -void avct_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result); -void avct_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested); -void avct_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf); - -/* L2CAP callback function structure */ -const tL2CAP_APPL_INFO avct_l2c_appl = { - avct_l2c_connect_ind_cback, - avct_l2c_connect_cfm_cback, - NULL, - avct_l2c_config_ind_cback, - avct_l2c_config_cfm_cback, - avct_l2c_disconnect_ind_cback, - avct_l2c_disconnect_cfm_cback, - NULL, - avct_l2c_data_ind_cback, - avct_l2c_congestion_ind_cback, - NULL /* tL2CA_TX_COMPLETE_CB */ -}; - -/******************************************************************************* -** -** Function avct_l2c_is_passive -** -** Description check is the CCB associated with the given LCB was created -** as passive -** -** Returns TRUE, if the given LCB is created as AVCT_PASSIVE -** -*******************************************************************************/ -static BOOLEAN avct_l2c_is_passive (tAVCT_LCB *p_lcb) -{ - BOOLEAN is_passive = FALSE; - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) - { - AVCT_TRACE_DEBUG1("avct_l2c_is_ct control:x%x", p_ccb->cc.control); - if (p_ccb->cc.control & AVCT_PASSIVE) - { - is_passive = TRUE; - break; - } - } - } - return is_passive; -} - -/******************************************************************************* -** -** Function avct_l2c_connect_ind_cback -** -** Description This is the L2CAP connect indication callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_connect_ind_cback(BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id) -{ - tAVCT_LCB *p_lcb; - UINT16 result = L2CAP_CONN_OK; - tL2CAP_CFG_INFO cfg; - - /* do we already have a channel for this peer? */ - if ((p_lcb = avct_lcb_by_bd(bd_addr)) == NULL) - { - /* no, allocate lcb */ - if ((p_lcb = avct_lcb_alloc(bd_addr)) == NULL) - { - /* no ccb available, reject L2CAP connection */ - result = L2CAP_CONN_NO_RESOURCES; - } - } - /* else we already have a channel for this peer */ - else - { - if (!avct_l2c_is_passive (p_lcb) || (p_lcb->ch_state == AVCT_CH_OPEN)) - { - /* this LCB included CT role - reject */ - result = L2CAP_CONN_NO_RESOURCES; - } - else - { - /* TG role only - accept the connection from CT. move the channel ID to the conflict list */ - p_lcb->conflict_lcid = p_lcb->ch_lcid; - AVCT_TRACE_DEBUG1("avct_l2c_connect_ind_cback conflict_lcid:0x%x", p_lcb->conflict_lcid); - } - } - - if(p_lcb) - { - AVCT_TRACE_DEBUG3("avct_l2c_connect_ind_cback: 0x%x, res: %d, ch_state: %d", - lcid, result, p_lcb->ch_state); - } - /* Send L2CAP connect rsp */ - L2CA_ConnectRsp(bd_addr, id, lcid, result, 0); - - /* if result ok, proceed with connection */ - if (result == L2CAP_CONN_OK) - { - /* store LCID */ - p_lcb->ch_lcid = lcid; - - /* transition to configuration state */ - p_lcb->ch_state = AVCT_CH_CFG; - - /* Send L2CAP config req */ - memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO)); - cfg.mtu_present = TRUE; - cfg.mtu = avct_cb.mtu; - L2CA_ConfigReq(lcid, &cfg); - AVCT_TRACE_DEBUG0("avct_l2c snd Cfg Req"); - } - -#if (BT_USE_TRACES == TRUE) - if(p_lcb) - AVCT_TRACE_DEBUG1("ch_state cni: %d ", p_lcb->ch_state); -#endif -} - -/******************************************************************************* -** -** Function avct_l2c_connect_cfm_cback -** -** Description This is the L2CAP connect confirm callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_connect_cfm_cback(UINT16 lcid, UINT16 result) -{ - tAVCT_LCB *p_lcb; - tL2CAP_CFG_INFO cfg; - - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - AVCT_TRACE_DEBUG4("avct_l2c_connect_cfm_cback lcid:0x%x result: %d ch_state: %d, conflict_lcid:0x%x", - lcid, result, p_lcb->ch_state, p_lcb->conflict_lcid); - /* if in correct state */ - if (p_lcb->ch_state == AVCT_CH_CONN) - { - /* if result successful */ - if (result == L2CAP_CONN_OK) - { - /* set channel state */ - p_lcb->ch_state = AVCT_CH_CFG; - - /* Send L2CAP config req */ - memset(&cfg, 0, sizeof(tL2CAP_CFG_INFO)); - cfg.mtu_present = TRUE; - cfg.mtu = avct_cb.mtu; - L2CA_ConfigReq(lcid, &cfg); - AVCT_TRACE_DEBUG0("avct_l2c snd Cfg Req"); - } - /* else failure */ - else - { - AVCT_TRACE_DEBUG1("avct_l2c_connect_cfm_cback conflict_lcid:0x%x", p_lcb->conflict_lcid); - if (p_lcb->conflict_lcid == lcid) - p_lcb->conflict_lcid = 0; - else - avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &result); - } - } - else if (p_lcb->conflict_lcid == lcid) - { - /* we must be in AVCT_CH_CFG state for the ch_lcid channel */ - AVCT_TRACE_DEBUG2("avct_l2c_connect_cfm_cback ch_state: %d, conflict_lcid:0x%x", p_lcb->ch_state, p_lcb->conflict_lcid); - if (result == L2CAP_CONN_OK) - { - /* just in case the peer also accepts our connection - Send L2CAP disconnect req */ - L2CA_DisconnectReq(lcid); - } - p_lcb->conflict_lcid = 0; - } - AVCT_TRACE_DEBUG1("ch_state cnc: %d ", p_lcb->ch_state); - } -} - -/******************************************************************************* -** -** Function avct_l2c_config_cfm_cback -** -** Description This is the L2CAP config confirm callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_config_cfm_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg) -{ - tAVCT_LCB *p_lcb; - - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - AVCT_TRACE_DEBUG3("avct_l2c_config_cfm_cback: 0x%x, ch_state: %d, res: %d", - lcid, p_lcb->ch_state, p_cfg->result); - /* if in correct state */ - if (p_lcb->ch_state == AVCT_CH_CFG) - { - /* if result successful */ - if (p_cfg->result == L2CAP_CFG_OK) - { - /* update flags */ - p_lcb->ch_flags |= AVCT_L2C_CFG_CFM_DONE; - - /* if configuration complete */ - if (p_lcb->ch_flags & AVCT_L2C_CFG_IND_DONE) - { - p_lcb->ch_state = AVCT_CH_OPEN; - avct_lcb_event(p_lcb, AVCT_LCB_LL_OPEN_EVT, NULL); - } - } - /* else failure */ - else - { - AVCT_TRACE_DEBUG1("ERROR avct_l2c_config_cfm_cback L2CA_DisconnectReq %d ", p_lcb->ch_state); - /* store result value */ - p_lcb->ch_result = p_cfg->result; - - /* Send L2CAP disconnect req */ - L2CA_DisconnectReq(lcid); - } - } - AVCT_TRACE_DEBUG1("ch_state cfc: %d ", p_lcb->ch_state); - } -} - -/******************************************************************************* -** -** Function avct_l2c_config_ind_cback -** -** Description This is the L2CAP config indication callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_config_ind_cback(UINT16 lcid, tL2CAP_CFG_INFO *p_cfg) -{ - tAVCT_LCB *p_lcb; - - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - AVCT_TRACE_DEBUG2("avct_l2c_config_ind_cback: 0x%x, ch_state: %d", lcid, p_lcb->ch_state); - /* store the mtu in tbl */ - if (p_cfg->mtu_present) - { - p_lcb->peer_mtu = p_cfg->mtu; - } - else - { - p_lcb->peer_mtu = L2CAP_DEFAULT_MTU; - } - - /* send L2CAP configure response */ - memset(p_cfg, 0, sizeof(tL2CAP_CFG_INFO)); - p_cfg->result = L2CAP_CFG_OK; - L2CA_ConfigRsp(lcid, p_cfg); - - /* if first config ind */ - if ((p_lcb->ch_flags & AVCT_L2C_CFG_IND_DONE) == 0) - { - /* update flags */ - p_lcb->ch_flags |= AVCT_L2C_CFG_IND_DONE; - - /* if configuration complete */ - if (p_lcb->ch_flags & AVCT_L2C_CFG_CFM_DONE) - { - p_lcb->ch_state = AVCT_CH_OPEN; - avct_lcb_event(p_lcb, AVCT_LCB_LL_OPEN_EVT, NULL); - } - } - AVCT_TRACE_DEBUG1("ch_state cfi: %d ", p_lcb->ch_state); - } -} - -/******************************************************************************* -** -** Function avct_l2c_disconnect_ind_cback -** -** Description This is the L2CAP disconnect indication callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_disconnect_ind_cback(UINT16 lcid, BOOLEAN ack_needed) -{ - tAVCT_LCB *p_lcb; - UINT16 result = AVCT_RESULT_FAIL; - - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - AVCT_TRACE_DEBUG2("avct_l2c_disconnect_ind_cback: 0x%x, ch_state: %d", lcid, p_lcb->ch_state); - if (ack_needed) - { - /* send L2CAP disconnect response */ - L2CA_DisconnectRsp(lcid); - } - - avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &result); - AVCT_TRACE_DEBUG1("ch_state di: %d ", p_lcb->ch_state); - } -} - -/******************************************************************************* -** -** Function avct_l2c_disconnect_cfm_cback -** -** Description This is the L2CAP disconnect confirm callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_disconnect_cfm_cback(UINT16 lcid, UINT16 result) -{ - tAVCT_LCB *p_lcb; - UINT16 res; - - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - AVCT_TRACE_DEBUG3("avct_l2c_disconnect_cfm_cback: 0x%x, ch_state: %d, res: %d", - lcid, p_lcb->ch_state, result); - /* result value may be previously stored */ - res = (p_lcb->ch_result != 0) ? p_lcb->ch_result : result; - p_lcb->ch_result = 0; - - avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &res); - AVCT_TRACE_DEBUG1("ch_state dc: %d ", p_lcb->ch_state); - } -} - -/******************************************************************************* -** -** Function avct_l2c_congestion_ind_cback -** -** Description This is the L2CAP congestion indication callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_congestion_ind_cback(UINT16 lcid, BOOLEAN is_congested) -{ - tAVCT_LCB *p_lcb; - - AVCT_TRACE_DEBUG1("avct_l2c_congestion_ind_cback: 0x%x", lcid); - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - avct_lcb_event(p_lcb, AVCT_LCB_LL_CONG_EVT, (tAVCT_LCB_EVT *) &is_congested); - } -} - -/******************************************************************************* -** -** Function avct_l2c_data_ind_cback -** -** Description This is the L2CAP data indication callback function. -** -** -** Returns void -** -*******************************************************************************/ -void avct_l2c_data_ind_cback(UINT16 lcid, BT_HDR *p_buf) -{ - tAVCT_LCB *p_lcb; - - AVCT_TRACE_DEBUG1("avct_l2c_data_ind_cback: 0x%x", lcid); - /* look up lcb for this channel */ - if ((p_lcb = avct_lcb_by_lcid(lcid)) != NULL) - { - avct_lcb_event(p_lcb, AVCT_LCB_LL_MSG_EVT, (tAVCT_LCB_EVT *) &p_buf); - } - else /* prevent buffer leak */ - { - AVCT_TRACE_WARNING0("ERROR -> avct_l2c_data_ind_cback drop buffer"); - GKI_freebuf(p_buf); - } -} - diff --git a/src/revolution/BTE/stack/avct/avct_lcb.c b/src/revolution/BTE/stack/avct/avct_lcb.c deleted file mode 100644 index bb3f44774..000000000 --- a/src/revolution/BTE/stack/avct/avct_lcb.c +++ /dev/null @@ -1,471 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2003-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This module contains the link control state machine and functions which - * operate on the link control block. - * - ******************************************************************************/ - -#include -#include "data_types.h" -#include "bt_target.h" -#include "avct_api.h" -#include "avct_int.h" -#include "gki.h" - -/***************************************************************************** -** state machine constants and types -*****************************************************************************/ - -#if BT_TRACE_VERBOSE == TRUE - -/* verbose state strings for trace */ -const char * const avct_lcb_st_str[] = { - "LCB_IDLE_ST", - "LCB_OPENING_ST", - "LCB_OPEN_ST", - "LCB_CLOSING_ST" -}; - -/* verbose event strings for trace */ -const char * const avct_lcb_evt_str[] = { - "UL_BIND_EVT", - "UL_UNBIND_EVT", - "UL_MSG_EVT", - "INT_CLOSE_EVT", - "LL_OPEN_EVT", - "LL_CLOSE_EVT", - "LL_MSG_EVT", - "LL_CONG_EVT" -}; - -#endif - -/* lcb state machine states */ -enum { - AVCT_LCB_IDLE_ST, - AVCT_LCB_OPENING_ST, - AVCT_LCB_OPEN_ST, - AVCT_LCB_CLOSING_ST -}; - -/* state machine action enumeration list */ -enum { - AVCT_LCB_CHNL_OPEN, - AVCT_LCB_CHNL_DISC, - AVCT_LCB_SEND_MSG, - AVCT_LCB_OPEN_IND, - AVCT_LCB_OPEN_FAIL, - AVCT_LCB_CLOSE_IND, - AVCT_LCB_CLOSE_CFM, - AVCT_LCB_MSG_IND, - AVCT_LCB_CONG_IND, - AVCT_LCB_BIND_CONN, - AVCT_LCB_BIND_FAIL, - AVCT_LCB_UNBIND_DISC, - AVCT_LCB_CHK_DISC, - AVCT_LCB_DISCARD_MSG, - AVCT_LCB_DEALLOC, - AVCT_LCB_FREE_MSG_IND, - AVCT_LCB_NUM_ACTIONS -}; - -#define AVCT_LCB_IGNORE AVCT_LCB_NUM_ACTIONS - -/* type for action functions */ -typedef void (*tAVCT_LCB_ACTION)(tAVCT_LCB *p_ccb, tAVCT_LCB_EVT *p_data); - -/* action function list */ -const tAVCT_LCB_ACTION avct_lcb_action[] = { - avct_lcb_chnl_open, - avct_lcb_chnl_disc, - avct_lcb_send_msg, - avct_lcb_open_ind, - avct_lcb_open_fail, - avct_lcb_close_ind, - avct_lcb_close_cfm, - avct_lcb_msg_ind, - avct_lcb_cong_ind, - avct_lcb_bind_conn, - avct_lcb_bind_fail, - avct_lcb_unbind_disc, - avct_lcb_chk_disc, - avct_lcb_discard_msg, - avct_lcb_dealloc, - avct_lcb_free_msg_ind -}; - -/* state table information */ -#define AVCT_LCB_ACTIONS 2 /* number of actions */ -#define AVCT_LCB_NEXT_STATE 2 /* position of next state */ -#define AVCT_LCB_NUM_COLS 3 /* number of columns in state tables */ - -/* state table for idle state */ -const UINT8 avct_lcb_st_idle[][AVCT_LCB_NUM_COLS] = { -/* Event Action 1 Action 2 Next state */ -/* UL_BIND_EVT */ {AVCT_LCB_CHNL_OPEN, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}, -/* UL_UNBIND_EVT */ {AVCT_LCB_UNBIND_DISC, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST}, -/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST}, -/* INT_CLOSE_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST}, -/* LL_OPEN_EVT */ {AVCT_LCB_OPEN_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_IND, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST}, -/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST}, -/* LL_CONG_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_IDLE_ST} -}; - -/* state table for opening state */ -const UINT8 avct_lcb_st_opening[][AVCT_LCB_NUM_COLS] = { -/* Event Action 1 Action 2 Next state */ -/* UL_BIND_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}, -/* UL_UNBIND_EVT */ {AVCT_LCB_UNBIND_DISC, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}, -/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}, -/* INT_CLOSE_EVT */ {AVCT_LCB_CHNL_DISC, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* LL_OPEN_EVT */ {AVCT_LCB_OPEN_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* LL_CLOSE_EVT */ {AVCT_LCB_OPEN_FAIL, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST}, -/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST}, -/* LL_CONG_EVT */ {AVCT_LCB_CONG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPENING_ST} -}; - -/* state table for open state */ -const UINT8 avct_lcb_st_open[][AVCT_LCB_NUM_COLS] = { -/* Event Action 1 Action 2 Next state */ -/* UL_BIND_EVT */ {AVCT_LCB_BIND_CONN, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* UL_UNBIND_EVT */ {AVCT_LCB_CHK_DISC, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* UL_MSG_EVT */ {AVCT_LCB_SEND_MSG, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* INT_CLOSE_EVT */ {AVCT_LCB_CHNL_DISC, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* LL_OPEN_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_IND, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST}, -/* LL_MSG_EVT */ {AVCT_LCB_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST}, -/* LL_CONG_EVT */ {AVCT_LCB_CONG_IND, AVCT_LCB_IGNORE, AVCT_LCB_OPEN_ST} -}; - -/* state table for closing state */ -const UINT8 avct_lcb_st_closing[][AVCT_LCB_NUM_COLS] = { -/* Event Action 1 Action 2 Next state */ -/* UL_BIND_EVT */ {AVCT_LCB_BIND_FAIL, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* UL_UNBIND_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* UL_MSG_EVT */ {AVCT_LCB_DISCARD_MSG, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* INT_CLOSE_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* LL_OPEN_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* LL_CLOSE_EVT */ {AVCT_LCB_CLOSE_CFM, AVCT_LCB_DEALLOC, AVCT_LCB_IDLE_ST}, -/* LL_MSG_EVT */ {AVCT_LCB_FREE_MSG_IND, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST}, -/* LL_CONG_EVT */ {AVCT_LCB_IGNORE, AVCT_LCB_IGNORE, AVCT_LCB_CLOSING_ST} -}; - -/* type for state table */ -typedef const UINT8 (*tAVCT_LCB_ST_TBL)[AVCT_LCB_NUM_COLS]; - -/* state table */ -const tAVCT_LCB_ST_TBL avct_lcb_st_tbl[] = { - avct_lcb_st_idle, - avct_lcb_st_opening, - avct_lcb_st_open, - avct_lcb_st_closing -}; - -/******************************************************************************* -** -** Function avct_lcb_event -** -** Description State machine event handling function for lcb -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_event(tAVCT_LCB *p_lcb, UINT8 event, tAVCT_LCB_EVT *p_data) -{ - tAVCT_LCB_ST_TBL state_table; - UINT8 action; - int i; - -#if BT_TRACE_VERBOSE == TRUE - AVCT_TRACE_EVENT3("LCB lcb=%d event=%s state=%s", p_lcb->allocated, avct_lcb_evt_str[event], avct_lcb_st_str[p_lcb->state]); -#else - AVCT_TRACE_EVENT3("LCB lcb=%d event=%d state=%d", p_lcb->allocated, event, p_lcb->state); -#endif - - /* look up the state table for the current state */ - state_table = avct_lcb_st_tbl[p_lcb->state]; - - /* set next state */ - p_lcb->state = state_table[event][AVCT_LCB_NEXT_STATE]; - - /* execute action functions */ - for (i = 0; i < AVCT_LCB_ACTIONS; i++) - { - if ((action = state_table[event][i]) != AVCT_LCB_IGNORE) - { - (*avct_lcb_action[action])(p_lcb, p_data); - } - else - { - break; - } - } -} - -/******************************************************************************* -** -** Function avct_bcb_event -** -** Description State machine event handling function for lcb -** -** -** Returns Nothing. -** -*******************************************************************************/ -#if (AVCT_BROWSE_INCLUDED == TRUE) -void avct_bcb_event(tAVCT_BCB *p_bcb, UINT8 event, tAVCT_LCB_EVT *p_data) -{ - tAVCT_LCB_ST_TBL state_table; - UINT8 action; - int i; - -#if BT_TRACE_VERBOSE == TRUE - AVCT_TRACE_EVENT3("BCB lcb=%d event=%s state=%s", p_bcb->allocated, avct_lcb_evt_str[event], avct_lcb_st_str[p_bcb->state]); -#else - AVCT_TRACE_EVENT3("BCB lcb=%d event=%d state=%d", p_bcb->allocated, event, p_bcb->state); -#endif - - /* look up the state table for the current state */ - state_table = avct_lcb_st_tbl[p_bcb->state]; - - /* set next state */ - p_bcb->state = state_table[event][AVCT_LCB_NEXT_STATE]; - - /* execute action functions */ - for (i = 0; i < AVCT_LCB_ACTIONS; i++) - { - if ((action = state_table[event][i]) != AVCT_LCB_IGNORE) - { - (*avct_bcb_action[action])(p_bcb, p_data); - } - else - { - break; - } - } -} -#endif - -/******************************************************************************* -** -** Function avct_lcb_by_bd -** -** Description This lookup function finds the lcb for a BD address. -** -** -** Returns pointer to the lcb, or NULL if none found. -** -*******************************************************************************/ -tAVCT_LCB *avct_lcb_by_bd(BD_ADDR bd_addr) -{ - tAVCT_LCB *p_lcb = &avct_cb.lcb[0]; - int i; - - for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++) - { - /* if allocated lcb has matching lcb */ - if (p_lcb->allocated && (!memcmp(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN))) - { - break; - } - } - - if (i == AVCT_NUM_LINKS) - { - /* if no lcb found */ - p_lcb = NULL; - - AVCT_TRACE_DEBUG6("No lcb for addr %02x-%02x-%02x-%02x-%02x-%02x", - bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]); - } - return p_lcb; -} - -/******************************************************************************* -** -** Function avct_lcb_alloc -** -** Description Allocate a link control block. -** -** -** Returns pointer to the lcb, or NULL if none could be allocated. -** -*******************************************************************************/ -tAVCT_LCB *avct_lcb_alloc(BD_ADDR bd_addr) -{ - tAVCT_LCB *p_lcb = &avct_cb.lcb[0]; - int i; - - for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++) - { - if (!p_lcb->allocated) - { - p_lcb->allocated = (UINT8)(i + 1); - memcpy(p_lcb->peer_addr, bd_addr, BD_ADDR_LEN); - AVCT_TRACE_DEBUG1("avct_lcb_alloc %d", p_lcb->allocated); - break; - } - } - - if (i == AVCT_NUM_LINKS) - { - /* out of lcbs */ - p_lcb = NULL; - AVCT_TRACE_WARNING0("Out of lcbs"); - } - return p_lcb; -} - -/******************************************************************************* -** -** Function avct_lcb_dealloc -** -** Description Deallocate a link control block. -** -** -** Returns void. -** -*******************************************************************************/ -void avct_lcb_dealloc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - BOOLEAN found = FALSE; - int i; - - AVCT_TRACE_DEBUG1("avct_lcb_dealloc %d", p_lcb->allocated); - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - /* if ccb allocated and */ - if (p_ccb->allocated) - { - if (p_ccb->p_lcb == p_lcb) - { - AVCT_TRACE_DEBUG1("avct_lcb_dealloc used by ccb: %d", i); - found = TRUE; - break; - } - } - } - - if (!found) - { - AVCT_TRACE_DEBUG0("avct_lcb_dealloc now"); - - /* clear reassembled msg buffer if in use */ - if (p_lcb->p_rx_msg != NULL) - { - GKI_freebuf(p_lcb->p_rx_msg); - } - memset(p_lcb, 0, sizeof(tAVCT_LCB)); - } -} - -/******************************************************************************* -** -** Function avct_lcb_by_lcid -** -** Description Find the LCB associated with the L2CAP LCID -** -** -** Returns pointer to the lcb, or NULL if none found. -** -*******************************************************************************/ -tAVCT_LCB *avct_lcb_by_lcid(UINT16 lcid) -{ - tAVCT_LCB *p_lcb = &avct_cb.lcb[0]; - int i; - - for (i = 0; i < AVCT_NUM_LINKS; i++, p_lcb++) - { - if (p_lcb->allocated && ((p_lcb->ch_lcid == lcid) || (p_lcb->conflict_lcid == lcid))) - { - break; - } - } - - if (i == AVCT_NUM_LINKS) - { - /* out of lcbs */ - p_lcb = NULL; - AVCT_TRACE_WARNING1("No lcb for lcid %x", lcid); - } - - return p_lcb; -} - -/******************************************************************************* -** -** Function avct_lcb_has_pid -** -** Description See if any ccbs on this lcb have a particular pid. -** -** -** Returns Pointer to CCB if PID found, NULL otherwise. -** -*******************************************************************************/ -tAVCT_CCB *avct_lcb_has_pid(tAVCT_LCB *p_lcb, UINT16 pid) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb->cc.pid == pid)) - { - return p_ccb; - } - } - return NULL; -} - -/******************************************************************************* -** -** Function avct_lcb_last_ccb -** -** Description See if given ccb is only one on the lcb. -** -** -** Returns TRUE if ccb is last, FALSE otherwise. -** -*******************************************************************************/ -BOOLEAN avct_lcb_last_ccb(tAVCT_LCB *p_lcb, tAVCT_CCB *p_ccb_last) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - - AVCT_TRACE_WARNING0("avct_lcb_last_ccb"); - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - AVCT_TRACE_WARNING6("%x: aloc:%d, lcb:0x%x/0x%x, ccb:0x%x/0x%x", - i, p_ccb->allocated, p_ccb->p_lcb, p_lcb, p_ccb, p_ccb_last); - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb) && (p_ccb != p_ccb_last)) - { - return FALSE; - } - } - return TRUE; -} - - - diff --git a/src/revolution/BTE/stack/avct/avct_lcb_act.c b/src/revolution/BTE/stack/avct/avct_lcb_act.c deleted file mode 100644 index b88351792..000000000 --- a/src/revolution/BTE/stack/avct/avct_lcb_act.c +++ /dev/null @@ -1,702 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2003-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This module contains action functions of the link control state machine. - * - ******************************************************************************/ - -#include -#include "data_types.h" -#include "bt_target.h" -#include "avct_api.h" -#include "avct_int.h" -#include "gki.h" -#include "btm_api.h" - -/* packet header length lookup table */ -const UINT8 avct_lcb_pkt_type_len[] = { - AVCT_HDR_LEN_SINGLE, - AVCT_HDR_LEN_START, - AVCT_HDR_LEN_CONT, - AVCT_HDR_LEN_END -}; - -/******************************************************************************* -** -** Function avct_lcb_msg_asmbl -** -** Description Reassemble incoming message. -** -** -** Returns Pointer to reassembled message; NULL if no message -** available. -** -*******************************************************************************/ -static BT_HDR *avct_lcb_msg_asmbl(tAVCT_LCB *p_lcb, BT_HDR *p_buf) -{ - UINT8 *p; - UINT8 pkt_type; - BT_HDR *p_ret; - UINT16 buf_len; - - /* parse the message header */ - p = (UINT8 *)(p_buf + 1) + p_buf->offset; - AVCT_PRS_PKT_TYPE(p, pkt_type); - - /* quick sanity check on length */ - if (p_buf->len < avct_lcb_pkt_type_len[pkt_type]) - { - GKI_freebuf(p_buf); - AVCT_TRACE_WARNING0("Bad length during reassembly"); - p_ret = NULL; - } - /* single packet */ - else if (pkt_type == AVCT_PKT_TYPE_SINGLE) - { - /* if reassembly in progress drop message and process new single */ - if (p_lcb->p_rx_msg != NULL) - { - GKI_freebuf(p_lcb->p_rx_msg); - p_lcb->p_rx_msg = NULL; - AVCT_TRACE_WARNING0("Got single during reassembly"); - } - p_ret = p_buf; - } - /* start packet */ - else if (pkt_type == AVCT_PKT_TYPE_START) - { - /* if reassembly in progress drop message and process new start */ - if (p_lcb->p_rx_msg != NULL) - { - GKI_freebuf(p_lcb->p_rx_msg); - AVCT_TRACE_WARNING0("Got start during reassembly"); - } - p_lcb->p_rx_msg = p_buf; - - /* copy first header byte over nosp */ - *(p + 1) = *p; - - /* set offset to point to where to copy next */ - p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len; - - /* adjust length for packet header */ - p_lcb->p_rx_msg->len -= 1; - - p_ret = NULL; - } - /* continue or end */ - else - { - /* if no reassembly in progress drop message */ - if (p_lcb->p_rx_msg == NULL) - { - GKI_freebuf(p_buf); - AVCT_TRACE_WARNING1("Pkt type=%d out of order", pkt_type); - p_ret = NULL; - } - else - { - /* get size of buffer holding assembled message */ - buf_len = GKI_get_buf_size(p_lcb->p_rx_msg) - sizeof(BT_HDR); - - /* adjust offset and len of fragment for header byte */ - p_buf->offset += AVCT_HDR_LEN_CONT; - p_buf->len -= AVCT_HDR_LEN_CONT; - - /* verify length */ - if ((p_lcb->p_rx_msg->offset + p_buf->len) > buf_len) - { - /* won't fit; free everything */ - GKI_freebuf(p_lcb->p_rx_msg); - p_lcb->p_rx_msg = NULL; - GKI_freebuf(p_buf); - p_ret = NULL; - AVCT_TRACE_WARNING0("Fragmented message to big!"); - } - else - { - /* copy contents of p_buf to p_rx_msg */ - memcpy((UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset, - (UINT8 *)(p_buf + 1) + p_buf->offset, p_buf->len); - - if (pkt_type == AVCT_PKT_TYPE_END) - { - p_lcb->p_rx_msg->offset -= p_lcb->p_rx_msg->len; - p_lcb->p_rx_msg->len += p_buf->len; - p_ret = p_lcb->p_rx_msg; - p_lcb->p_rx_msg = NULL; - } - else - { - p_lcb->p_rx_msg->offset += p_buf->len; - p_lcb->p_rx_msg->len += p_buf->len; - p_ret = NULL; - } - GKI_freebuf(p_buf); - } - } - } - return p_ret; -} - - -/******************************************************************************* -** -** Function avct_lcb_chnl_open -** -** Description Open L2CAP channel to peer -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_chnl_open(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - UINT16 result = AVCT_RESULT_FAIL; - - BTM_SetOutService(p_lcb->peer_addr, BTM_SEC_SERVICE_AVCTP, 0); - /* call l2cap connect req */ - p_lcb->ch_state = AVCT_CH_CONN; - if ((p_lcb->ch_lcid = L2CA_ConnectReq(AVCT_PSM, p_lcb->peer_addr)) == 0) - { - /* if connect req failed, send ourselves close event */ - avct_lcb_event(p_lcb, AVCT_LCB_LL_CLOSE_EVT, (tAVCT_LCB_EVT *) &result); - } -} - -/******************************************************************************* -** -** Function avct_lcb_unbind_disc -** -** Description Deallocate ccb and call callback with disconnect event. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_unbind_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - avct_ccb_dealloc(p_data->p_ccb, AVCT_DISCONNECT_CFM_EVT, 0, NULL); -} - -/******************************************************************************* -** -** Function avct_lcb_open_ind -** -** Description Handle an LL_OPEN event. For each allocated ccb already -** bound to this lcb, send a connect event. For each -** unbound ccb with a new PID, bind that ccb to this lcb and -** send a connect event. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_open_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - BOOLEAN bind = FALSE; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - /* if ccb allocated and */ - if (p_ccb->allocated) - { - /* if bound to this lcb send connect confirm event */ - if (p_ccb->p_lcb == p_lcb) - { - bind = TRUE; - L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH); - p_ccb->cc.p_ctrl_cback(avct_ccb_to_idx(p_ccb), AVCT_CONNECT_CFM_EVT, - 0, p_lcb->peer_addr); - } - /* if unbound acceptor and lcb doesn't already have a ccb for this PID */ - else if ((p_ccb->p_lcb == NULL) && (p_ccb->cc.role == AVCT_ACP) && - (avct_lcb_has_pid(p_lcb, p_ccb->cc.pid) == NULL)) - { - /* bind ccb to lcb and send connect ind event */ - bind = TRUE; - p_ccb->p_lcb = p_lcb; - L2CA_SetTxPriority(p_lcb->ch_lcid, L2CAP_CHNL_PRIORITY_HIGH); - p_ccb->cc.p_ctrl_cback(avct_ccb_to_idx(p_ccb), AVCT_CONNECT_IND_EVT, - 0, p_lcb->peer_addr); - } - } - } - - /* if no ccbs bound to this lcb, disconnect */ - if (bind == FALSE) - { - avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data); - } -} - -/******************************************************************************* -** -** Function avct_lcb_open_fail -** -** Description L2CAP channel open attempt failed. Deallocate any ccbs -** on this lcb and send connect confirm event with failure. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_open_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) - { - avct_ccb_dealloc(p_ccb, AVCT_CONNECT_CFM_EVT, - p_data->result, p_lcb->peer_addr); - } - } -} - -/******************************************************************************* -** -** Function avct_lcb_close_ind -** -** Description L2CAP channel closed by peer. Deallocate any initiator -** ccbs on this lcb and send disconnect ind event. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_close_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) - { - if (p_ccb->cc.role == AVCT_INT) - { - avct_ccb_dealloc(p_ccb, AVCT_DISCONNECT_IND_EVT, - 0, p_lcb->peer_addr); - } - else - { - p_ccb->p_lcb = NULL; - (*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), AVCT_DISCONNECT_IND_EVT, - 0, p_lcb->peer_addr); - } - } - } -} - -/******************************************************************************* -** -** Function avct_lcb_close_cfm -** -** Description L2CAP channel closed by us. Deallocate any initiator -** ccbs on this lcb and send disconnect ind or cfm event. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_close_cfm(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - UINT8 event; - - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) - { - /* if this ccb initiated close send disconnect cfm otherwise ind */ - if (p_ccb->ch_close) - { - p_ccb->ch_close = FALSE; - event = AVCT_DISCONNECT_CFM_EVT; - } - else - { - event = AVCT_DISCONNECT_IND_EVT; - } - - if (p_ccb->cc.role == AVCT_INT) - { - avct_ccb_dealloc(p_ccb, event, p_data->result, p_lcb->peer_addr); - } - else - { - p_ccb->p_lcb = NULL; - (*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), event, - p_data->result, p_lcb->peer_addr); - } - } - } -} - -/******************************************************************************* -** -** Function avct_lcb_bind_conn -** -** Description Bind ccb to lcb and send connect cfm event. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_bind_conn(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - p_data->p_ccb->p_lcb = p_lcb; - (*p_data->p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_data->p_ccb), - AVCT_CONNECT_CFM_EVT, 0, p_lcb->peer_addr); -} - -/******************************************************************************* -** -** Function avct_lcb_chk_disc -** -** Description A ccb wants to close; if it is the last ccb on this lcb, -** close channel. Otherwise just deallocate and call -** callback. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_chk_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - AVCT_TRACE_WARNING0("avct_lcb_chk_disc"); -#if (AVCT_BROWSE_INCLUDED == TRUE) - avct_close_bcb(p_lcb, p_data); -#endif - if (avct_lcb_last_ccb(p_lcb, p_data->p_ccb)) - { - AVCT_TRACE_WARNING0("closing"); - p_data->p_ccb->ch_close = TRUE; - avct_lcb_event(p_lcb, AVCT_LCB_INT_CLOSE_EVT, p_data); - } - else - { - AVCT_TRACE_WARNING0("dealloc ccb"); - avct_lcb_unbind_disc(p_lcb, p_data); - } -} - -/******************************************************************************* -** -** Function avct_lcb_chnl_disc -** -** Description Disconnect L2CAP channel. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_chnl_disc(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - L2CA_DisconnectReq(p_lcb->ch_lcid); -} - -/******************************************************************************* -** -** Function avct_lcb_bind_fail -** -** Description Deallocate ccb and call callback with connect event -** with failure result. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_bind_fail(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - avct_ccb_dealloc(p_data->p_ccb, AVCT_CONNECT_CFM_EVT, AVCT_RESULT_FAIL, NULL); -} - -/******************************************************************************* -** -** Function avct_lcb_cong_ind -** -** Description Handle congestion indication from L2CAP. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_cong_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - tAVCT_CCB *p_ccb = &avct_cb.ccb[0]; - int i; - UINT8 event; - BT_HDR *p_buf; - - /* set event */ - event = (p_data->cong) ? AVCT_CONG_IND_EVT : AVCT_UNCONG_IND_EVT; - p_lcb->cong = p_data->cong; - if (p_lcb->cong == FALSE && GKI_getfirst(&p_lcb->tx_q)) - { - while ( !p_lcb->cong && (p_buf = (BT_HDR *)GKI_dequeue(&p_lcb->tx_q)) != NULL) - { - if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) - { - p_lcb->cong = TRUE; - } - } - } - - /* send event to all ccbs on this lcb */ - for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) - { - if (p_ccb->allocated && (p_ccb->p_lcb == p_lcb)) - { - (*p_ccb->cc.p_ctrl_cback)(avct_ccb_to_idx(p_ccb), event, 0, p_lcb->peer_addr); - } - } -} - -/******************************************************************************* -** -** Function avct_lcb_discard_msg -** -** Description Discard a message sent in from the API. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_discard_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - AVCT_TRACE_WARNING0("Dropping msg"); - - GKI_freebuf(p_data->ul_msg.p_buf); -} - -/******************************************************************************* -** -** Function avct_lcb_send_msg -** -** Description Build and send an AVCTP message. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_send_msg(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - UINT16 curr_msg_len; - UINT8 pkt_type; - UINT8 hdr_len; - BT_HDR *p_buf; - UINT8 *p; - UINT8 nosp = 0; /* number of subsequent packets */ - UINT16 temp; - UINT16 buf_size = p_lcb->peer_mtu + L2CAP_MIN_OFFSET + BT_HDR_SIZE; - - - /* store msg len */ - curr_msg_len = p_data->ul_msg.p_buf->len; - - /* initialize packet type and other stuff */ - if (curr_msg_len <= (p_lcb->peer_mtu - AVCT_HDR_LEN_SINGLE)) - { - pkt_type = AVCT_PKT_TYPE_SINGLE; - } - else - { - pkt_type = AVCT_PKT_TYPE_START; - temp = (curr_msg_len + AVCT_HDR_LEN_START - p_lcb->peer_mtu); - nosp = temp / (p_lcb->peer_mtu - 1) + 1; - if ( (temp % (p_lcb->peer_mtu - 1)) != 0) - nosp++; - } - - /* while we haven't sent all packets */ - while (curr_msg_len != 0) - { - /* set header len */ - hdr_len = avct_lcb_pkt_type_len[pkt_type]; - - /* if remaining msg must be fragmented */ - if (p_data->ul_msg.p_buf->len > (p_lcb->peer_mtu - hdr_len)) - { - /* get a new buffer for fragment we are sending */ - if ((p_buf = (BT_HDR *) GKI_getbuf(buf_size)) == NULL) - { - /* whoops; free original msg buf and bail */ - AVCT_TRACE_ERROR0 ("avct_lcb_send_msg cannot alloc buffer!!"); - GKI_freebuf(p_data->ul_msg.p_buf); - break; - } - - /* copy portion of data from current message to new buffer */ - p_buf->offset = L2CAP_MIN_OFFSET + hdr_len; - p_buf->len = p_lcb->peer_mtu - hdr_len; - - memcpy((UINT8 *)(p_buf + 1) + p_buf->offset, - (UINT8 *)(p_data->ul_msg.p_buf + 1) + p_data->ul_msg.p_buf->offset, p_buf->len); - - p_data->ul_msg.p_buf->offset += p_buf->len; - p_data->ul_msg.p_buf->len -= p_buf->len; - } - else - { - p_buf = p_data->ul_msg.p_buf; - } - - curr_msg_len -= p_buf->len; - - /* set up to build header */ - p_buf->len += hdr_len; - p_buf->offset -= hdr_len; - p = (UINT8 *)(p_buf + 1) + p_buf->offset; - - /* build header */ - AVCT_BLD_HDR(p, p_data->ul_msg.label, pkt_type, p_data->ul_msg.cr); - if (pkt_type == AVCT_PKT_TYPE_START) - { - UINT8_TO_STREAM(p, nosp); - } - if ((pkt_type == AVCT_PKT_TYPE_START) || (pkt_type == AVCT_PKT_TYPE_SINGLE)) - { - UINT16_TO_BE_STREAM(p, p_data->ul_msg.p_ccb->cc.pid); - } - - if (p_lcb->cong == TRUE) - { - GKI_enqueue (&p_lcb->tx_q, p_buf); - } - - /* send message to L2CAP */ - else - { - if (L2CA_DataWrite(p_lcb->ch_lcid, p_buf) == L2CAP_DW_CONGESTED) - { - p_lcb->cong = TRUE; - } - } - - /* update pkt type for next packet */ - if (curr_msg_len > (p_lcb->peer_mtu - AVCT_HDR_LEN_END)) - { - pkt_type = AVCT_PKT_TYPE_CONT; - } - else - { - pkt_type = AVCT_PKT_TYPE_END; - } - } - AVCT_TRACE_DEBUG1 ("avct_lcb_send_msg tx_q_count:%d", p_lcb->tx_q.count); - return; -} - -/******************************************************************************* -** -** Function avct_lcb_free_msg_ind -** -** Description Discard an incoming AVCTP message. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_free_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - if (p_data) - GKI_freebuf(p_data->p_buf); - return; -} - -/******************************************************************************* -** -** Function avct_lcb_msg_ind -** -** Description Handle an incoming AVCTP message. -** -** -** Returns Nothing. -** -*******************************************************************************/ -void avct_lcb_msg_ind(tAVCT_LCB *p_lcb, tAVCT_LCB_EVT *p_data) -{ - UINT8 *p; - UINT8 label, type, cr_ipid; - UINT16 pid; - tAVCT_CCB *p_ccb; - BT_HDR *p_buf; - - /* this p_buf is to be reported through p_msg_cback. The layer_specific - * needs to be set properly to indicate that it is received through - * control channel */ - p_data->p_buf->layer_specific = AVCT_DATA_CTRL; - - /* reassemble message; if no message available (we received a fragment) return */ - if ((p_data->p_buf = avct_lcb_msg_asmbl(p_lcb, p_data->p_buf)) == NULL) - { - return; - } - - p = (UINT8 *)(p_data->p_buf + 1) + p_data->p_buf->offset; - - /* parse header byte */ - AVCT_PRS_HDR(p, label, type, cr_ipid); - - /* check for invalid cr_ipid */ - if (cr_ipid == AVCT_CR_IPID_INVALID) - { - AVCT_TRACE_WARNING1("Invalid cr_ipid", cr_ipid); - GKI_freebuf(p_data->p_buf); - return; - } - - /* parse and lookup PID */ - BE_STREAM_TO_UINT16(pid, p); - if ((p_ccb = avct_lcb_has_pid(p_lcb, pid)) != NULL) - { - /* PID found; send msg up, adjust bt hdr and call msg callback */ - p_data->p_buf->offset += AVCT_HDR_LEN_SINGLE; - p_data->p_buf->len -= AVCT_HDR_LEN_SINGLE; - (*p_ccb->cc.p_msg_cback)(avct_ccb_to_idx(p_ccb), label, cr_ipid, p_data->p_buf); - } - else - { - /* PID not found; drop message */ - AVCT_TRACE_WARNING1("No ccb for PID=%x", pid); - GKI_freebuf(p_data->p_buf); - - /* if command send reject */ - if (cr_ipid == AVCT_CMD) - { - if ((p_buf = (BT_HDR *) GKI_getpoolbuf(AVCT_CMD_POOL_ID)) != NULL) - { - p_buf->len = AVCT_HDR_LEN_SINGLE; - p_buf->offset = AVCT_MSG_OFFSET - AVCT_HDR_LEN_SINGLE; - p = (UINT8 *)(p_buf + 1) + p_buf->offset; - AVCT_BLD_HDR(p, label, AVCT_PKT_TYPE_SINGLE, AVCT_REJ); - UINT16_TO_BE_STREAM(p, pid); - L2CA_DataWrite(p_lcb->ch_lcid, p_buf); - } - } - } -} diff --git a/src/revolution/BTE/stack/l2cap/l2c_api.c b/src/revolution/BTE/stack/l2cap/l2c_api.c index 691d3862a..f2862e25c 100644 --- a/src/revolution/BTE/stack/l2cap/l2c_api.c +++ b/src/revolution/BTE/stack/l2cap/l2c_api.c @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Defined out unused functions for RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation @@ -432,6 +442,7 @@ BOOLEAN L2CA_ErtmConnectRsp (BD_ADDR p_bd_addr, UINT8 id, UINT16 lcid, UINT16 re ** Returns TRUE if configuration sent, else FALSE ** *******************************************************************************/ +#ifndef REVOLUTION BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg) { tL2C_CCB *p_ccb; @@ -471,7 +482,7 @@ BOOLEAN L2CA_ConfigReq (UINT16 cid, tL2CAP_CFG_INFO *p_cfg) return (TRUE); } - +#endif /******************************************************************************* ** @@ -1042,6 +1053,7 @@ BOOLEAN L2CA_SetTxPriority (UINT16 cid, tL2CAP_CHNL_PRIORITY priority) ** Returns TRUE if a valid channel, else FALSE ** *******************************************************************************/ +#ifndef REVOLUTION BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_DATA_RATE rx) { tL2C_CCB *p_ccb; @@ -1063,6 +1075,7 @@ BOOLEAN L2CA_SetChnlDataRate (UINT16 cid, tL2CAP_CHNL_DATA_RATE tx, tL2CAP_CHNL_ return(TRUE); } +#endif /******************************************************************************* ** @@ -1809,4 +1822,3 @@ UINT16 L2CA_FlushChannel (UINT16 lcid, UINT16 num_to_flush) return (num_left); } - diff --git a/src/revolution/BTE/stack/l2cap/l2c_csm.c b/src/revolution/BTE/stack/l2cap/l2c_csm.c index 0d04d8a28..eb1e7120e 100644 --- a/src/revolution/BTE/stack/l2cap/l2c_csm.c +++ b/src/revolution/BTE/stack/l2cap/l2c_csm.c @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Defined out unused functions for RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation @@ -44,7 +54,9 @@ static void l2c_csm_orig_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_dat static void l2c_csm_term_w4_sec_comp (tL2C_CCB *p_ccb, UINT16 event, void *p_data); static void l2c_csm_w4_l2cap_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data); static void l2c_csm_w4_l2ca_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data); +#ifndef REVOLUTION static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data); +#endif static void l2c_csm_open (tL2C_CCB *p_ccb, UINT16 event, void *p_data); static void l2c_csm_w4_l2cap_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data); static void l2c_csm_w4_l2ca_disconnect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_data); @@ -86,9 +98,11 @@ void l2c_csm_execute (tL2C_CCB *p_ccb, UINT16 event, void *p_data) l2c_csm_w4_l2ca_connect_rsp (p_ccb, event, p_data); break; +#ifndef REVOLUTION case CST_CONFIG: l2c_csm_config (p_ccb, event, p_data); break; +#endif case CST_OPEN: l2c_csm_open (p_ccb, event, p_data); @@ -700,6 +714,7 @@ static void l2c_csm_w4_l2ca_connect_rsp (tL2C_CCB *p_ccb, UINT16 event, void *p_ ** Returns void ** *******************************************************************************/ +#ifndef REVOLUTION static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data) { tL2CAP_CFG_INFO *p_cfg = (tL2CAP_CFG_INFO *)p_data; @@ -920,7 +935,7 @@ static void l2c_csm_config (tL2C_CCB *p_ccb, UINT16 event, void *p_data) break; } } - +#endif /******************************************************************************* ** @@ -1329,5 +1344,3 @@ void l2c_enqueue_peer_data (tL2C_CCB *p_ccb, BT_HDR *p_buf) if (p_ccb->p_lcb->link_xmit_quota == 0) l2cb.check_round_robin = TRUE; } - - diff --git a/src/revolution/BTE/stack/l2cap/l2c_fcr.c b/src/revolution/BTE/stack/l2cap/l2c_fcr.c deleted file mode 100644 index ff018c5cb..000000000 --- a/src/revolution/BTE/stack/l2cap/l2c_fcr.c +++ /dev/null @@ -1,2709 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2004-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This file contains the L2CAP 1.2 Flow Control and retransmissions - * functions - * - ******************************************************************************/ - -#include -#include -#include - -#include "gki.h" -#include "bt_types.h" -#include "hcimsgs.h" -#include "l2cdefs.h" -#include "l2c_int.h" -#include "l2c_api.h" -#include "btu.h" -#include "btm_api.h" -#include "btm_int.h" - - -/* Flag passed to retransmit_i_frames() when all packets should be retransmitted */ -#define L2C_FCR_RETX_ALL_PKTS 0xFF - -#if BT_TRACE_VERBOSE == TRUE -static char *SAR_types[] = { "Unsegmented", "Start", "End", "Continuation" }; -static char *SUP_types[] = { "RR", "REJ", "RNR", "SREJ" }; -#endif - -/* Look-up table for the CRC calculation */ -static const unsigned short crctab[256] = { - 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, - 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, - 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, - 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, - 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40, - 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41, - 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, - 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040, - 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240, - 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, - 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, - 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, - 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, - 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40, - 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640, - 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, - 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240, - 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441, - 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, - 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, - 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, - 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, - 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640, - 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041, - 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, - 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440, - 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40, - 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, - 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, - 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, - 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, - 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040, -}; - - -/******************************************************************************* -** Static local functions -*/ -static BOOLEAN process_reqseq (tL2C_CCB *p_ccb, UINT16 ctrl_word); -static void process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word); -static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, BOOLEAN delay_ack); -static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq); -static void prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, BOOLEAN is_retransmission); -static void process_stream_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf); -static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word); - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE -static BOOLEAN l2c_corrupt_the_fcr_packet (tL2C_CCB *p_ccb, BT_HDR *p_buf, - BOOLEAN is_rx, UINT16 ctrl_word); -static BOOLEAN l2c_bypass_sframe_packet (tL2C_CCB *p_ccb); -#endif - -#if (L2CAP_ERTM_STATS == TRUE) -static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked); -#endif - -/******************************************************************************* -** -** Function l2c_fcr_updcrc -** -** Description This function computes the CRC using the look-up table. -** -** Returns CRC -** -*******************************************************************************/ -unsigned short l2c_fcr_updcrc(unsigned short icrc, unsigned char *icp, int icnt) -{ - register unsigned short crc = icrc; - register unsigned char *cp = icp; - register int cnt = icnt; - - while (cnt--) - { - crc = ((crc >> 8) & 0xff) ^ crctab[(crc & 0xff) ^ *cp++]; - } - - return(crc); -} - - -/******************************************************************************* -** -** Function l2c_fcr_tx_get_fcs -** -** Description This function computes the CRC for a frame to be TXed. -** -** Returns CRC -** -*******************************************************************************/ -UINT16 l2c_fcr_tx_get_fcs (BT_HDR *p_buf) -{ - UINT8 *p = ((UINT8 *) (p_buf + 1)) + p_buf->offset; - - return (l2c_fcr_updcrc (L2CAP_FCR_INIT_CRC, p, p_buf->len)); -} - -/******************************************************************************* -** -** Function l2c_fcr_rx_get_fcs -** -** Description This function computes the CRC for a received frame. -** -** Returns CRC -** -*******************************************************************************/ -UINT16 l2c_fcr_rx_get_fcs (BT_HDR *p_buf) -{ - UINT8 *p = ((UINT8 *) (p_buf + 1)) + p_buf->offset; - - /* offset points past the L2CAP header, but the CRC check includes it */ - p -= L2CAP_PKT_OVERHEAD; - - return (l2c_fcr_updcrc (L2CAP_FCR_INIT_CRC, p, p_buf->len + L2CAP_PKT_OVERHEAD)); -} - -/******************************************************************************* -** -** Function l2c_fcr_start_timer -** -** Description This function starts the (monitor or retransmission) timer. -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_start_timer (tL2C_CCB *p_ccb) -{ - UINT32 tout; - - /* The timers which are in milliseconds */ - if (p_ccb->fcrb.wait_ack) - { - tout = (UINT32)p_ccb->our_cfg.fcr.mon_tout; - } - else - { - tout = (UINT32)p_ccb->our_cfg.fcr.rtrans_tout; - } -/* - L2CAP_TRACE_DEBUG4 ("l2c_fcr_start_timer Tout: %u Already Running: %u wait_ack: %u ack_q_count: %u", - tout, p_ccb->timer_entry.in_use, p_ccb->fcrb.wait_ack, p_ccb->fcrb.waiting_for_ack_q.count); -*/ - /* Only start a timer that was not started */ - if (p_ccb->fcrb.mon_retrans_timer.in_use == 0) - btu_start_quick_timer (&p_ccb->fcrb.mon_retrans_timer, BTU_TTYPE_L2CAP_CHNL, tout*QUICK_TIMER_TICKS_PER_SEC/1000); -} - -/******************************************************************************* -** -** Function l2c_fcr_stop_timer -** -** Description This function stops the (monitor or transmission) timer. -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_stop_timer (tL2C_CCB *p_ccb) -{ - if (p_ccb->fcrb.mon_retrans_timer.in_use) - { -/* - L2CAP_TRACE_DEBUG2 ("l2c_fcr_stop_timer wait_ack: %u ack_q_count: %u", - p_ccb->fcrb.wait_ack, p_ccb->fcrb.waiting_for_ack_q.count); -*/ - btu_stop_quick_timer (&p_ccb->fcrb.mon_retrans_timer); - } -} - -/******************************************************************************* -** -** Function l2c_fcr_cleanup -** -** Description This function cleans up the variable used for flow-control/retrans. -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_cleanup (tL2C_CCB *p_ccb) -{ - tL2C_FCRB *p_fcrb = &p_ccb->fcrb; - - l2c_fcr_stop_timer (p_ccb); - - if (p_fcrb->p_rx_sdu) - GKI_freebuf (p_fcrb->p_rx_sdu); - - while (p_fcrb->waiting_for_ack_q.p_first) - GKI_freebuf (GKI_dequeue (&p_fcrb->waiting_for_ack_q)); - - while (p_fcrb->srej_rcv_hold_q.p_first) - GKI_freebuf (GKI_dequeue (&p_fcrb->srej_rcv_hold_q)); - - while (p_fcrb->retrans_q.p_first) - GKI_freebuf (GKI_dequeue (&p_fcrb->retrans_q)); - - btu_stop_quick_timer (&p_fcrb->ack_timer); - btu_stop_quick_timer (&p_ccb->fcrb.mon_retrans_timer); - -#if (L2CAP_ERTM_STATS == TRUE) - if ( (p_ccb->local_cid >= L2CAP_BASE_APPL_CID) && (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) ) - { - UINT32 dur = GKI_get_os_tick_count() - p_ccb->fcrb.connect_tick_count; - char *p_str = (char *)GKI_getbuf(120); - UINT16 i; - UINT32 throughput_avg, ack_delay_avg, ack_q_count_avg; - - dur = GKI_OS_TICKS_TO_MS(dur); - BT_TRACE_2(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "--- L2CAP ERTM Stats for CID: 0x%04x Duration: %08ums", p_ccb->local_cid, dur); - BT_TRACE_4(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "Retransmissions:%08u Times Flow Controlled:%08u Retrans Touts:%08u Ack Touts:%08u", - p_ccb->fcrb.pkts_retransmitted, p_ccb->fcrb.xmit_window_closed, p_ccb->fcrb.retrans_touts, p_ccb->fcrb.xmit_ack_touts); - BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "Times there is less than 2 packets in controller when flow controlled:%08u", p_ccb->fcrb.controller_idle); - BT_TRACE_2(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "max_held_acks:%08u, in_cfg.fcr.tx_win_sz:%08u", p_ccb->fcrb.max_held_acks, p_ccb->peer_cfg.fcr.tx_win_sz ); - if (p_str) - { - sprintf(p_str, "Sent Pkts:%08u Bytes:%10u(%06u/sec) RR:%08u REJ:%08u RNR:%08u SREJ:%08u", - p_ccb->fcrb.ertm_pkt_counts[0], p_ccb->fcrb.ertm_byte_counts[0], - (dur >= 10 ? (p_ccb->fcrb.ertm_byte_counts[0] * 100) / (dur / 10) : 0), - p_ccb->fcrb.s_frames_sent[0], p_ccb->fcrb.s_frames_sent[1], p_ccb->fcrb.s_frames_sent[2], p_ccb->fcrb.s_frames_sent[3]); - - BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, "%s", p_str); - - sprintf(p_str, "Rcvd Pkts:%08u Bytes:%10u(%06u/sec) RR:%08u REJ:%08u RNR:%08u SREJ:%08u", - p_ccb->fcrb.ertm_pkt_counts[1], p_ccb->fcrb.ertm_byte_counts[1], - (dur >= 10 ? (p_ccb->fcrb.ertm_byte_counts[1] * 100) / (dur / 10) : 0), - p_ccb->fcrb.s_frames_rcvd[0], p_ccb->fcrb.s_frames_rcvd[1], p_ccb->fcrb.s_frames_rcvd[2], p_ccb->fcrb.s_frames_rcvd[3]); - - BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, "%s", p_str); - - throughput_avg = 0; - ack_delay_avg = 0; - ack_q_count_avg = 0; - - for (i = 0; i < L2CAP_ERTM_STATS_NUM_AVG; i++ ) - { - if (i == p_ccb->fcrb.ack_delay_avg_index ) - { - BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "[%02u] collecting data ...", i ); - continue; - } - - sprintf(p_str, "[%02u] throughput: %5u, ack_delay avg:%3u, min:%3u, max:%3u, ack_q_count avg:%3u, min:%3u, max:%3u", - i, p_ccb->fcrb.throughput[i], - p_ccb->fcrb.ack_delay_avg[i], p_ccb->fcrb.ack_delay_min[i], p_ccb->fcrb.ack_delay_max[i], - p_ccb->fcrb.ack_q_count_avg[i], p_ccb->fcrb.ack_q_count_min[i], p_ccb->fcrb.ack_q_count_max[i] ); - - BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, "%s", p_str); - - throughput_avg += p_ccb->fcrb.throughput[i]; - ack_delay_avg += p_ccb->fcrb.ack_delay_avg[i]; - ack_q_count_avg += p_ccb->fcrb.ack_q_count_avg[i]; - } - - throughput_avg /= (L2CAP_ERTM_STATS_NUM_AVG - 1); - ack_delay_avg /= (L2CAP_ERTM_STATS_NUM_AVG - 1); - ack_q_count_avg /= (L2CAP_ERTM_STATS_NUM_AVG - 1); - - BT_TRACE_3(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "throughput_avg: %8u (kbytes/sec), ack_delay_avg: %8u ms, ack_q_count_avg: %8u", - throughput_avg, ack_delay_avg, ack_q_count_avg ); - - GKI_freebuf(p_str); - } - - BT_TRACE_0(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, - "---"); - } -#endif - - memset (p_fcrb, 0, sizeof (tL2C_FCRB)); -} - -/******************************************************************************* -** -** Function l2c_fcr_clone_buf -** -** Description This function allocates and copies requested part of a buffer -** at a new-offset. -** -** Returns pointer to new buffer -** -*******************************************************************************/ -BT_HDR *l2c_fcr_clone_buf (BT_HDR *p_buf, UINT16 new_offset, UINT16 no_of_bytes, UINT8 pool) -{ - BT_HDR *p_buf2; - - /* If using the common pool, should be at least 10% free. */ - if ( (pool == HCI_ACL_POOL_ID) && (GKI_poolutilization (pool) > 90) ) - { - L2CAP_TRACE_ERROR1 ("L2CAP - failed to clone buffer on HCI_ACL_POOL_ID Utilization: %u", GKI_poolutilization(pool)); - return (NULL); - } - - if ((p_buf2 = (BT_HDR *)GKI_getpoolbuf(pool)) != NULL) - { - UINT16 pool_buf_size = GKI_get_pool_bufsize (pool); - - /* Make sure buffer fits into buffer pool */ - if ((no_of_bytes + sizeof(BT_HDR) + new_offset) > pool_buf_size) - { - L2CAP_TRACE_ERROR5("##### l2c_fcr_clone_buf (NumBytes %d) -> Exceeds poolsize %d [bytes %d + BT_HDR %d + offset %d]", - (no_of_bytes + sizeof(BT_HDR) + new_offset), - pool_buf_size, no_of_bytes, sizeof(BT_HDR), - new_offset); - - GKI_freebuf(p_buf2); - return (NULL); - } - - p_buf2->offset = new_offset; - p_buf2->len = no_of_bytes; - - memcpy (((UINT8 *)(p_buf2 + 1)) + p_buf2->offset, - ((UINT8 *)(p_buf + 1)) + p_buf->offset, - no_of_bytes); - } - else - { - L2CAP_TRACE_ERROR2 ("L2CAP - failed to clone buffer, Pool: %u Count: %u", pool, GKI_poolfreecount(pool)); - } - - return (p_buf2); -} - -/******************************************************************************* -** -** Function l2c_fcr_is_flow_controlled -** -** Description This function checks if the CCB is flow controlled by peer. -** -** Returns The control word -** -*******************************************************************************/ -BOOLEAN l2c_fcr_is_flow_controlled (tL2C_CCB *p_ccb) -{ - if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) - { - /* Check if remote side flowed us off or the transmit window is full */ - if ( (p_ccb->fcrb.remote_busy == TRUE) - || (p_ccb->fcrb.waiting_for_ack_q.count >= p_ccb->peer_cfg.fcr.tx_win_sz) ) - { -#if (L2CAP_ERTM_STATS == TRUE) - if (p_ccb->xmit_hold_q.count != 0) - { - p_ccb->fcrb.xmit_window_closed++; - - if ((p_ccb->p_lcb->sent_not_acked < 2)&&(l2cb.controller_xmit_window > 0)) - p_ccb->fcrb.controller_idle++; - } -#endif - return (TRUE); - } - } - return (FALSE); -} - -/******************************************************************************* -** -** Function prepare_I_frame -** -** Description This function sets the FCR variables in an I-frame that is -** about to be sent to HCI for transmission. This may be the -** first time the I-frame is sent, or a retransmission -** -** Returns - -** -*******************************************************************************/ -static void prepare_I_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, BOOLEAN is_retransmission) -{ - tL2C_FCRB *p_fcrb = &p_ccb->fcrb; - UINT8 *p; - UINT16 fcs; - UINT16 ctrl_word; - BOOLEAN set_f_bit = p_fcrb->send_f_rsp; - - p_fcrb->send_f_rsp = FALSE; - - if (is_retransmission) - { - /* Get the old control word and clear out the old req_seq and F bits */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; - - STREAM_TO_UINT16 (ctrl_word, p); - - ctrl_word &= ~(L2CAP_FCR_REQ_SEQ_BITS + L2CAP_FCR_F_BIT); - } - else - { - ctrl_word = p_buf->layer_specific & L2CAP_FCR_SEG_BITS; /* SAR bits */ - ctrl_word |= (p_fcrb->next_tx_seq << L2CAP_FCR_TX_SEQ_BITS_SHIFT); /* Tx Seq */ - - p_fcrb->next_tx_seq = (p_fcrb->next_tx_seq + 1) & L2CAP_FCR_SEQ_MODULO; - } - - /* Set the F-bit and reqseq only if using re-transmission mode */ - if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) - { - if (set_f_bit) - ctrl_word |= L2CAP_FCR_F_BIT; - - ctrl_word |= (p_fcrb->next_seq_expected) << L2CAP_FCR_REQ_SEQ_BITS_SHIFT; - - p_fcrb->last_ack_sent = p_ccb->fcrb.next_seq_expected; - - if (p_ccb->fcrb.ack_timer.in_use) - btu_stop_quick_timer (&p_ccb->fcrb.ack_timer); - } - - /* Set the control word */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; - - UINT16_TO_STREAM (p, ctrl_word); - - /* Compute the FCS and add to the end of the buffer if not bypassed */ - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - { - /* length field in l2cap header has to include FCS length */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset; - UINT16_TO_STREAM (p, p_buf->len + L2CAP_FCS_LEN - L2CAP_PKT_OVERHEAD); - - /* Calculate the FCS */ - fcs = l2c_fcr_tx_get_fcs(p_buf); - - /* Point to the end of the buffer and put the FCS there */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset + p_buf->len; - - UINT16_TO_STREAM (p, fcs); - - p_buf->len += L2CAP_FCS_LEN; - } - -#if BT_TRACE_VERBOSE == TRUE - if (is_retransmission) - { - L2CAP_TRACE_EVENT6 ("L2CAP eRTM ReTx I-frame CID: 0x%04x Len: %u SAR: %s TxSeq: %u ReqSeq: %u F: %u", - p_ccb->local_cid, p_buf->len, - SAR_types[(ctrl_word & L2CAP_FCR_SAR_BITS) >> L2CAP_FCR_SAR_BITS_SHIFT], - (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - } - else - { - L2CAP_TRACE_EVENT6 ("L2CAP eRTM Tx I-frame CID: 0x%04x Len: %u SAR: %-12s TxSeq: %u ReqSeq: %u F: %u", - p_ccb->local_cid, p_buf->len, - SAR_types[(ctrl_word & L2CAP_FCR_SAR_BITS) >> L2CAP_FCR_SAR_BITS_SHIFT], - (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - } -#endif - - /* Start the retransmission timer if not already running */ - if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) - l2c_fcr_start_timer (p_ccb); -} - -/******************************************************************************* -** -** Function l2c_fcr_send_S_frame -** -** Description This function formats and sends an S-frame for transmission. -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_send_S_frame (tL2C_CCB *p_ccb, UINT16 function_code, UINT16 pf_bit) -{ - BT_HDR *p_buf; - UINT8 *p; - UINT16 ctrl_word; - UINT16 fcs; - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE - /* Only used for conformance testing */ - if (l2c_bypass_sframe_packet (p_ccb)) - return; -#endif - - if ((!p_ccb->in_use) || (p_ccb->chnl_state != CST_OPEN)) - return; - -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.s_frames_sent[function_code]++; -#endif - - if (pf_bit == L2CAP_FCR_P_BIT) - { - p_ccb->fcrb.wait_ack = TRUE; - - l2c_fcr_stop_timer (p_ccb); /* Restart the monitor timer */ - l2c_fcr_start_timer (p_ccb); - } - - /* Create the control word to use */ - ctrl_word = (function_code << L2CAP_FCR_SUP_SHIFT) | L2CAP_FCR_S_FRAME_BIT; - ctrl_word |= (p_ccb->fcrb.next_seq_expected << L2CAP_FCR_REQ_SEQ_BITS_SHIFT); - ctrl_word |= pf_bit; - - if ((p_buf = (BT_HDR *)GKI_getpoolbuf (L2CAP_CMD_POOL_ID)) != NULL) - { - p_buf->offset = HCI_DATA_PREAMBLE_SIZE; - p_buf->len = L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD; - - /* Set the pointer to the beginning of the data */ - p = (UINT8 *)(p_buf + 1) + p_buf->offset; - - /* Put in the L2CAP header */ - UINT16_TO_STREAM (p, L2CAP_FCR_OVERHEAD + L2CAP_FCS_LEN); - UINT16_TO_STREAM (p, p_ccb->remote_cid); - UINT16_TO_STREAM (p, ctrl_word); - - /* Compute the FCS and add to the end of the buffer if not bypassed */ - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - { - fcs = l2c_fcr_tx_get_fcs (p_buf); - - UINT16_TO_STREAM (p, fcs); - p_buf->len += L2CAP_FCS_LEN; - } - else /* rewrite the length without FCS length */ - { - p -= 6; - UINT16_TO_STREAM (p, L2CAP_FCR_OVERHEAD); - } - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE - /* Get out if packet was dropped */ - if (l2c_corrupt_the_fcr_packet (p_ccb, p_buf, FALSE, ctrl_word)) - return; -#endif - /* Now, the HCI transport header */ - p_buf->layer_specific = L2CAP_NON_FLUSHABLE_PKT; - l2cu_set_acl_hci_header (p_buf, p_ccb); - -#if BT_TRACE_VERBOSE == TRUE - if ((((ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT) == 1) - || (((ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT) == 3)) - { - L2CAP_TRACE_WARNING6 ("L2CAP eRTM Tx S-frame CID: 0x%04x ctrlword: 0x%04x Type: %s ReqSeq: %u P: %u F: %u", - p_ccb->local_cid, ctrl_word, - SUP_types[(ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT], - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_P_BIT) >> L2CAP_FCR_P_BIT_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - L2CAP_TRACE_WARNING1 (" Buf Len: %u", p_buf->len); - } - else - { - L2CAP_TRACE_EVENT6 ("L2CAP eRTM Tx S-frame CID: 0x%04x ctrlword: 0x%04x Type: %s ReqSeq: %u P: %u F: %u", - p_ccb->local_cid, ctrl_word, - SUP_types[(ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT], - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_P_BIT) >> L2CAP_FCR_P_BIT_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - L2CAP_TRACE_EVENT1 (" Buf Len: %u", p_buf->len); - } -#endif /* BT_TRACE_VERBOSE */ - - l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, p_buf); - - p_ccb->fcrb.last_ack_sent = p_ccb->fcrb.next_seq_expected; - - if (p_ccb->fcrb.ack_timer.in_use) - btu_stop_quick_timer (&p_ccb->fcrb.ack_timer); - } - else - { - L2CAP_TRACE_ERROR2 ("l2c_fcr_send_S_frame(No Resources) cid 0x%04x, Type: 0x%4x", - p_ccb->local_cid, function_code); - } -} - - -/******************************************************************************* -** -** Function l2c_fcr_proc_pdu -** -** Description This function is the entry point for processing of a -** received PDU when in flow control and/or retransmission modes. -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_proc_pdu (tL2C_CCB *p_ccb, BT_HDR *p_buf) -{ - UINT8 *p; - UINT16 fcs; - UINT16 min_pdu_len; - UINT16 ctrl_word; - - /* Check the length */ - min_pdu_len = (p_ccb->bypass_fcs == L2CAP_BYPASS_FCS) ? - (UINT16)L2CAP_FCR_OVERHEAD : (UINT16)(L2CAP_FCS_LEN + L2CAP_FCR_OVERHEAD); - - if (p_buf->len < min_pdu_len) - { - L2CAP_TRACE_WARNING2 ("Rx L2CAP PDU: CID: 0x%04x Len too short: %u", p_ccb->local_cid, p_buf->len); - GKI_freebuf (p_buf); - return; - } - - if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_STREAM_MODE) - { - process_stream_frame (p_ccb, p_buf); - return; - } - -#if BT_TRACE_VERBOSE == TRUE - /* Get the control word */ - p = ((UINT8 *)(p_buf+1)) + p_buf->offset; - STREAM_TO_UINT16 (ctrl_word, p); - - if (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - { - if ((((ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT) == 1) - || (((ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT) == 3)) - { - /* REJ or SREJ */ - L2CAP_TRACE_WARNING6 ("L2CAP eRTM Rx S-frame: cid: 0x%04x Len: %u Type: %s ReqSeq: %u P: %u F: %u", - p_ccb->local_cid, p_buf->len, - SUP_types[(ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT], - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_P_BIT) >> L2CAP_FCR_P_BIT_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - } - else - { - L2CAP_TRACE_EVENT6 ("L2CAP eRTM Rx S-frame: cid: 0x%04x Len: %u Type: %s ReqSeq: %u P: %u F: %u", - p_ccb->local_cid, p_buf->len, - SUP_types[(ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT], - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_P_BIT) >> L2CAP_FCR_P_BIT_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - } - } - else - { - L2CAP_TRACE_EVENT6 ("L2CAP eRTM Rx I-frame: cid: 0x%04x Len: %u SAR: %-12s TxSeq: %u ReqSeq: %u F: %u", - p_ccb->local_cid, p_buf->len, - SAR_types[(ctrl_word & L2CAP_FCR_SAR_BITS) >> L2CAP_FCR_SAR_BITS_SHIFT], - (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); - } - - L2CAP_TRACE_EVENT6 (" eRTM Rx Nxt_tx_seq %u, Lst_rx_ack %u, Nxt_seq_exp %u, Lst_ack_snt %u, wt_q.cnt %u, tries %u", - p_ccb->fcrb.next_tx_seq, p_ccb->fcrb.last_rx_ack, p_ccb->fcrb.next_seq_expected, - p_ccb->fcrb.last_ack_sent, p_ccb->fcrb.waiting_for_ack_q.count, p_ccb->fcrb.num_tries); - -#endif /* BT_TRACE_VERBOSE */ - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE - p = ((UINT8 *)(p_buf+1)) + p_buf->offset; - STREAM_TO_UINT16 (ctrl_word, p); - - /* Get out if packet was dropped */ - if (l2c_corrupt_the_fcr_packet (p_ccb, p_buf, TRUE, ctrl_word)) - return; -#endif /* L2CAP_CORRUPT_ERTM_PKTS */ - - /* Verify FCS if using */ - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - { - p = ((UINT8 *)(p_buf+1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN; - - /* Extract and drop the FCS from the packet */ - STREAM_TO_UINT16 (fcs, p); - p_buf->len -= L2CAP_FCS_LEN; - - if (l2c_fcr_rx_get_fcs(p_buf) != fcs) - { - L2CAP_TRACE_WARNING1 ("Rx L2CAP PDU: CID: 0x%04x BAD FCS", p_ccb->local_cid); - GKI_freebuf(p_buf); - return; - } - } - - /* Get the control word */ - p = ((UINT8 *)(p_buf+1)) + p_buf->offset; - - STREAM_TO_UINT16 (ctrl_word, p); - - p_buf->len -= L2CAP_FCR_OVERHEAD; - p_buf->offset += L2CAP_FCR_OVERHEAD; - - /* If we had a poll bit outstanding, check if we got a final response */ - if (p_ccb->fcrb.wait_ack) - { - /* If final bit not set, ignore the frame unless it is a polled S-frame */ - if ( !(ctrl_word & L2CAP_FCR_F_BIT) ) - { - if ( (ctrl_word & L2CAP_FCR_P_BIT) && (ctrl_word & L2CAP_FCR_S_FRAME_BIT) ) - { - if (p_ccb->fcrb.srej_sent) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT); - else if (p_ccb->fcrb.local_busy) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_F_BIT); - else - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT); - - /* Got a poll while in wait_ack state, so re-start our timer with 1-second */ - /* This is a small optimization... the monitor timer is 12 secs, but we saw */ - /* that if the other side sends us a poll when we are waiting for a final, */ - /* then it speeds up recovery significantly if we poll him back soon after his poll. */ - btu_start_quick_timer (&p_ccb->fcrb.mon_retrans_timer, BTU_TTYPE_L2CAP_CHNL, QUICK_TIMER_TICKS_PER_SEC); - } - GKI_freebuf (p_buf); - return; - } - - p_ccb->fcrb.wait_ack = FALSE; - - /* P and F are mutually exclusive */ - if (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - ctrl_word &= ~L2CAP_FCR_P_BIT; - - if (p_ccb->fcrb.waiting_for_ack_q.count == 0) - p_ccb->fcrb.num_tries = 0; - - l2c_fcr_stop_timer (p_ccb); - } - else - { - /* Otherwise, ensure the final bit is ignored */ - ctrl_word &= ~L2CAP_FCR_F_BIT; - } - - /* Process receive sequence number */ - if (!process_reqseq (p_ccb, ctrl_word)) - { - GKI_freebuf (p_buf); - return; - } - - /* Process based on whether it is an S-frame or an I-frame */ - if (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - process_s_frame (p_ccb, p_buf, ctrl_word); - else - process_i_frame (p_ccb, p_buf, ctrl_word, FALSE); - - /* Return if the channel got disconnected by a bad packet or max retransmissions */ - if ( (!p_ccb->in_use) || (p_ccb->chnl_state != CST_OPEN) ) - return; - - /* If we have some buffers held while doing SREJ, and SREJ has cleared, process them now */ - if ( (!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.srej_sent) && (p_ccb->fcrb.srej_rcv_hold_q.count > 0) ) - { - BUFFER_Q temp_q = p_ccb->fcrb.srej_rcv_hold_q; - - GKI_init_q (&p_ccb->fcrb.srej_rcv_hold_q); - - while ((p_buf = (BT_HDR *)GKI_dequeue (&temp_q)) != NULL) - { - if (p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) - { - /* Get the control word */ - p = ((UINT8 *)(p_buf+1)) + p_buf->offset - L2CAP_FCR_OVERHEAD; - - STREAM_TO_UINT16 (ctrl_word, p); - - L2CAP_TRACE_DEBUG3 ("l2c_fcr_proc_pdu() CID: 0x%04x Process Buffer from SREJ_Hold_Q TxSeq: %u Expected_Seq: %u", - p_ccb->local_cid, (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT, - p_ccb->fcrb.next_seq_expected); - - /* Process the SREJ held I-frame, but do not send an RR for each individual frame */ - process_i_frame (p_ccb, p_buf, ctrl_word, TRUE); - } - else - GKI_freebuf (p_buf); - - /* If more frames were lost during SREJ, send a REJ */ - if (p_ccb->fcrb.rej_after_srej) - { - p_ccb->fcrb.rej_after_srej = FALSE; - p_ccb->fcrb.rej_sent = TRUE; - - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_REJ, 0); - } - } - - /* Now, if needed, send one RR for the whole held queue */ - if ( (!p_ccb->fcrb.local_busy) && (!p_ccb->fcrb.rej_sent) && (!p_ccb->fcrb.srej_sent) - && (p_ccb->fcrb.next_seq_expected != p_ccb->fcrb.last_ack_sent) ) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, 0); - else - { - L2CAP_TRACE_DEBUG6 ("l2c_fcr_proc_pdu() not sending RR CID: 0x%04x local_busy:%d rej_sent:%d srej_sent:%d Expected_Seq:%u Last_Ack:%u", - p_ccb->local_cid, p_ccb->fcrb.local_busy, p_ccb->fcrb.rej_sent, p_ccb->fcrb.srej_sent, p_ccb->fcrb.next_seq_expected, - p_ccb->fcrb.last_ack_sent); - } - } - - /* If a window has opened, check if we can send any more packets */ - if ( (p_ccb->fcrb.retrans_q.count || p_ccb->xmit_hold_q.count) - && (p_ccb->fcrb.wait_ack == FALSE) - && (l2c_fcr_is_flow_controlled (p_ccb) == FALSE) ) - { - l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL); - } -} - -/******************************************************************************* -** -** Function l2c_fcr_proc_tout -** -** Description Handle a timeout. We should be in error recovery state. -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_proc_tout (tL2C_CCB *p_ccb) -{ - L2CAP_TRACE_DEBUG5 ("l2c_fcr_proc_tout: CID: 0x%04x num_tries: %u (max: %u) wait_ack: %u ack_q_count: %u", - p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, - p_ccb->fcrb.wait_ack, p_ccb->fcrb.waiting_for_ack_q.count); - -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.retrans_touts++; -#endif - - if ( (p_ccb->peer_cfg.fcr.max_transmit != 0) && (++p_ccb->fcrb.num_tries > p_ccb->peer_cfg.fcr.max_transmit) ) - { - l2cu_disconnect_chnl (p_ccb); - } - else - { - if (!p_ccb->fcrb.srej_sent && !p_ccb->fcrb.rej_sent) - { - if (p_ccb->fcrb.local_busy) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_P_BIT); - else - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_P_BIT); - } - } -} - - -/******************************************************************************* -** -** Function l2c_fcr_proc_ack_tout -** -** Description Send RR/RNR if we have not acked I frame -** -** Returns - -** -*******************************************************************************/ -void l2c_fcr_proc_ack_tout (tL2C_CCB *p_ccb) -{ - L2CAP_TRACE_DEBUG5 ("l2c_fcr_proc_ack_tout: CID: 0x%04x State: %u Wack:%u Rq:%d Acked:%d", p_ccb->local_cid, - p_ccb->chnl_state, p_ccb->fcrb.wait_ack, p_ccb->fcrb.next_seq_expected, p_ccb->fcrb.last_ack_sent); - - if ( (p_ccb->chnl_state == CST_OPEN) && (!p_ccb->fcrb.wait_ack) - && (p_ccb->fcrb.last_ack_sent != p_ccb->fcrb.next_seq_expected) ) - { -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.xmit_ack_touts++; -#endif - if (p_ccb->fcrb.local_busy) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, 0); - else - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, 0); - } -} - - -/******************************************************************************* -** -** Function process_reqseq -** -** Description Handle receive sequence number -** -** Returns - -** -*******************************************************************************/ -static BOOLEAN process_reqseq (tL2C_CCB *p_ccb, UINT16 ctrl_word) -{ - tL2C_FCRB *p_fcrb = &p_ccb->fcrb; - UINT8 req_seq, num_bufs_acked, xx; - UINT16 ls; - UINT16 full_sdus_xmitted; - - /* Receive sequence number does not ack anything for SREJ with P-bit set to zero */ - if ( (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - && ((ctrl_word & L2CAP_FCR_SUP_BITS) == (L2CAP_FCR_SUP_SREJ << L2CAP_FCR_SUP_SHIFT)) - && ((ctrl_word & L2CAP_FCR_P_BIT) == 0) ) - { - /* If anything still waiting for ack, restart the timer if it was stopped */ - if (p_fcrb->waiting_for_ack_q.count) - l2c_fcr_start_timer (p_ccb); - - return (TRUE); - } - - /* Extract the receive sequence number from the control word */ - req_seq = (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT; - - num_bufs_acked = (req_seq - p_fcrb->last_rx_ack) & L2CAP_FCR_SEQ_MODULO; - - /* Verify the request sequence is in range before proceeding */ - if (num_bufs_acked > p_fcrb->waiting_for_ack_q.count) - { - /* The channel is closed if ReqSeq is not in range */ - L2CAP_TRACE_WARNING4 ("L2CAP eRTM Frame BAD Req_Seq - ctrl_word: 0x%04x req_seq 0x%02x last_rx_ack: 0x%02x QCount: %u", - ctrl_word, req_seq, p_fcrb->last_rx_ack, p_fcrb->waiting_for_ack_q.count); - - l2cu_disconnect_chnl (p_ccb); - return (FALSE); - } - -/* - L2CAP_TRACE_DEBUG3 ("L2CAP process_reqseq 0x%02x last_rx_ack: 0x%02x QCount: %u", - req_seq, p_fcrb->last_rx_ack, p_fcrb->waiting_for_ack_q.count); -*/ - p_fcrb->last_rx_ack = req_seq; - - /* Now we can release all acknowledged frames, and restart the retransmission timer if needed */ - if (num_bufs_acked != 0) - { - p_fcrb->num_tries = 0; - full_sdus_xmitted = 0; - -#if (L2CAP_ERTM_STATS == TRUE) - l2c_fcr_collect_ack_delay (p_ccb, num_bufs_acked); -#endif - - for (xx = 0; xx < num_bufs_acked; xx++) - { - ls = ((BT_HDR *)(p_fcrb->waiting_for_ack_q.p_first))->layer_specific & L2CAP_FCR_SAR_BITS; - - if ( (ls == L2CAP_FCR_UNSEG_SDU) || (ls == L2CAP_FCR_END_SDU) ) - full_sdus_xmitted++; - - GKI_freebuf (GKI_dequeue (&p_fcrb->waiting_for_ack_q)); - } - - /* If we are still in a wait_ack state, do not mess with the timer */ - if (!p_ccb->fcrb.wait_ack) - l2c_fcr_stop_timer (p_ccb); - - /* Check if we need to call the "packet_sent" callback */ - if ( (p_ccb->p_rcb) && (p_ccb->p_rcb->api.pL2CA_TxComplete_Cb) && (full_sdus_xmitted) ) - { - /* Special case for eRTM, if all packets sent, send 0xFFFF */ - if ( (p_fcrb->waiting_for_ack_q.count == 0) && (p_ccb->xmit_hold_q.count == 0) ) - full_sdus_xmitted = 0xFFFF; - - (*p_ccb->p_rcb->api.pL2CA_TxComplete_Cb)(p_ccb->local_cid, full_sdus_xmitted); - } - } - - /* If anything still waiting for ack, restart the timer if it was stopped */ - if (p_fcrb->waiting_for_ack_q.count) - l2c_fcr_start_timer (p_ccb); - - return (TRUE); -} - - -/******************************************************************************* -** -** Function process_s_frame -** -** Description Process an S frame -** -** Returns - -** -*******************************************************************************/ -static void process_s_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word) -{ - tL2C_FCRB *p_fcrb = &p_ccb->fcrb; - UINT16 s_frame_type = (ctrl_word & L2CAP_FCR_SUP_BITS) >> L2CAP_FCR_SUP_SHIFT; - BOOLEAN remote_was_busy; - BOOLEAN all_ok = TRUE; - - if (p_buf->len != 0) - { - L2CAP_TRACE_WARNING1 ("Incorrect S-frame Length (%d)", p_buf->len); - } - - L2CAP_TRACE_DEBUG2 ("process_s_frame ctrl_word 0x%04x fcrb_remote_busy:%d", ctrl_word, p_fcrb->remote_busy); - -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.s_frames_rcvd[s_frame_type]++; -#endif - - if (ctrl_word & L2CAP_FCR_P_BIT) - { - p_fcrb->rej_sent = FALSE; /* After checkpoint, we can send anoher REJ */ - p_fcrb->send_f_rsp = TRUE; /* Set a flag in case an I-frame is pending */ - } - - switch (s_frame_type) - { - case L2CAP_FCR_SUP_RR: - remote_was_busy = p_fcrb->remote_busy; - p_fcrb->remote_busy = FALSE; - - if ( (ctrl_word & L2CAP_FCR_F_BIT) || (remote_was_busy) ) - all_ok = retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS); - break; - - case L2CAP_FCR_SUP_REJ: - p_fcrb->remote_busy = FALSE; - all_ok = retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS); - break; - - case L2CAP_FCR_SUP_RNR: - p_fcrb->remote_busy = TRUE; - l2c_fcr_stop_timer (p_ccb); - break; - - case L2CAP_FCR_SUP_SREJ: - p_fcrb->remote_busy = FALSE; - all_ok = retransmit_i_frames (p_ccb, (UINT8)((ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT)); - break; - } - - if (all_ok) - { - /* If polled, we need to respond with F-bit. Note, we may have sent a I-frame with the F-bit */ - if (p_fcrb->send_f_rsp) - { - if (p_fcrb->srej_sent) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, L2CAP_FCR_F_BIT); - else if (p_fcrb->local_busy) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, L2CAP_FCR_F_BIT); - else - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, L2CAP_FCR_F_BIT); - - p_fcrb->send_f_rsp = FALSE; - } - } - else - { - L2CAP_TRACE_DEBUG0 ("process_s_frame hit_max_retries"); - } - - GKI_freebuf (p_buf); -} - - -/******************************************************************************* -** -** Function process_i_frame -** -** Description Process an I frame -** -** Returns - -** -*******************************************************************************/ -static void process_i_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word, BOOLEAN delay_ack) -{ - tL2C_FCRB *p_fcrb = &p_ccb->fcrb; - UINT8 tx_seq, num_lost, num_to_ack, next_srej; - - /* If we were doing checkpoint recovery, first retransmit all unacked I-frames */ - if (ctrl_word & L2CAP_FCR_F_BIT) - { - if (!retransmit_i_frames (p_ccb, L2C_FCR_RETX_ALL_PKTS)) - { - GKI_freebuf(p_buf); - return; - } - } - -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.ertm_pkt_counts[1]++; - p_ccb->fcrb.ertm_byte_counts[1] += p_buf->len; -#endif - - /* Extract the sequence number */ - tx_seq = (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT; - - /* If we have flow controlled the peer, ignore any bad I-frames from him */ - if ( (tx_seq != p_fcrb->next_seq_expected) && (p_fcrb->local_busy) ) - { - L2CAP_TRACE_WARNING1 ("Dropping bad I-Frame since we flowed off, tx_seq:%u", tx_seq); - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, 0); - GKI_freebuf(p_buf); - return; - } - - /* If there are no free buffers in the user Rx queue, drop the */ - /* received buffer now before we update any sequence numbers */ - if (GKI_poolfreecount (p_ccb->ertm_info.user_rx_pool_id) == 0) - { - L2CAP_TRACE_WARNING4 ("L2CAP CID: 0x%04x Dropping I-Frame seq: %u User RX Pool: %u (Size: %u) has no free buffers!!", - p_ccb->local_cid, tx_seq, p_ccb->ertm_info.user_rx_pool_id, - GKI_poolcount (p_ccb->ertm_info.user_rx_pool_id)); - GKI_freebuf(p_buf); - return; - } - - /* Check if tx-sequence is the expected one */ - if (tx_seq != p_fcrb->next_seq_expected) - { - num_lost = (tx_seq - p_fcrb->next_seq_expected) & L2CAP_FCR_SEQ_MODULO; - - /* Is the frame a duplicate ? If so, just drop it */ - if (num_lost >= p_ccb->our_cfg.fcr.tx_win_sz) - { - /* Duplicate - simply drop it */ - L2CAP_TRACE_WARNING2 ("process_i_frame() Dropping Duplicate Frame tx_seq:%u ExpectedTxSeq %u", tx_seq, p_fcrb->next_seq_expected); - GKI_freebuf(p_buf); - } - else - { - L2CAP_TRACE_WARNING6 ("process_i_frame() CID: 0x%04x Lost: %u tx_seq:%u ExpTxSeq %u Rej: %u SRej: %u", - p_ccb->local_cid, num_lost, tx_seq, p_fcrb->next_seq_expected, p_fcrb->rej_sent, p_fcrb->srej_sent); - - if (p_fcrb->srej_sent) - { - /* If SREJ sent, save the frame for later processing as long as it is in sequence */ - next_srej = (((BT_HDR *)p_fcrb->srej_rcv_hold_q.p_last)->layer_specific + 1) & L2CAP_FCR_SEQ_MODULO; - - if ( (tx_seq == next_srej) && (p_fcrb->srej_rcv_hold_q.count < p_ccb->our_cfg.fcr.tx_win_sz) ) - { - /* If user gave us a pool for held rx buffers, use that */ - if (p_ccb->ertm_info.fcr_rx_pool_id != HCI_ACL_POOL_ID) - { - BT_HDR *p_buf2; - - /* Adjust offset and len so that control word is copied */ - p_buf->offset -= L2CAP_FCR_OVERHEAD; - p_buf->len += L2CAP_FCR_OVERHEAD; - - p_buf2 = l2c_fcr_clone_buf (p_buf, p_buf->offset, p_buf->len, p_ccb->ertm_info.fcr_rx_pool_id); - - if (p_buf2) - { - GKI_freebuf (p_buf); - p_buf = p_buf2; - } - p_buf->offset += L2CAP_FCR_OVERHEAD; - p_buf->len -= L2CAP_FCR_OVERHEAD; - } - L2CAP_TRACE_DEBUG4 ("process_i_frame() Lost: %u tx_seq:%u ExpTxSeq %u Rej: %u SRej1", - num_lost, tx_seq, p_fcrb->next_seq_expected, p_fcrb->rej_sent); - - p_buf->layer_specific = tx_seq; - GKI_enqueue (&p_fcrb->srej_rcv_hold_q, p_buf); - } - else - { - L2CAP_TRACE_WARNING4 ("process_i_frame() CID: 0x%04x frame dropped in Srej Sent next_srej:%u hold_q.count:%u win_sz:%u", - p_ccb->local_cid, next_srej, p_fcrb->srej_rcv_hold_q.count, p_ccb->our_cfg.fcr.tx_win_sz); - - p_fcrb->rej_after_srej = TRUE; - GKI_freebuf (p_buf); - } - } - else if (p_fcrb->rej_sent) - { - L2CAP_TRACE_WARNING5 ("process_i_frame() CID: 0x%04x Lost: %u tx_seq:%u ExpTxSeq %u Rej: 1 SRej: %u", - p_ccb->local_cid, num_lost, tx_seq, p_fcrb->next_seq_expected, p_fcrb->srej_sent); - - /* If REJ sent, just drop the frame */ - GKI_freebuf (p_buf); - } - else - { - L2CAP_TRACE_DEBUG4 ("process_i_frame() CID: 0x%04x tx_seq:%u ExpTxSeq %u Rej: %u", - p_ccb->local_cid, tx_seq, p_fcrb->next_seq_expected, p_fcrb->rej_sent); - - /* If only one lost, we will send SREJ, otherwise we will send REJ */ - if (num_lost > 1) - { - GKI_freebuf (p_buf); - p_fcrb->rej_sent = TRUE; - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_REJ, 0); - } - else - { - if (p_fcrb->srej_rcv_hold_q.count != 0) - { - L2CAP_TRACE_ERROR3 ("process_i_frame() CID: 0x%04x sending SREJ tx_seq:%d hold_q.count:%u", - p_ccb->local_cid, tx_seq, p_fcrb->srej_rcv_hold_q.count); - } - p_buf->layer_specific = tx_seq; - GKI_enqueue (&p_fcrb->srej_rcv_hold_q, p_buf); - p_fcrb->srej_sent = TRUE; - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_SREJ, 0); - } - btu_stop_quick_timer (&p_ccb->fcrb.ack_timer); - } - } - return; - } - - /* Seq number is the next expected. Clear possible reject exception in case it occured */ - p_fcrb->rej_sent = p_fcrb->srej_sent = FALSE; - - /* Adjust the next_seq, so that if the upper layer sends more data in the callback - context, the received frame is acked by an I-frame. */ - p_fcrb->next_seq_expected = (tx_seq + 1) & L2CAP_FCR_SEQ_MODULO; - - /* If any SAR problem in eRTM mode, spec says disconnect. */ - if (!do_sar_reassembly (p_ccb, p_buf, ctrl_word)) - { - L2CAP_TRACE_WARNING1 ("process_i_frame() CID: 0x%04x reassembly failed", p_ccb->local_cid); - l2cu_disconnect_chnl (p_ccb); - return; - } - - /* RR optimization - if peer can still send us more, then start an ACK timer */ - num_to_ack = (p_fcrb->next_seq_expected - p_fcrb->last_ack_sent) & L2CAP_FCR_SEQ_MODULO; - - if ( (num_to_ack < p_ccb->fcrb.max_held_acks) && (!p_fcrb->local_busy) ) - delay_ack = TRUE; - - /* We should neve never ack frame if we are not in OPEN state */ - if ((num_to_ack != 0) && p_ccb->in_use && (p_ccb->chnl_state == CST_OPEN)) - { - /* If no frames are awaiting transmission or are held, send an RR or RNR S-frame for ack */ - if (delay_ack) - { - /* If it is the first I frame we did not ack, start ack timer */ - if (!p_ccb->fcrb.ack_timer.in_use) - { - btu_start_quick_timer (&p_ccb->fcrb.ack_timer, BTU_TTYPE_L2CAP_FCR_ACK, - (L2CAP_FCR_ACK_TOUT*QUICK_TIMER_TICKS_PER_SEC)/1000); - } - } - else if ( ((p_ccb->xmit_hold_q.count == 0) || (l2c_fcr_is_flow_controlled (p_ccb))) - && (p_ccb->fcrb.srej_rcv_hold_q.count == 0) ) - { - if (p_fcrb->local_busy) - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RNR, 0); - else - l2c_fcr_send_S_frame (p_ccb, L2CAP_FCR_SUP_RR, 0); - } - } -} - - -/******************************************************************************* -** -** Function process_stream_frame -** -** Description This function processes frames in streaming mode -** -** Returns - -** -*******************************************************************************/ -static void process_stream_frame (tL2C_CCB *p_ccb, BT_HDR *p_buf) -{ - UINT16 ctrl_word; - UINT16 fcs; - UINT8 *p; - UINT8 tx_seq; - - /* Verify FCS if using */ - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - { - p = ((UINT8 *)(p_buf+1)) + p_buf->offset + p_buf->len - L2CAP_FCS_LEN; - - /* Extract and drop the FCS from the packet */ - STREAM_TO_UINT16 (fcs, p); - p_buf->len -= L2CAP_FCS_LEN; - - if (l2c_fcr_rx_get_fcs(p_buf) != fcs) - { - L2CAP_TRACE_WARNING1 ("Rx L2CAP PDU: CID: 0x%04x BAD FCS", p_ccb->local_cid); - GKI_freebuf(p_buf); - return; - } - } - - /* Get the control word */ - p = ((UINT8 *)(p_buf+1)) + p_buf->offset; - - STREAM_TO_UINT16 (ctrl_word, p); - - p_buf->len -= L2CAP_FCR_OVERHEAD; - p_buf->offset += L2CAP_FCR_OVERHEAD; - - /* Make sure it is an I-frame */ - if (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - { - L2CAP_TRACE_WARNING2 ("Rx L2CAP PDU: CID: 0x%04x BAD S-frame in streaming mode ctrl_word: 0x%04x", p_ccb->local_cid, ctrl_word); - GKI_freebuf (p_buf); - return; - } - -#if BT_TRACE_VERBOSE == TRUE - L2CAP_TRACE_EVENT6 ("L2CAP eRTM Rx I-frame: cid: 0x%04x Len: %u SAR: %-12s TxSeq: %u ReqSeq: %u F: %u", - p_ccb->local_cid, p_buf->len, - SAR_types[(ctrl_word & L2CAP_FCR_SAR_BITS) >> L2CAP_FCR_SAR_BITS_SHIFT], - (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_REQ_SEQ_BITS) >> L2CAP_FCR_REQ_SEQ_BITS_SHIFT, - (ctrl_word & L2CAP_FCR_F_BIT) >> L2CAP_FCR_F_BIT_SHIFT); -#endif - - /* Extract the sequence number */ - tx_seq = (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT; - - /* Check if tx-sequence is the expected one */ - if (tx_seq != p_ccb->fcrb.next_seq_expected) - { - L2CAP_TRACE_WARNING4 ("Rx L2CAP PDU: CID: 0x%04x Lost frames Exp: %u Got: %u p_rx_sdu: 0x%08x", - p_ccb->local_cid, p_ccb->fcrb.next_seq_expected, tx_seq, p_ccb->fcrb.p_rx_sdu); - - /* Lost one or more packets, so flush the SAR queue */ - if (p_ccb->fcrb.p_rx_sdu != NULL) - { - GKI_freebuf (p_ccb->fcrb.p_rx_sdu); - p_ccb->fcrb.p_rx_sdu = NULL; - } - } - - p_ccb->fcrb.next_seq_expected = (tx_seq + 1) & L2CAP_FCR_SEQ_MODULO; - - if (!do_sar_reassembly (p_ccb, p_buf, ctrl_word)) - { - /* Some sort of SAR error, so flush the SAR queue */ - if (p_ccb->fcrb.p_rx_sdu != NULL) - { - GKI_freebuf (p_ccb->fcrb.p_rx_sdu); - p_ccb->fcrb.p_rx_sdu = NULL; - } - } -} - - -/******************************************************************************* -** -** Function do_sar_reassembly -** -** Description Process SAR bits and re-assemble frame -** -** Returns TRUE if all OK, else FALSE -** -*******************************************************************************/ -static BOOLEAN do_sar_reassembly (tL2C_CCB *p_ccb, BT_HDR *p_buf, UINT16 ctrl_word) -{ - tL2C_FCRB *p_fcrb = &p_ccb->fcrb; - UINT16 sar_type = ctrl_word & L2CAP_FCR_SEG_BITS; - BOOLEAN packet_ok = TRUE; - UINT8 *p; - - /* Check if the SAR state is correct */ - if ((sar_type == L2CAP_FCR_UNSEG_SDU) || (sar_type == L2CAP_FCR_START_SDU)) - { - if (p_fcrb->p_rx_sdu != NULL) - { - L2CAP_TRACE_WARNING2 ("SAR - got unexpected unsegmented or start SDU Expected len: %u Got so far: %u", - p_fcrb->rx_sdu_len, p_fcrb->p_rx_sdu->len); - - packet_ok = FALSE; - } - /* Check the length of the packet */ - if ( (sar_type == L2CAP_FCR_START_SDU) && (p_buf->len < L2CAP_SDU_LEN_OVERHEAD) ) - { - L2CAP_TRACE_WARNING1 ("SAR start packet too short: %u", p_buf->len); - packet_ok = FALSE; - } - } - else - { - if (p_fcrb->p_rx_sdu == NULL) - { - L2CAP_TRACE_WARNING0 ("SAR - got unexpected cont or end SDU"); - packet_ok = FALSE; - } - } - - if ( (packet_ok) && (sar_type != L2CAP_FCR_UNSEG_SDU) ) - { - p = ((UINT8 *)(p_buf + 1)) + p_buf->offset; - - /* For start SDU packet, extract the SDU length */ - if (sar_type == L2CAP_FCR_START_SDU) - { - /* Get the SDU length */ - STREAM_TO_UINT16 (p_fcrb->rx_sdu_len, p); - p_buf->offset += 2; - p_buf->len -= 2; - - if (p_fcrb->rx_sdu_len > p_ccb->max_rx_mtu) - { - L2CAP_TRACE_WARNING2 ("SAR - SDU len: %u larger than MTU: %u", p_fcrb->rx_sdu_len, p_fcrb->rx_sdu_len); - packet_ok = FALSE; - } - else if ((p_fcrb->p_rx_sdu = (BT_HDR *)GKI_getpoolbuf (p_ccb->ertm_info.user_rx_pool_id)) == NULL) - { - L2CAP_TRACE_ERROR1 ("SAR - no buffer for SDU start user_rx_pool_id:%d", p_ccb->ertm_info.user_rx_pool_id); - packet_ok = FALSE; - } - else - { - p_fcrb->p_rx_sdu->offset = 4; /* this is the minimal offset required by OBX to process incoming packets */ - p_fcrb->p_rx_sdu->len = 0; - } - } - - if (packet_ok) - { - if ((p_fcrb->p_rx_sdu->len + p_buf->len) > p_fcrb->rx_sdu_len) - { - L2CAP_TRACE_ERROR4 ("SAR - SDU len exceeded Type: %u Lengths: %u %u %u", - sar_type, p_fcrb->p_rx_sdu->len, p_buf->len, p_fcrb->rx_sdu_len); - packet_ok = FALSE; - } - else if ( (sar_type == L2CAP_FCR_END_SDU) && ((p_fcrb->p_rx_sdu->len + p_buf->len) != p_fcrb->rx_sdu_len) ) - { - L2CAP_TRACE_WARNING3 ("SAR - SDU end rcvd but SDU incomplete: %u %u %u", - p_fcrb->p_rx_sdu->len, p_buf->len, p_fcrb->rx_sdu_len); - packet_ok = FALSE; - } - else - { - memcpy (((UINT8 *) (p_fcrb->p_rx_sdu + 1)) + p_fcrb->p_rx_sdu->offset + p_fcrb->p_rx_sdu->len, p, p_buf->len); - - p_fcrb->p_rx_sdu->len += p_buf->len; - - GKI_freebuf (p_buf); - p_buf = NULL; - - if (sar_type == L2CAP_FCR_END_SDU) - { - p_buf = p_fcrb->p_rx_sdu; - p_fcrb->p_rx_sdu = NULL; - } - } - } - } - - if (packet_ok == FALSE) - { - GKI_freebuf (p_buf); - } - else if (p_buf != NULL) - { -#if (L2CAP_NUM_FIXED_CHNLS > 0) - if (p_ccb->local_cid < L2CAP_BASE_APPL_CID) - (*l2cb.fixed_reg[p_ccb->local_cid - L2CAP_FIRST_FIXED_CHNL].pL2CA_FixedData_Cb)(p_ccb->p_lcb->remote_bd_addr, p_buf); - else -#endif - l2c_csm_execute (p_ccb, L2CEVT_L2CAP_DATA, p_buf); - } - - return (packet_ok); -} - - -/******************************************************************************* -** -** Function retransmit_i_frames -** -** Description This function retransmits i-frames awaiting acks. -** -** Returns BOOLEAN - TRUE if retransmitted -** -*******************************************************************************/ -static BOOLEAN retransmit_i_frames (tL2C_CCB *p_ccb, UINT8 tx_seq) -{ - BT_HDR *p_buf, *p_buf2; - UINT8 *p; - UINT8 buf_seq; - UINT16 ctrl_word; - - if ( (p_ccb->fcrb.waiting_for_ack_q.p_first) - && (p_ccb->peer_cfg.fcr.max_transmit != 0) - && (p_ccb->fcrb.num_tries >= p_ccb->peer_cfg.fcr.max_transmit) ) - { - L2CAP_TRACE_EVENT5 ("Max Tries Exceeded: (last_acq: %d CID: 0x%04x num_tries: %u (max: %u) ack_q_count: %u", - p_ccb->fcrb.last_rx_ack, p_ccb->local_cid, p_ccb->fcrb.num_tries, p_ccb->peer_cfg.fcr.max_transmit, - p_ccb->fcrb.waiting_for_ack_q.count); - - l2cu_disconnect_chnl (p_ccb); - return (FALSE); - } - - /* tx_seq indicates whether to retransmit a specific sequence or all (if == L2C_FCR_RETX_ALL_PKTS) */ - if (tx_seq != L2C_FCR_RETX_ALL_PKTS) - { - /* If sending only one, the sequence number tells us which one. Look for it. - */ - for (p_buf = (BT_HDR *)p_ccb->fcrb.waiting_for_ack_q.p_first; p_buf; p_buf = (BT_HDR *)GKI_getnext (p_buf)) - { - /* Get the old control word */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; - - STREAM_TO_UINT16 (ctrl_word, p); - - buf_seq = (ctrl_word & L2CAP_FCR_TX_SEQ_BITS) >> L2CAP_FCR_TX_SEQ_BITS_SHIFT; - - L2CAP_TRACE_DEBUG2 ("retransmit_i_frames() cur seq: %u looking for: %u", buf_seq, tx_seq); - - if (tx_seq == buf_seq) - break; - } - - if (!p_buf) - { - L2CAP_TRACE_ERROR2 ("retransmit_i_frames() UNKNOWN seq: %u q_count: %u", tx_seq, p_ccb->fcrb.waiting_for_ack_q.count); - return (TRUE); - } - } - else - { - /* Retransmitting everything. Flush buffers we already put in the link xmit queue. - */ - p_buf = (BT_HDR *)p_ccb->p_lcb->link_xmit_data_q.p_first; - - while (p_buf != NULL) - { - /* Do not flush other CIDs or partial segments */ - if ( (p_buf->layer_specific == 0) && (p_buf->event == p_ccb->local_cid) ) - { - p_buf2 = p_buf; - p_buf = (BT_HDR *)GKI_getnext (p_buf); - - GKI_remove_from_queue (&p_ccb->p_lcb->link_xmit_data_q, p_buf2); - GKI_freebuf (p_buf2); - } - else - p_buf = (BT_HDR *)GKI_getnext (p_buf); - } - - /* Also flush our retransmission queue */ - while (p_ccb->fcrb.retrans_q.p_first) - GKI_freebuf (GKI_dequeue (&p_ccb->fcrb.retrans_q)); - - p_buf = (BT_HDR *)p_ccb->fcrb.waiting_for_ack_q.p_first; - } - - while (p_buf != NULL) - { - p_buf2 = l2c_fcr_clone_buf (p_buf, p_buf->offset, p_buf->len, p_ccb->ertm_info.fcr_tx_pool_id); - - if (p_buf2) - { - p_buf2->layer_specific = p_buf->layer_specific; - - GKI_enqueue (&p_ccb->fcrb.retrans_q, p_buf2); - } - - if ( (tx_seq != L2C_FCR_RETX_ALL_PKTS) || (p_buf2 == NULL) ) - break; - else - p_buf = (BT_HDR *)GKI_getnext (p_buf); - } - - l2c_link_check_send_pkts (p_ccb->p_lcb, NULL, NULL); - - if (p_ccb->fcrb.waiting_for_ack_q.count) - { - p_ccb->fcrb.num_tries++; - l2c_fcr_start_timer (p_ccb); - } - - return (TRUE); -} - - -/******************************************************************************* -** -** Function l2c_fcr_get_next_xmit_sdu_seg -** -** Description Get the next SDU segment to transmit. -** -** Returns pointer to buffer with segment or NULL -** -*******************************************************************************/ -BT_HDR *l2c_fcr_get_next_xmit_sdu_seg (tL2C_CCB *p_ccb, UINT16 max_packet_length) -{ - BOOLEAN first_seg = FALSE, /* The segment is the first part of data */ - mid_seg = FALSE, /* The segment is the middle part of data */ - last_seg = FALSE; /* The segment is the last part of data */ - UINT16 sdu_len; - BT_HDR *p_buf, *p_xmit; - UINT8 *p; - UINT16 max_pdu = p_ccb->tx_mps /* Needed? - L2CAP_MAX_HEADER_FCS*/; - - /* If there is anything in the retransmit queue, that goes first - */ - if (p_ccb->fcrb.retrans_q.p_first) - { - p_buf = (BT_HDR *)GKI_dequeue (&p_ccb->fcrb.retrans_q); - - /* Update Rx Seq and FCS if we acked some packets while this one was queued */ - prepare_I_frame (p_ccb, p_buf, TRUE); - - p_buf->event = p_ccb->local_cid; - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE - /* Use sdu_len to hold the control word */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset + L2CAP_PKT_OVERHEAD; - STREAM_TO_UINT16 (sdu_len, p); - - /* Get out if packet was dropped; just pretend it went out */ - if (l2c_corrupt_the_fcr_packet (p_ccb, p_buf, FALSE, sdu_len)) - return (NULL); -#endif /* L2CAP_CORRUPT_ERTM_PKTS */ - -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.pkts_retransmitted++; - p_ccb->fcrb.ertm_pkt_counts[0]++; - p_ccb->fcrb.ertm_byte_counts[0] += (p_buf->len - 8); -#endif - return (p_buf); - } - - /* For BD/EDR controller, max_packet_length is set to 0 */ - /* For AMP controller, max_packet_length is set by available blocks */ - if ( (max_packet_length > L2CAP_MAX_HEADER_FCS) - && (max_pdu + L2CAP_MAX_HEADER_FCS > max_packet_length) ) - { - max_pdu = max_packet_length - L2CAP_MAX_HEADER_FCS; - } - - p_buf = (BT_HDR *)p_ccb->xmit_hold_q.p_first; - - /* If there is more data than the MPS, it requires segmentation */ - if (p_buf->len > max_pdu) - { - /* We are using the "event" field to tell is if we already started segmentation */ - if (p_buf->event == 0) - { - first_seg = TRUE; - sdu_len = p_buf->len; - } - else - mid_seg = TRUE; - - /* Get a new buffer and copy the data that can be sent in a PDU */ - p_xmit = l2c_fcr_clone_buf (p_buf, L2CAP_MIN_OFFSET + L2CAP_SDU_LEN_OFFSET, - max_pdu, p_ccb->ertm_info.fcr_tx_pool_id); - - if (p_xmit != NULL) - { - p_buf->event = p_ccb->local_cid; - p_xmit->event = p_ccb->local_cid; - - p_buf->len -= max_pdu; - p_buf->offset += max_pdu; - - /* copy PBF setting */ - p_xmit->layer_specific = p_buf->layer_specific; - } - else /* Should never happen if the application has configured buffers correctly */ - { - L2CAP_TRACE_ERROR1 ("L2CAP - cannot get buffer, for segmentation, pool: %u", p_ccb->ertm_info.fcr_tx_pool_id); - return (NULL); - } - } - else /* Use the original buffer if no segmentation, or the last segment */ - { - p_xmit = (BT_HDR *)GKI_dequeue (&p_ccb->xmit_hold_q); - - if (p_xmit->event != 0) - last_seg = TRUE; - - p_xmit->event = p_ccb->local_cid; - } - - /* Step back to add the L2CAP headers */ - p_xmit->offset -= (L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD); - p_xmit->len += L2CAP_PKT_OVERHEAD + L2CAP_FCR_OVERHEAD; - - if (first_seg) - { - p_xmit->offset -= L2CAP_SDU_LEN_OVERHEAD; - p_xmit->len += L2CAP_SDU_LEN_OVERHEAD; - } - - /* Set the pointer to the beginning of the data */ - p = (UINT8 *)(p_xmit + 1) + p_xmit->offset; - - /* Now the L2CAP header */ - - /* Note: if FCS has to be included then the length is recalculated later */ - UINT16_TO_STREAM (p, p_xmit->len - L2CAP_PKT_OVERHEAD); - - UINT16_TO_STREAM (p, p_ccb->remote_cid); - - if (first_seg) - { - /* Skip control word and add SDU length */ - p += 2; - UINT16_TO_STREAM (p, sdu_len); - - /* We will store the SAR type in layer-specific */ - /* layer_specific is shared with flushable flag(bits 0-1), don't clear it */ - p_xmit->layer_specific |= L2CAP_FCR_START_SDU; - - first_seg = FALSE; - } - else if (mid_seg) - p_xmit->layer_specific |= L2CAP_FCR_CONT_SDU; - else if (last_seg) - p_xmit->layer_specific |= L2CAP_FCR_END_SDU; - else - p_xmit->layer_specific |= L2CAP_FCR_UNSEG_SDU; - - prepare_I_frame (p_ccb, p_xmit, FALSE); - - if (p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) - { - BT_HDR *p_wack = l2c_fcr_clone_buf (p_xmit, HCI_DATA_PREAMBLE_SIZE, p_xmit->len, p_ccb->ertm_info.fcr_tx_pool_id); - - if (!p_wack) - { - L2CAP_TRACE_ERROR3 ("L2CAP - no buffer for xmit cloning, CID: 0x%04x Pool: %u Count: %u", - p_ccb->local_cid, p_ccb->ertm_info.fcr_tx_pool_id, GKI_poolfreecount(p_ccb->ertm_info.fcr_tx_pool_id)); - - /* We will not save the FCS in case we reconfigure and change options */ - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - p_xmit->len -= L2CAP_FCS_LEN; - - /* Pretend we sent it and it got lost */ - GKI_enqueue (&p_ccb->fcrb.waiting_for_ack_q, p_xmit); - return (NULL); - } - else - { -#if (L2CAP_ERTM_STATS == TRUE) - /* set timestamp at the end of tx I-frame to get acking delay */ - p = ((UINT8 *) (p_wack+1)) + p_wack->offset + p_wack->len; - UINT32_TO_STREAM (p, GKI_get_os_tick_count()); -#endif - /* We will not save the FCS in case we reconfigure and change options */ - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - p_wack->len -= L2CAP_FCS_LEN; - - p_wack->layer_specific = p_xmit->layer_specific; - GKI_enqueue (&p_ccb->fcrb.waiting_for_ack_q, p_wack); - } - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE - { - UINT16 ctrl_word; - p = ((UINT8 *) (p_xmit+1)) + p_xmit->offset + L2CAP_PKT_OVERHEAD; - STREAM_TO_UINT16 (ctrl_word, p); - - /* Get out if packet was dropped; pretend it was sent */ - if (l2c_corrupt_the_fcr_packet (p_ccb, p_xmit, FALSE, ctrl_word)) - return (NULL); - } -#endif -#if (L2CAP_ERTM_STATS == TRUE) - p_ccb->fcrb.ertm_pkt_counts[0]++; - p_ccb->fcrb.ertm_byte_counts[0] += (p_xmit->len - 8); -#endif - - } - - return (p_xmit); -} - - -/******************************************************************************* -** Configuration negotiation functions -** -** The following functions are used in negotiating channel modes during -** configuration -********************************************************************************/ - -/******************************************************************************* -** -** Function l2c_fcr_chk_chan_modes -** -** Description Validates and adjusts if necessary, the FCR options -** based on remote EXT features. -** -** Note: This assumes peer EXT Features have been received. -** Basic mode is used if FCR Options have not been received -** -** Returns UINT8 - nonzero if can continue, '0' if no compatible channels -** -*******************************************************************************/ -UINT8 l2c_fcr_chk_chan_modes (tL2C_CCB *p_ccb) -{ - /* Remove nonbasic options that the peer does not support */ - if (!(p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_ENH_RETRANS)) - p_ccb->ertm_info.allowed_modes &= ~L2CAP_FCR_CHAN_OPT_ERTM; - - if (!(p_ccb->p_lcb->peer_ext_fea & L2CAP_EXTFEA_STREAM_MODE)) - p_ccb->ertm_info.allowed_modes &= ~L2CAP_FCR_CHAN_OPT_STREAM; - - /* At least one type needs to be set (Basic, ERTM, STM) to continue */ - if (!p_ccb->ertm_info.allowed_modes) - { - L2CAP_TRACE_WARNING0 ("L2CAP - Peer does not support our desired channel types"); - } - - return (p_ccb->ertm_info.allowed_modes); -} - -/******************************************************************************* -** -** Function l2c_fcr_adj_our_req_options -** -** Description Validates and sets up the FCR options passed in from -** L2CA_ConfigReq based on remote device's features. -** -** Returns TRUE if no errors, Otherwise FALSE -** -*******************************************************************************/ -BOOLEAN l2c_fcr_adj_our_req_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) -{ - tL2CAP_FCR_OPTS *p_fcr = &p_cfg->fcr; - - if (p_fcr->mode != p_ccb->ertm_info.preferred_mode) - { - L2CAP_TRACE_WARNING2 ("l2c_fcr_adj_our_req_options - preferred_mode (%d), does not match mode (%d)", - p_ccb->ertm_info.preferred_mode, p_fcr->mode); - - /* The preferred mode is passed in through tL2CAP_ERTM_INFO, so override this one */ - p_fcr->mode = p_ccb->ertm_info.preferred_mode; - } - - /* If upper layer did not request eRTM mode, BASIC must be used */ - if (p_ccb->ertm_info.allowed_modes == L2CAP_FCR_CHAN_OPT_BASIC) - { - if (p_cfg->fcr_present && p_fcr->mode != L2CAP_FCR_BASIC_MODE) - { - L2CAP_TRACE_WARNING1 ("l2c_fcr_adj_our_req_options (mode %d): ERROR: No FCR options set using BASIC mode", p_fcr->mode); - } - p_fcr->mode = L2CAP_FCR_BASIC_MODE; - } - - /* Process the FCR options if initial channel bring-up (not a reconfig request) - ** Determine initial channel mode to try based on our options and remote's features - */ - if (p_cfg->fcr_present && !(p_ccb->config_done & RECONFIG_FLAG)) - { - /* We need to have at least one mode type common with the peer */ - if (!l2c_fcr_chk_chan_modes(p_ccb)) - { - /* Two channels have incompatible supported types */ - l2cu_disconnect_chnl (p_ccb); - return (FALSE); - } - - /* Basic is the only common channel mode between the two devices */ - else if (p_ccb->ertm_info.allowed_modes == L2CAP_FCR_CHAN_OPT_BASIC) - { - /* We only want to try Basic, so bypass sending the FCR options entirely */ - p_cfg->fcr_present = FALSE; - p_cfg->fcs_present = FALSE; /* Illegal to use FCS option in basic mode */ - p_cfg->ext_flow_spec_present = FALSE; /* Illegal to use extended flow spec in basic mode */ - } - - /* We have at least one non-basic mode available - * Override mode from available mode options based on preference, if needed - */ - else - { - /* If peer does not support STREAMING, try ERTM */ - if (p_fcr->mode == L2CAP_FCR_STREAM_MODE && !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_STREAM)) - { - L2CAP_TRACE_DEBUG0 ("L2C CFG: mode is STREAM, but peer does not support; Try ERTM"); - p_fcr->mode = L2CAP_FCR_ERTM_MODE; - } - - /* If peer does not support ERTM, try BASIC (will support this if made it here in the code) */ - if (p_fcr->mode == L2CAP_FCR_ERTM_MODE && !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ERTM)) - { - L2CAP_TRACE_DEBUG0 ("L2C CFG: mode is ERTM, but peer does not support; Try BASIC"); - p_fcr->mode = L2CAP_FCR_BASIC_MODE; - } - } - - if (p_fcr->mode != L2CAP_FCR_BASIC_MODE) - { - /* MTU must be smaller than buffer size */ - if ( (p_cfg->mtu_present) && (p_cfg->mtu > p_ccb->max_rx_mtu) ) - { - L2CAP_TRACE_WARNING2 ("L2CAP - MTU: %u larger than buf size: %u", p_cfg->mtu, p_ccb->max_rx_mtu); - return (FALSE); - } - - /* application want to use the default MPS */ - if (p_fcr->mps == L2CAP_DEFAULT_ERM_MPS) - { - p_fcr->mps = L2CAP_MPS_OVER_BR_EDR; - } - /* MPS must be less than MTU */ - else if (p_fcr->mps > p_ccb->max_rx_mtu) - { - L2CAP_TRACE_WARNING2 ("L2CAP - MPS %u invalid MTU: %u", p_fcr->mps, p_ccb->max_rx_mtu); - return (FALSE); - } - - /* We always initially read into the HCI buffer pool, so make sure it fits */ - if (p_fcr->mps > (L2CAP_MTU_SIZE - L2CAP_MAX_HEADER_FCS)) - p_fcr->mps = L2CAP_MTU_SIZE - L2CAP_MAX_HEADER_FCS; - } - else - { - p_cfg->fcs_present = FALSE; /* Illegal to use FCS option in basic mode */ - p_cfg->ext_flow_spec_present = FALSE; /* Illegal to use extended flow spec in basic mode */ - } - - p_ccb->our_cfg.fcr = *p_fcr; - } - else /* Not sure how to send a reconfiguration(??) should fcr be included? */ - { - p_ccb->our_cfg.fcr_present = FALSE; - } - - return (TRUE); -} - - -/******************************************************************************* -** -** Function l2c_fcr_adj_monitor_retran_timeout -** -** Description Overrides monitor/retrans timer value based on controller -** -** Returns None -** -*******************************************************************************/ -void l2c_fcr_adj_monitor_retran_timeout (tL2C_CCB *p_ccb) -{ - /* adjust our monitor/retran timeout */ - if (p_ccb->out_cfg_fcr_present) - { - /* - ** if we requestd ERTM or accepted ERTM - ** We may accept ERTM even if we didn't request ERTM, in case of requesting STREAM - */ - if ((p_ccb->our_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE) - ||(p_ccb->peer_cfg.fcr.mode == L2CAP_FCR_ERTM_MODE)) - { - /* upper layer setting is ignored */ - p_ccb->our_cfg.fcr.mon_tout = L2CAP_MIN_MONITOR_TOUT; - p_ccb->our_cfg.fcr.rtrans_tout = L2CAP_MIN_RETRANS_TOUT; - } - else - { - p_ccb->our_cfg.fcr.mon_tout = 0; - p_ccb->our_cfg.fcr.rtrans_tout = 0; - } - - L2CAP_TRACE_DEBUG2 ("l2c_fcr_adj_monitor_retran_timeout: mon_tout:%d, rtrans_tout:%d", - p_ccb->our_cfg.fcr.mon_tout, p_ccb->our_cfg.fcr.rtrans_tout); - } -} -/******************************************************************************* -** -** Function l2c_fcr_adj_our_rsp_options -** -** Description Overrides any neccesary FCR options passed in from -** L2CA_ConfigRsp based on our FCR options. -** Only makes adjustments if channel is in ERTM mode. -** -** Returns None -** -*******************************************************************************/ -void l2c_fcr_adj_our_rsp_options (tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) -{ - /* adjust our monitor/retran timeout */ - l2c_fcr_adj_monitor_retran_timeout(p_ccb); - - p_cfg->fcr_present = p_ccb->out_cfg_fcr_present; - - if (p_cfg->fcr_present) - { -// btla-specific ++ - /* Temporary - until a better algorithm is implemented */ - /* If peer's tx_wnd_sz requires too many buffers for us to support, then adjust it. For now, respond with our own tx_wnd_sz. */ - /* Note: peer is not guaranteed to obey our adjustment */ - if (p_ccb->peer_cfg.fcr.tx_win_sz > p_ccb->our_cfg.fcr.tx_win_sz) - { - L2CAP_TRACE_DEBUG3 ("%s: adjusting requested tx_win_sz from %i to %i", __FUNCTION__, p_ccb->peer_cfg.fcr.tx_win_sz, p_ccb->our_cfg.fcr.tx_win_sz); - p_ccb->peer_cfg.fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz; - } -// btla-specific -- - - p_cfg->fcr.mode = p_ccb->peer_cfg.fcr.mode; - p_cfg->fcr.tx_win_sz = p_ccb->peer_cfg.fcr.tx_win_sz; - p_cfg->fcr.max_transmit = p_ccb->peer_cfg.fcr.max_transmit; - p_cfg->fcr.mps = p_ccb->peer_cfg.fcr.mps; - p_cfg->fcr.rtrans_tout = p_ccb->our_cfg.fcr.rtrans_tout; - p_cfg->fcr.mon_tout = p_ccb->our_cfg.fcr.mon_tout; - } -} - -/******************************************************************************* -** -** Function l2c_fcr_renegotiate_chan -** -** Description Called upon unsuccessful peer response to config request. -** If the error is because of the channel mode, it will try -** to resend using another supported optional channel. -** -** Returns TRUE if resent configuration, False if channel matches or -** cannot match. -** -*******************************************************************************/ -BOOLEAN l2c_fcr_renegotiate_chan(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) -{ - UINT8 peer_mode = p_ccb->our_cfg.fcr.mode; - BOOLEAN can_renegotiate; - - /* Skip if this is a reconfiguration from OPEN STATE or if FCR is not returned */ - if (!p_cfg->fcr_present || (p_ccb->config_done & RECONFIG_FLAG)) - return (FALSE); - - /* Only retry if there are more channel options to try */ - if (p_cfg->result == L2CAP_CFG_UNACCEPTABLE_PARAMS) - { - peer_mode = (p_cfg->fcr_present) ? p_cfg->fcr.mode : L2CAP_FCR_BASIC_MODE; - - if (p_ccb->our_cfg.fcr.mode != peer_mode) - { - - if ((--p_ccb->fcr_cfg_tries) == 0) - { - p_cfg->result = L2CAP_CFG_FAILED_NO_REASON; - L2CAP_TRACE_WARNING0 ("l2c_fcr_renegotiate_chan (Max retries exceeded)"); - } - - can_renegotiate = FALSE; - - /* Try another supported mode if available based on our last attempted channel */ - switch (p_ccb->our_cfg.fcr.mode) - { - /* Our Streaming mode request was unnacceptable; try ERTM or Basic */ - case L2CAP_FCR_STREAM_MODE: - /* Peer wants ERTM and we support it */ - if ( (peer_mode == L2CAP_FCR_ERTM_MODE) && (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ERTM) ) - { - L2CAP_TRACE_DEBUG0 ("l2c_fcr_renegotiate_chan(Trying ERTM)"); - p_ccb->our_cfg.fcr.mode = L2CAP_FCR_ERTM_MODE; - can_renegotiate = TRUE; - } - else /* Falls through */ - - case L2CAP_FCR_ERTM_MODE: - { - /* We can try basic for any other peer mode if we support it */ - if (p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC) - { - L2CAP_TRACE_DEBUG0 ("l2c_fcr_renegotiate_chan(Trying Basic)"); - can_renegotiate = TRUE; - p_ccb->our_cfg.fcr.mode = L2CAP_FCR_BASIC_MODE; - } - } - break; - - default: - /* All other scenarios cannot be renegotiated */ - break; - } - - if (can_renegotiate) - { - p_ccb->our_cfg.fcr_present = TRUE; - - if (p_ccb->our_cfg.fcr.mode == L2CAP_FCR_BASIC_MODE) - { - p_ccb->our_cfg.fcs_present = FALSE; - p_ccb->our_cfg.ext_flow_spec_present = FALSE; - - /* Basic Mode uses ACL Data Pool, make sure the MTU fits */ - if ( (p_cfg->mtu_present) && (p_cfg->mtu > L2CAP_MTU_SIZE) ) - { - L2CAP_TRACE_WARNING1 ("L2CAP - adjust MTU: %u too large", p_cfg->mtu); - p_cfg->mtu = L2CAP_MTU_SIZE; - } - } - - l2cu_process_our_cfg_req (p_ccb, &p_ccb->our_cfg); - l2cu_send_peer_config_req (p_ccb, &p_ccb->our_cfg); - btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_L2CAP_CHNL, L2CAP_CHNL_CFG_TIMEOUT); - return (TRUE); - } - } - } - - /* Disconnect if the channels do not match */ - if (p_ccb->our_cfg.fcr.mode != peer_mode) - { - L2CAP_TRACE_WARNING2 ("L2C CFG: Channels incompatible (local %d, peer %d)", - p_ccb->our_cfg.fcr.mode, peer_mode); - l2cu_disconnect_chnl (p_ccb); - } - - return (FALSE); -} - - -/******************************************************************************* -** -** Function l2c_fcr_process_peer_cfg_req -** -** Description This function is called to process the FCR options passed -** in the peer's configuration request. -** -** Returns UINT8 - L2CAP_PEER_CFG_OK, L2CAP_PEER_CFG_UNACCEPTABLE, -** or L2CAP_PEER_CFG_DISCONNECT. -** -*******************************************************************************/ -UINT8 l2c_fcr_process_peer_cfg_req(tL2C_CCB *p_ccb, tL2CAP_CFG_INFO *p_cfg) -{ - UINT16 max_retrans_size; - UINT8 fcr_ok = L2CAP_PEER_CFG_OK; - - p_ccb->p_lcb->w4_info_rsp = FALSE; /* Handles T61x SonyEricsson Bug in Info Request */ - - L2CAP_TRACE_EVENT5 ("l2c_fcr_process_peer_cfg_req() CFG fcr_present:%d fcr.mode:%d CCB FCR mode:%d preferred: %u allowed:%u", - p_cfg->fcr_present, p_cfg->fcr.mode, p_ccb->our_cfg.fcr.mode, p_ccb->ertm_info.preferred_mode, - p_ccb->ertm_info.allowed_modes); - - /* If Peer wants basic, we are done (accept it or disconnect) */ - if (p_cfg->fcr.mode == L2CAP_FCR_BASIC_MODE) - { - /* If we do not allow basic, disconnect */ - if ( !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_BASIC) ) - fcr_ok = L2CAP_PEER_CFG_DISCONNECT; - } - - /* Need to negotiate if our modes are not the same */ - else if (p_cfg->fcr.mode != p_ccb->ertm_info.preferred_mode) - { - /* If peer wants a mode that we don't support then retry our mode (ex. rtx/flc), OR - ** If we want ERTM and they wanted streaming retry our mode. - ** Note: If we have already determined they support our mode previously - ** from their EXF mask. - */ - if ( (((1 << p_cfg->fcr.mode) & L2CAP_FCR_CHAN_OPT_ALL_MASK) == 0) - || (p_ccb->ertm_info.preferred_mode == L2CAP_FCR_ERTM_MODE) ) - { - p_cfg->fcr.mode = p_ccb->our_cfg.fcr.mode; - p_cfg->fcr.tx_win_sz = p_ccb->our_cfg.fcr.tx_win_sz; - p_cfg->fcr.max_transmit = p_ccb->our_cfg.fcr.max_transmit; - fcr_ok = L2CAP_PEER_CFG_UNACCEPTABLE; - } - - /* If we wanted basic, then try to renegotiate it */ - else if (p_ccb->ertm_info.preferred_mode == L2CAP_FCR_BASIC_MODE) - { - p_cfg->fcr.mode = L2CAP_FCR_BASIC_MODE; - p_cfg->fcr.max_transmit = p_cfg->fcr.tx_win_sz = 0; - p_cfg->fcr.rtrans_tout = p_cfg->fcr.mon_tout = p_cfg->fcr.mps = 0; - p_ccb->our_cfg.fcr.rtrans_tout = p_ccb->our_cfg.fcr.mon_tout = p_ccb->our_cfg.fcr.mps = 0; - fcr_ok = L2CAP_PEER_CFG_UNACCEPTABLE; - } - - /* Only other valid case is if they want ERTM and we wanted STM which should be - accepted if we support it; otherwise the channel should be disconnected */ - else if ( (p_cfg->fcr.mode != L2CAP_FCR_ERTM_MODE) - || !(p_ccb->ertm_info.allowed_modes & L2CAP_FCR_CHAN_OPT_ERTM) ) - { - fcr_ok = L2CAP_PEER_CFG_DISCONNECT; - } - } - - /* Configuration for FCR channels so make any adjustments and fwd to upper layer */ - if (fcr_ok == L2CAP_PEER_CFG_OK) - { - /* by default don't need to send params in the response */ - p_ccb->out_cfg_fcr_present = FALSE; - - /* Make any needed adjustments for the response to the peer */ - if (p_cfg->fcr_present && p_cfg->fcr.mode != L2CAP_FCR_BASIC_MODE) - { - /* Peer desires to bypass FCS check, and streaming or ERTM mode */ - if (p_cfg->fcs_present) - { - p_ccb->peer_cfg.fcs = p_cfg->fcs; - p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_FCS; - if( p_cfg->fcs == L2CAP_CFG_FCS_BYPASS) - p_ccb->bypass_fcs |= L2CAP_CFG_FCS_PEER; - } - - max_retrans_size = GKI_get_pool_bufsize (p_ccb->ertm_info.fcr_tx_pool_id) - sizeof(BT_HDR) - - L2CAP_MIN_OFFSET - L2CAP_SDU_LEN_OFFSET - L2CAP_FCS_LEN; - - /* Ensure the MPS is not bigger than the MTU */ - if ( (p_cfg->fcr.mps == 0) || (p_cfg->fcr.mps > p_ccb->peer_cfg.mtu) ) - { - p_cfg->fcr.mps = p_ccb->peer_cfg.mtu; - p_ccb->out_cfg_fcr_present = TRUE; - } - - /* Ensure the MPS is not bigger than our retransmission buffer */ - if (p_cfg->fcr.mps > max_retrans_size) - { - L2CAP_TRACE_DEBUG2("CFG: Overriding MPS to %d (orig %d)", max_retrans_size, p_cfg->fcr.mps); - - p_cfg->fcr.mps = max_retrans_size; - p_ccb->out_cfg_fcr_present = TRUE; - } - - if (p_cfg->fcr.mode == L2CAP_FCR_ERTM_MODE) - { - /* Always respond with FCR ERTM parameters */ - p_ccb->out_cfg_fcr_present = TRUE; - } - } - - /* Everything ok, so save the peer's adjusted fcr options */ - p_ccb->peer_cfg.fcr = p_cfg->fcr; - - if (p_cfg->fcr_present) - p_ccb->peer_cfg_bits |= L2CAP_CH_CFG_MASK_FCR; - } - else if (fcr_ok == L2CAP_PEER_CFG_UNACCEPTABLE) - { - /* Allow peer only one retry for mode */ - if (p_ccb->peer_cfg_already_rejected) - fcr_ok = L2CAP_PEER_CFG_DISCONNECT; - else - p_ccb->peer_cfg_already_rejected = TRUE; - } - - return (fcr_ok); -} - - -#if L2CAP_CORRUPT_ERTM_PKTS == TRUE -/******************************************************************************* -** Functions used for testing ERTM mode -*/ -/* If FALSE, will also corrupt cid, length, control word, etc. */ -#ifndef L2CAP_CORR_FCS_ONLY -#define L2CAP_CORR_FCS_ONLY TRUE -#endif - -#define L2C_DISP_FRAME_SIZE 16 -/******************************************************************************* -** -** Function l2c_corrupt_the_fcr_packet -** -** Description This function is used for testing purposes only. -** It systematically or randomly corrupts packets used with -** ERTM channels. -** -** Returns BOOLEAN TRUE if packet was dropped, -** FALSE if fcs corrupted or no corruption -** -*******************************************************************************/ -static BOOLEAN l2c_corrupt_the_fcr_packet (tL2C_CCB *p_ccb, BT_HDR *p_buf, - BOOLEAN is_rx, UINT16 ctrl_word) -{ - tL2C_FCR_TEST_CFG *p_cfg; - UINT32 tc; - UINT8 *p; - UINT32 xx; - char buf[L2C_DISP_FRAME_SIZE]; - - if (!p_ccb || !p_ccb->fcrb.test_cb.cfg.in_use) - return FALSE; - - /* Prepare bad FCS */ - p = ((UINT8 *) (p_buf + 1)) + p_buf->offset; - tc = GKI_get_os_tick_count(); - tc ^= p[p_buf->len - 1]; - xx = tc % 47; - - p_cfg = &p_ccb->fcrb.test_cb.cfg; -#if 0 - L2CAP_TRACE_DEBUG4 ("testcfg: type: %d, freq: %d (NRM-0, RDM-1), is_rx: %d, count: %d", - p_cfg->type, p_cfg->freq, p_cfg->is_rx, p_cfg->count); -#endif - /* If not time to corrupt get out */ - if (p_cfg->freq == L2CAP_FCR_FREQ_RANDOM) - { - if (xx != 0) - return FALSE; - } - else /* check test criteria before corrupting */ - { - if ( (p_cfg->count == 0) - || (p_cfg->is_rx != is_rx) - || ((UINT8)(ctrl_word & L2CAP_FCR_S_FRAME_BIT) != p_cfg->type) ) - { - return FALSE; - } - - /* Turn off if done */ - if (--(p_cfg->count) == 0) - { - p_ccb->fcrb.test_cb.cfg.in_use = FALSE; - } - } - -#if L2CAP_CORR_FCS_ONLY == TRUE - /* Corrupt the FCS check */ - p[p_buf->len - 1] = p[p_buf->len - 2] = 0; -#else - /* If made it this far packet needs to be corrupted */ - xx = tc % p_buf->len; - - /* Make sure the value was changed */ - if (p[xx + 1] == 0) - p[xx + 1] = 0x5A; - - p[xx] = p[xx] ^ p[xx + 1]; - -#if 1 /* Enable if not wishing to corrupting frame type */ - { - UINT8 *p_temp = ((UINT8 *) (p_buf + 1)) + p_buf->offset; - p_temp += L2CAP_PKT_OVERHEAD; - if ((UINT16)((*p_temp) & 0x01) != (ctrl_word & 0x0001)) - { - (*p_temp) |= (UINT8)(ctrl_word & 0x0001); - } - } -#endif -#endif - - if (is_rx) - { - if (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - BCM_STRCPY_S(buf, L2C_DISP_FRAME_SIZE, "Rx S-Frame"); - else - BCM_STRCPY_S(buf, L2C_DISP_FRAME_SIZE, "Rx I-Frame"); - } - else - { - if (ctrl_word & L2CAP_FCR_S_FRAME_BIT) - BCM_STRCPY_S(buf, L2C_DISP_FRAME_SIZE, "Tx S-Frame"); - else - BCM_STRCPY_S(buf, L2C_DISP_FRAME_SIZE, "Tx I-Frame"); - } - - /* Lastly, just drop packet if FCS is not being used or if Tx */ - if (!is_rx || p_ccb->bypass_fcs == L2CAP_BYPASS_FCS) - { - L2CAP_TRACE_ERROR6 ("-=-=-=-=-=-=-=- Dropping %s packet (0x%04x) tc: %u Buf Len: %u xx: %u count: %d", - buf, (UINT32)p_buf, tc, p_buf->len, xx, p_cfg->count); - GKI_freebuf(p_buf); - return TRUE; - } - else - { - L2CAP_TRACE_ERROR6 ("-=-=-=-=-=-=-=- Corrupting %s packet (0x%04x) tc: %u Buf Len: %u xx: %u count: %d", - buf, (UINT32)p_buf, tc, p_buf->len, xx, p_cfg->count); - } - - return FALSE; -} - - -/******************************************************************************* -** -** Function L2CA_SetupErtmTest -** -** Description This function is used for testing purposes only. -** It corrupts or drops one or more packets used with ERTM channels. -** -** Parameters -** cid - channel ID (0 uses RFCOMM PSM's CID) -** -** type - type of test to run (L2CAP_FCR_TTYPE_CORR_IFRAMES -** L2CAP_FCR_TTYPE_CORR_SFRAME -** L2CAP_FCR_TTYPE_STOP_TEST -** L2CAP_FCR_TTYPE_GET_CID - returns rfcomm cid only) -** -** is_rx - TRUE to corrupt Rx packet, FALSE for Tx packet) -** -** freq - L2CAP_FCR_FREQ_RANDOM (turns on random corruptions/drops) -** L2CAP_FCR_FREQ_NORMAL (turns on test with "count" corruptions/drops) -** -** count - number of packets in a row to drop or corrupt -** -** Returns CID of channel running test -** -*******************************************************************************/ -UINT16 L2CA_SetupErtmTest (UINT16 cid, UINT8 type, BOOLEAN is_rx, UINT8 freq, UINT16 count) -{ - tL2C_CCB *p_ccb = NULL; - tL2C_CCB *p_temp_ccb; - tL2C_FCR_TEST_CB *p_test_cb; - UINT16 xx; - - /* If '0' tests run on top of RFCOMM CID if active */ - if (cid == 0) - { - p_temp_ccb = l2cb.ccb_pool; - for (xx = 0; xx < MAX_L2CAP_CHANNELS; xx++, p_temp_ccb++) - { - /* Fixed channels don't have p_rcb's */ - if (p_temp_ccb->in_use && p_temp_ccb->p_rcb && p_temp_ccb->p_rcb->psm == BT_PSM_RFCOMM) - { - p_ccb = p_temp_ccb; - cid = L2CAP_BASE_APPL_CID + xx; - break; - } - } - } - else - p_ccb = l2cu_find_ccb_by_cid (NULL, cid); - - if (!p_ccb || type == L2CAP_FCR_TTYPE_GET_CID) - { - if (type == L2CAP_FCR_TTYPE_GET_CID) - { - L2CAP_TRACE_API1 ("L2CA_SetupErtmTest (GET_CID): cid = 0x%04x", cid); - } - return (cid); - } - - p_test_cb = &p_ccb->fcrb.test_cb; - - /* Turn off the current test */ - if (type == L2CAP_FCR_TTYPE_STOP_TEST) - { - if (p_test_cb->cfg.in_use) - { - L2CAP_TRACE_ERROR1 ("L2CA_SetupErtmTest (OFF): cid 0x%04x", cid); - } - p_test_cb->cfg.in_use = FALSE; - p_test_cb->cfg.count = 0; - } - - /* Process the new request */ - else if (!p_test_cb->cfg.in_use) - { - /* count must be positive unless random is used */ - if (!count && freq != L2CAP_FCR_FREQ_RANDOM) - { - L2CAP_TRACE_ERROR1 ("L2CA_SetupErtmTest (FAIL): Count = 0, freq = %d", freq); - return (cid); - } - - L2CAP_TRACE_ERROR5 ("L2CA_SetupErtmTest (START): cid 0x%04x, type %d, is_rx %d, freq %d, count %d", - cid, type, is_rx, freq, count); - - p_test_cb->cfg.in_use = TRUE; - p_test_cb->cfg.freq = freq; - p_test_cb->cfg.type = type; - p_test_cb->cfg.is_rx = is_rx; - p_test_cb->cfg.count = count; - } - else /* Test already in progress so ignore */ - { - L2CAP_TRACE_ERROR5 ("L2CA_SetupErtmTest (ignoring): cid 0x%04x, type %d, is_rx %d, freq %d, count %d", - cid, type, is_rx, freq, count); - } - - return (cid); -} - - -/******************************************************************************* -** The following routines are only used in conjunction with Conformance testing -********************************************************************************/ - -/******************************************************************************* -** -** Function L2CA_SendPolledSFrame -** -** Description This function is used for testing purposes only. -** It Sends a Polled RR or RNR to the peer -** -** Parameters -** cid - channel ID -** -** sup_type - (L2CAP_FCR_SUP_RR or L2CAP_FCR_SUP_RNR) -** -** Returns void -** -*******************************************************************************/ -void L2CA_SendPolledSFrame (UINT16 cid, UINT16 sup_type) -{ - tL2C_CCB *p_ccb = l2cu_find_ccb_by_cid (NULL, cid); - - if (p_ccb && (sup_type == L2CAP_FCR_SUP_RR || sup_type == L2CAP_FCR_SUP_RNR)) - { - l2c_fcr_send_S_frame (p_ccb, sup_type, L2CAP_FCR_P_BIT); - } - else - { - L2CAP_TRACE_ERROR2 ("L2CA_SendPolledSFrame(ERROR): sup_type %u, p_ccb 0x%07x", - sup_type, (UINT32)p_ccb); - } -} - -/******************************************************************************* -** -** Function l2c_bypass_sframe_packet -** -** Description This function is used for testing purposes only. -** It returns TRUE if S-Frame should be bypassed. -** -** Returns void -** -*******************************************************************************/ -static BOOLEAN l2c_bypass_sframe_packet (tL2C_CCB *p_ccb) -{ - if (p_ccb && p_ccb->fcrb.test_cb.cfm.in_use) - { - if (p_ccb->fcrb.test_cb.cfm.skip_sframe_count > 0) - { - L2CAP_TRACE_ERROR1 ("l2c_bypass_sframe_packet (count %d)", - p_ccb->fcrb.test_cb.cfm.skip_sframe_count); - - if (--p_ccb->fcrb.test_cb.cfm.skip_sframe_count == 0) - p_ccb->fcrb.test_cb.cfm.in_use = FALSE; - - /* Bypass sending S-Frame */ - return TRUE; - } - else - p_ccb->fcrb.test_cb.cfm.in_use = FALSE; - } - - return FALSE; -} - -/******************************************************************************* -** -** Function L2CA_BypassSFrame -** -** Description This function is used for testing purposes only. -** It skips sending 'count' S-Frames. -** -** Parameters -** cid - channel ID -** -** count - Number of S-Frames to skip sending -** -** Returns void -** -*******************************************************************************/ -void L2CA_BypassSFrame (UINT16 cid, UINT8 count) -{ - tL2C_CCB *p_ccb = l2cu_find_ccb_by_cid (NULL, cid); - tL2C_FCR_CFM_TEST_CB *p_test_cb; - - if (!p_ccb) - { - L2CAP_TRACE_WARNING1 ("L2CA_BypassSFrame(ERROR): no p_ccb (0x%07x)", (UINT32)p_ccb); - return; - } - - p_test_cb = &p_ccb->fcrb.test_cb.cfm; - - /* Initiate test if not active */ - if (!p_test_cb->in_use) - { - p_test_cb->in_use = TRUE; - p_test_cb->skip_sframe_count = count; - } - else - { - L2CAP_TRACE_WARNING0 ("L2CA_BypassSFrame(ERROR): already in use (ignoring...)"); - } -} - -#endif /* L2CAP_CORRUPT_ERTM_PKTS == TRUE */ - -#if (L2CAP_ERTM_STATS == TRUE) -/******************************************************************************* -** -** Function l2c_fcr_collect_ack_delay -** -** Description collect throughput, delay, queue size of waiting ack -** -** Parameters -** tL2C_CCB -** -** Returns void -** -*******************************************************************************/ -static void l2c_fcr_collect_ack_delay (tL2C_CCB *p_ccb, UINT8 num_bufs_acked) -{ - UINT32 index; - BT_HDR *p_buf; - UINT8 *p; - UINT32 timestamp, delay; - UINT8 xx; - UINT8 str[120]; - - index = p_ccb->fcrb.ack_delay_avg_index; - - /* update sum, max and min of waiting for ack queue size */ - p_ccb->fcrb.ack_q_count_avg[index] += p_ccb->fcrb.waiting_for_ack_q.count; - - if ( p_ccb->fcrb.waiting_for_ack_q.count > p_ccb->fcrb.ack_q_count_max[index] ) - p_ccb->fcrb.ack_q_count_max[index] = p_ccb->fcrb.waiting_for_ack_q.count; - - if ( p_ccb->fcrb.waiting_for_ack_q.count < p_ccb->fcrb.ack_q_count_min[index] ) - p_ccb->fcrb.ack_q_count_min[index] = p_ccb->fcrb.waiting_for_ack_q.count; - - /* update sum, max and min of round trip delay of acking */ - p_buf = (BT_HDR *)(p_ccb->fcrb.waiting_for_ack_q.p_first); - for (xx = 0; (xx < num_bufs_acked)&&(p_buf); xx++) - { - /* adding up length of acked I-frames to get throughput */ - p_ccb->fcrb.throughput[index] += p_buf->len - 8; - - if ( xx == num_bufs_acked - 1 ) - { - /* get timestamp from tx I-frame that receiver is acking */ - p = ((UINT8 *) (p_buf+1)) + p_buf->offset + p_buf->len; - if (p_ccb->bypass_fcs != L2CAP_BYPASS_FCS) - { - p += L2CAP_FCS_LEN; - } - - STREAM_TO_UINT32 (timestamp, p); - delay = GKI_get_os_tick_count() - timestamp; - - p_ccb->fcrb.ack_delay_avg[index] += delay; - if ( delay > p_ccb->fcrb.ack_delay_max[index] ) - p_ccb->fcrb.ack_delay_max[index] = delay; - if ( delay < p_ccb->fcrb.ack_delay_min[index] ) - p_ccb->fcrb.ack_delay_min[index] = delay; - } - - p_buf = GKI_getnext(p_buf); - } - - p_ccb->fcrb.ack_delay_avg_count++; - - /* calculate average and initialize next avg, min and max */ - if (p_ccb->fcrb.ack_delay_avg_count > L2CAP_ERTM_STATS_AVG_NUM_SAMPLES) - { - p_ccb->fcrb.ack_delay_avg_count = 0; - - p_ccb->fcrb.ack_q_count_avg[index] /= L2CAP_ERTM_STATS_AVG_NUM_SAMPLES; - p_ccb->fcrb.ack_delay_avg[index] /= L2CAP_ERTM_STATS_AVG_NUM_SAMPLES; - - /* calculate throughput */ - timestamp = GKI_get_os_tick_count(); - if (timestamp - p_ccb->fcrb.throughput_start > 0 ) - p_ccb->fcrb.throughput[index] /= (timestamp - p_ccb->fcrb.throughput_start); - - p_ccb->fcrb.throughput_start = timestamp; - - sprintf(str, "[%02u] throughput: %5u, ack_delay avg:%3u, min:%3u, max:%3u, ack_q_count avg:%3u, min:%3u, max:%3u", - index, p_ccb->fcrb.throughput[index], - p_ccb->fcrb.ack_delay_avg[index], p_ccb->fcrb.ack_delay_min[index], p_ccb->fcrb.ack_delay_max[index], - p_ccb->fcrb.ack_q_count_avg[index], p_ccb->fcrb.ack_q_count_min[index], p_ccb->fcrb.ack_q_count_max[index] ); - - BT_TRACE_1(TRACE_CTRL_GENERAL | TRACE_LAYER_GKI | TRACE_ORG_GKI , TRACE_TYPE_GENERIC, "%s", str); - - index = (index + 1) % L2CAP_ERTM_STATS_NUM_AVG; - p_ccb->fcrb.ack_delay_avg_index = index; - - p_ccb->fcrb.ack_q_count_max[index] = 0; - p_ccb->fcrb.ack_q_count_min[index] = 0xFFFFFFFF; - p_ccb->fcrb.ack_q_count_avg[index] = 0; - - - p_ccb->fcrb.ack_delay_max[index] = 0; - p_ccb->fcrb.ack_delay_min[index] = 0xFFFFFFFF; - p_ccb->fcrb.ack_delay_avg[index] = 0; - - p_ccb->fcrb.throughput[index] = 0; - } -} -#endif - - - diff --git a/src/revolution/BTE/stack/l2cap/l2c_link.c b/src/revolution/BTE/stack/l2cap/l2c_link.c index 401084a93..adac8382a 100644 --- a/src/revolution/BTE/stack/l2cap/l2c_link.c +++ b/src/revolution/BTE/stack/l2cap/l2c_link.c @@ -1,3 +1,13 @@ +/****************************************************************************** + * + * NOTICE OF CHANGES + * 2026/09/24: + * - Defined out unused functions for RVL + * + * Compile with REVOLUTION defined to include these changes. + * + ******************************************************************************/ + /****************************************************************************** * * Copyright (C) 1999-2012 Broadcom Corporation @@ -794,6 +804,7 @@ void l2c_link_adjust_allocation (void) ** Returns void ** *******************************************************************************/ +#ifndef REVOLUTION void l2c_link_adjust_chnl_allocation (void) { tL2C_CCB *p_ccb; @@ -895,6 +906,7 @@ void l2c_link_adjust_chnl_allocation (void) l2cu_check_channel_congestion (p_ccb); } } +#endif /******************************************************************************* ** From 5439f6e5559f30f716e5fc6b424717f07d269570 Mon Sep 17 00:00:00 2001 From: Texline666 <93364055+Tanline666@users.noreply.github.com> Date: Fri, 25 Sep 2026 14:25:26 -0600 Subject: [PATCH 2/3] Hotfixes: added missing BTE source file in Rev 0, WUD rev 0 support WIP --- config/RSPE01_00/splits.txt | 19 ++ config/RSPE01_00/symbols.txt | 457 ++++++++++++++++----------- configure.py | 2 +- include/revolution/WUD/WUDInternal.h | 2 + src/revolution/WUD/WUD.c | 70 ++++ src/revolution/WUD/WUDHidHost.c | 4 + 6 files changed, 369 insertions(+), 185 deletions(-) diff --git a/config/RSPE01_00/splits.txt b/config/RSPE01_00/splits.txt index 17af552f8..f1cbce23c 100644 --- a/config/RSPE01_00/splits.txt +++ b/config/RSPE01_00/splits.txt @@ -613,6 +613,21 @@ revolution/VI/i2c.c: revolution/VI/vi3in1.c: .text start:0x800D6B3C end:0x800D81F0 +revolution/WUD/WUD.c: + .text start:0x800D81F0 end:0x800DC060 + .data start:0x80372DF0 end:0x80373BB8 + .bss start:0x803ED5E0 end:0x803EF340 + .sdata start:0x804DDF40 end:0x804DDF48 + .sbss start:0x804DF6C8 end:0x804DF6E8 + .sdata2 start:0x804E1328 end:0x804E1330 + +revolution/WUD/WUDHidHost.c: + .text start:0x800DC060 end:0x800DC560 + .data start:0x80373BB8 end:0x80373E38 + +revolution/WUD/debug_msg.c: + .text start:0x800DC560 end:0x800DC5B0 + revolution/ARC/arc.c: .text start:0x800DCAD4 end:0x800DD454 .data start:0x80373E80 end:0x80373EF0 @@ -638,6 +653,10 @@ revolution/BTE/gki/common/gki_buffer.c: revolution/BTE/gki/common/gki_time.c: .text start:0x800E5594 end:0x800E5AEC +revolution/BTE/rvl/gki_ppc.c: + .text start:0x800E5AEC end:0x800E5D7C + .bss start:0x80409F00 end:0x804329E0 + revolution/DVD/dvdfs.c: .text start:0x80112C00 end:0x80113648 .data start:0x8037E400 end:0x8037E568 diff --git a/config/RSPE01_00/symbols.txt b/config/RSPE01_00/symbols.txt index 27fb6cee5..683a911e0 100644 --- a/config/RSPE01_00/symbols.txt +++ b/config/RSPE01_00/symbols.txt @@ -4024,7 +4024,7 @@ fn_800C860C = .text:0x800C860C; // type:function size:0x80 OSLoadContext = .text:0x800C868C; // type:function size:0xD8 scope:global OSGetStackPointer = .text:0x800C8764; // type:function size:0x8 scope:global fn_800C876C = .text:0x800C876C; // type:function size:0x30 -fn_800C879C = .text:0x800C879C; // type:function size:0x30 +OSSwitchFiberEx = .text:0x800C879C; // type:function size:0x30 OSClearContext = .text:0x800C87CC; // type:function size:0x24 scope:global fn_800C87F0 = .text:0x800C87F0; // type:function size:0xBC OSDumpContext = .text:0x800C88AC; // type:function size:0x260 scope:global @@ -4264,72 +4264,72 @@ __VISetRGBOverDrive = .text:0x800D7CF8; // type:function size:0x84 fn_800D7D7C = .text:0x800D7D7C; // type:function size:0x48 __VISetRevolutionModeSimple = .text:0x800D7DC4; // type:function size:0x42C App_MEMalloc = .text:0x800D81F0; // type:function size:0x50 -fn_800D8240 = .text:0x800D8240; // type:function size:0x50 -fn_800D8290 = .text:0x800D8290; // type:function size:0x78 -fn_800D8308 = .text:0x800D8308; // type:function size:0x58 -fn_800D8360 = .text:0x800D8360; // type:function size:0x58 -fn_800D83B8 = .text:0x800D83B8; // type:function size:0x14 -fn_800D83CC = .text:0x800D83CC; // type:function size:0x1E4 -fn_800D85B0 = .text:0x800D85B0; // type:function size:0x158 -fn_800D8708 = .text:0x800D8708; // type:function size:0x138 -fn_800D8840 = .text:0x800D8840; // type:function size:0x80C -fn_800D904C = .text:0x800D904C; // type:function size:0x20 -fn_800D906C = .text:0x800D906C; // type:function size:0x98 -fn_800D9104 = .text:0x800D9104; // type:function size:0xB4 -fn_800D91B8 = .text:0x800D91B8; // type:function size:0x134 -fn_800D92EC = .text:0x800D92EC; // type:function size:0x20 -fn_800D930C = .text:0x800D930C; // type:function size:0x114 -fn_800D9420 = .text:0x800D9420; // type:function size:0x1D4 -fn_800D95F4 = .text:0x800D95F4; // type:function size:0x20 -fn_800D9614 = .text:0x800D9614; // type:function size:0x124 -fn_800D9738 = .text:0x800D9738; // type:function size:0x9C -fn_800D97D4 = .text:0x800D97D4; // type:function size:0x20 -fn_800D97F4 = .text:0x800D97F4; // type:function size:0x84 -fn_800D9878 = .text:0x800D9878; // type:function size:0x20 -fn_800D9898 = .text:0x800D9898; // type:function size:0x370 -fn_800D9C08 = .text:0x800D9C08; // type:function size:0x4C -fn_800D9C54 = .text:0x800D9C54; // type:function size:0x4 -fn_800D9C58 = .text:0x800D9C58; // type:function size:0x124 -fn_800D9D7C = .text:0x800D9D7C; // type:function size:0x3C +App_MEMfree = .text:0x800D8240; // type:function size:0x50 +SyncFlushCallback = .text:0x800D8290; // type:function size:0x78 +DeleteFlushCallback = .text:0x800D8308; // type:function size:0x58 +ShutFlushCallback = .text:0x800D8360; // type:function size:0x58 +_resumeSmpSync = .text:0x800D83B8; // type:function size:0x14 +WUDiIsSyncDisabled = .text:0x800D83CC; // type:function size:0x1E4 +WUDiSaveDeviceToNand = .text:0x800D85B0; // type:function size:0x158 +WUDiSyncDone = .text:0x800D8708; // type:function size:0x138 +SyncHandler = .text:0x800D8840; // type:function size:0x80C +SyncHandler0 = .text:0x800D904C; // type:function size:0x20 +WUDiTerminateDevice = .text:0x800D906C; // type:function size:0x98 +WUDiDeleteDevice = .text:0x800D9104; // type:function size:0xB4 +DeleteAllHandler = .text:0x800D91B8; // type:function size:0x134 +DeleteAllHandler0 = .text:0x800D92EC; // type:function size:0x20 +WUDiClearUnregisteredDevice = .text:0x800D930C; // type:function size:0x114 +EnableStackHandler = .text:0x800D9420; // type:function size:0x1D4 +EnableStackHandler0 = .text:0x800D95F4; // type:function size:0x20 +WUDiGetRegisteredDevice = .text:0x800D9614; // type:function size:0x124 +InitHandler = .text:0x800D9738; // type:function size:0x9C +InitHandler0 = .text:0x800D97D4; // type:function size:0x20 +ShutdownHandler = .text:0x800D97F4; // type:function size:0x84 +ShutdownHandler0 = .text:0x800D9878; // type:function size:0x20 +InitCore = .text:0x800D9898; // type:function size:0x370 +WUDRegisterAllocator = .text:0x800D9C08; // type:function size:0x4C +WUDGetAllocatedMemSize = .text:0x800D9C54; // type:function size:0x4 +WUDShutdown = .text:0x800D9C58; // type:function size:0x124 +WUDGetStatus = .text:0x800D9D7C; // type:function size:0x3C WUDGetBufferStatus = .text:0x800D9DB8; // type:function size:0x48 -fn_800D9E00 = .text:0x800D9E00; // type:function size:0x6C -fn_800D9E6C = .text:0x800D9E6C; // type:function size:0x5C -fn_800D9EC8 = .text:0x800D9EC8; // type:function size:0x5C -fn_800D9F24 = .text:0x800D9F24; // type:function size:0x134 -fn_800DA058 = .text:0x800DA058; // type:function size:0x8C -fn_800DA0E4 = .text:0x800DA0E4; // type:function size:0x8C -fn_800DA170 = .text:0x800DA170; // type:function size:0x120 -fn_800DA290 = .text:0x800DA290; // type:function size:0xEC -fn_800DA37C = .text:0x800DA37C; // type:function size:0x5C -fn_800DA3D8 = .text:0x800DA3D8; // type:function size:0x5C -fn_800DA434 = .text:0x800DA434; // type:function size:0x58 -fn_800DA48C = .text:0x800DA48C; // type:function size:0x170 -fn_800DA5FC = .text:0x800DA5FC; // type:function size:0x228 -fn_800DA824 = .text:0x800DA824; // type:function size:0xC4 -fn_800DA8E8 = .text:0x800DA8E8; // type:function size:0x158 -fn_800DAA40 = .text:0x800DAA40; // type:function size:0x110 -fn_800DAB50 = .text:0x800DAB50; // type:function size:0x144 -fn_800DAC94 = .text:0x800DAC94; // type:function size:0xD8 -fn_800DAD6C = .text:0x800DAD6C; // type:function size:0xC0 -fn_800DAE2C = .text:0x800DAE2C; // type:function size:0x118 -fn_800DAF44 = .text:0x800DAF44; // type:function size:0x118 -fn_800DB05C = .text:0x800DB05C; // type:function size:0x34 -fn_800DB090 = .text:0x800DB090; // type:function size:0x534 -fn_800DB5C4 = .text:0x800DB5C4; // type:function size:0x1EC -fn_800DB7B0 = .text:0x800DB7B0; // type:function size:0x338 -fn_800DBAE8 = .text:0x800DBAE8; // type:function size:0x50 -fn_800DBB38 = .text:0x800DBB38; // type:function size:0x2EC -fn_800DBE24 = .text:0x800DBE24; // type:function size:0xF4 -fn_800DBF18 = .text:0x800DBF18; // type:function size:0x54 +WUDSetSniffMode = .text:0x800D9E00; // type:function size:0x6C +WUDSetSyncSimpleCallback = .text:0x800D9E6C; // type:function size:0x5C +WUDSetClearDeviceCallback = .text:0x800D9EC8; // type:function size:0x5C +StartSyncDevice = .text:0x800D9F24; // type:function size:0x134 +WUDStartFastSyncSimple = .text:0x800DA058; // type:function size:0x8C +WUDStartSyncSimple = .text:0x800DA0E4; // type:function size:0x8C +WUDStartClearDevice = .text:0x800DA170; // type:function size:0x120 +WUDSetDisableChannel = .text:0x800DA290; // type:function size:0xEC +WUDSetHidRecvCallback = .text:0x800DA37C; // type:function size:0x5C +WUDSetHidConnCallback = .text:0x800DA3D8; // type:function size:0x5C +WUDSetVisibility = .text:0x800DA434; // type:function size:0x58 +remove_patch_cb = .text:0x800DA48C; // type:function size:0x170 +write_patch_cb = .text:0x800DA5FC; // type:function size:0x228 +install_patch_cb = .text:0x800DA824; // type:function size:0xC4 +WUDiInitSub = .text:0x800DA8E8; // type:function size:0x158 +WUDiRegisterDevice = .text:0x800DAA40; // type:function size:0x110 +WUDiRemoveDevice = .text:0x800DAB50; // type:function size:0x144 +WUDiGetDevInfo = .text:0x800DAC94; // type:function size:0xD8 +WUDiGetNewDevInfo = .text:0x800DAD6C; // type:function size:0xC0 +WUDiMoveTopSmpDevInfoPtr = .text:0x800DAE2C; // type:function size:0x118 +WUDiMoveBottomSmpDevInfoPtr = .text:0x800DAF44; // type:function size:0x118 +CleanupCallback = .text:0x800DB05C; // type:function size:0x34 +WUDSecurityCallback = .text:0x800DB090; // type:function size:0x534 +WUDSearchCallback = .text:0x800DB5C4; // type:function size:0x1EC +WUDVendorSpecificCallback = .text:0x800DB7B0; // type:function size:0x338 +WUDDeviceStatusCallback = .text:0x800DBAE8; // type:function size:0x50 +WUDStoredLinkKeyCallback = .text:0x800DBB38; // type:function size:0x2EC +WUDPowerManagerCallback = .text:0x800DBE24; // type:function size:0xF4 +_WUDGetDevAddr = .text:0x800DBF18; // type:function size:0x54 _WUDGetQueuedSize = .text:0x800DBF6C; // type:function size:0x5C _WUDGetNotAckedSize = .text:0x800DBFC8; // type:function size:0x5C _WUDGetLinkNumber = .text:0x800DC024; // type:function size:0x3C -fn_800DC060 = .text:0x800DC060; // type:function size:0x49C -fn_800DC4FC = .text:0x800DC4FC; // type:function size:0x3C -fn_800DC538 = .text:0x800DC538; // type:function size:0x10 -fn_800DC548 = .text:0x800DC548; // type:function size:0x10 -fn_800DC558 = .text:0x800DC558; // type:function size:0x8 -fn_800DC560 = .text:0x800DC560; // type:function size:0x50 +WUDHidHostCallback = .text:0x800DC060; // type:function size:0x49C +bta_hh_co_data = .text:0x800DC4FC; // type:function size:0x3C +bta_hh_co_open = .text:0x800DC538; // type:function size:0x10 +bta_hh_co_close = .text:0x800DC548; // type:function size:0x10 +bta_dm_co_get_compress_memory = .text:0x800DC558; // type:function size:0x8 +WUD_DEBUGPrint = .text:0x800DC560; // type:function size:0x50 fn_800DC5B0 = .text:0x800DC5B0; // type:function size:0x44 fn_800DC5F4 = .text:0x800DC5F4; // type:function size:0x7C fn_800DC670 = .text:0x800DC670; // type:function size:0x14 @@ -4551,7 +4551,7 @@ GKI_disable = .text:0x800E5D04; // type:function size:0x44 GKI_exception = .text:0x800E5D48; // type:function size:0x4 GKI_os_malloc = .text:0x800E5D4C; // type:function size:0x2C GKI_os_free = .text:0x800E5D78; // type:function size:0x4 -fn_800E5D7C = .text:0x800E5D7C; // type:function size:0x24 +hcisu_h2_usb_cback = .text:0x800E5D7C; // type:function size:0x24 fn_800E5DA0 = .text:0x800E5DA0; // type:function size:0x398 fn_800E6138 = .text:0x800E6138; // type:function size:0x1AC fn_800E62E4 = .text:0x800E62E4; // type:function size:0x2C @@ -4671,20 +4671,20 @@ fn_800EA650 = .text:0x800EA650; // type:function size:0x6C fn_800EA6BC = .text:0x800EA6BC; // type:function size:0xE4 fn_800EA7A0 = .text:0x800EA7A0; // type:function size:0x238 fn_800EA9D8 = .text:0x800EA9D8; // type:function size:0x108 -fn_800EAAE0 = .text:0x800EAAE0; // type:function size:0x84 -fn_800EAB64 = .text:0x800EAB64; // type:function size:0x1C -fn_800EAB80 = .text:0x800EAB80; // type:function size:0x4 -fn_800EAB84 = .text:0x800EAB84; // type:function size:0x50 -fn_800EABD4 = .text:0x800EABD4; // type:function size:0x88 -fn_800EAC5C = .text:0x800EAC5C; // type:function size:0x38 -fn_800EAC94 = .text:0x800EAC94; // type:function size:0x38 -fn_800EACCC = .text:0x800EACCC; // type:function size:0x64 -fn_800EAD30 = .text:0x800EAD30; // type:function size:0x58 -fn_800EAD88 = .text:0x800EAD88; // type:function size:0x84 -fn_800EAE0C = .text:0x800EAE0C; // type:function size:0x38 -fn_800EAE44 = .text:0x800EAE44; // type:function size:0x8C -fn_800EAED0 = .text:0x800EAED0; // type:function size:0xF0 -fn_800EAFC0 = .text:0x800EAFC0; // type:function size:0x48 +bta_dm_keep_acl = .text:0x800EAAE0; // type:function size:0x84 +bta_dm_immediate_disable = .text:0x800EAB64; // type:function size:0x1C +bta_dm_reset_complete = .text:0x800EAB80; // type:function size:0x4 +bta_dm_send_hci_reset = .text:0x800EAB84; // type:function size:0x50 +BTA_EnableBluetooth = .text:0x800EABD4; // type:function size:0x88 +BTA_DisableBluetooth = .text:0x800EAC5C; // type:function size:0x38 +BTA_DmIsDeviceUp = .text:0x800EAC94; // type:function size:0x38 +BTA_DmSetDeviceName = .text:0x800EACCC; // type:function size:0x64 +BTA_DmSetVisibility = .text:0x800EAD30; // type:function size:0x58 +BTA_DmSearch = .text:0x800EAD88; // type:function size:0x84 +BTA_DmSearchCancel = .text:0x800EAE0C; // type:function size:0x38 +BTA_DmPinReply = .text:0x800EAE44; // type:function size:0x8C +BTA_DmAddDevice = .text:0x800EAED0; // type:function size:0xF0 +BTA_DmRemoveDevice = .text:0x800EAFC0; // type:function size:0x48 fn_800EB008 = .text:0x800EB008; // type:function size:0x38 fn_800EB040 = .text:0x800EB040; // type:function size:0x98 fn_800EB0D8 = .text:0x800EB0D8; // type:function size:0xC8 @@ -4719,8 +4719,8 @@ fn_800ED38C = .text:0x800ED38C; // type:function size:0x38 fn_800ED3C4 = .text:0x800ED3C4; // type:function size:0x64 fn_800ED428 = .text:0x800ED428; // type:function size:0xB4 fn_800ED4DC = .text:0x800ED4DC; // type:function size:0x90 -fn_800ED56C = .text:0x800ED56C; // type:function size:0xA8 -fn_800ED614 = .text:0x800ED614; // type:function size:0x6C +BTA_HhAddDev = .text:0x800ED56C; // type:function size:0xA8 +BTA_HhRemoveDev = .text:0x800ED614; // type:function size:0x6C fn_800ED680 = .text:0x800ED680; // type:function size:0x54 fn_800ED6D4 = .text:0x800ED6D4; // type:function size:0x354 fn_800EDA28 = .text:0x800EDA28; // type:function size:0x14C @@ -4730,19 +4730,19 @@ fn_800EDD64 = .text:0x800EDD64; // type:function size:0x80 fn_800EDDE4 = .text:0x800EDDE4; // type:function size:0xBC fn_800EDEA0 = .text:0x800EDEA0; // type:function size:0x54 fn_800EDEF4 = .text:0x800EDEF4; // type:function size:0xE0 -fn_800EDFD4 = .text:0x800EDFD4; // type:function size:0x1C -fn_800EDFF0 = .text:0x800EDFF0; // type:function size:0x84 -fn_800EE074 = .text:0x800EE074; // type:function size:0x314 -fn_800EE388 = .text:0x800EE388; // type:function size:0xC4 -fn_800EE44C = .text:0x800EE44C; // type:function size:0x64 -fn_800EE4B0 = .text:0x800EE4B0; // type:function size:0x21C -fn_800EE6CC = .text:0x800EE6CC; // type:function size:0x170 -fn_800EE83C = .text:0x800EE83C; // type:function size:0x1F0 -fn_800EEA2C = .text:0x800EEA2C; // type:function size:0x10 +btm_acl_init = .text:0x800EDFD4; // type:function size:0x1C +btm_handle_to_acl_index = .text:0x800EDFF0; // type:function size:0x84 +btm_acl_created = .text:0x800EE074; // type:function size:0x314 +btm_acl_removed = .text:0x800EE388; // type:function size:0xC4 +btm_acl_device_down = .text:0x800EE44C; // type:function size:0x64 +BTM_SwitchRole = .text:0x800EE4B0; // type:function size:0x21C +btm_acl_encrypt_change = .text:0x800EE6CC; // type:function size:0x170 +BTM_SetLinkPolicy = .text:0x800EE83C; // type:function size:0x1F0 +BTM_SetDefaultLinkPolicy = .text:0x800EEA2C; // type:function size:0x10 fn_800EEA3C = .text:0x800EEA3C; // type:function size:0x104 -fn_800EEB40 = .text:0x800EEB40; // type:function size:0x8C -fn_800EEBCC = .text:0x800EEBCC; // type:function size:0x22C -fn_800EEDF8 = .text:0x800EEDF8; // type:function size:0x10 +btm_read_remote_version_complete = .text:0x800EEB40; // type:function size:0x8C +btm_read_remote_features_complete = .text:0x800EEBCC; // type:function size:0x22C +BTM_SetDefaultLinkSuperTout = .text:0x800EEDF8; // type:function size:0x10 fn_800EEE08 = .text:0x800EEE08; // type:function size:0xD8 fn_800EEEE0 = .text:0x800EEEE0; // type:function size:0x5C fn_800EEF3C = .text:0x800EEF3C; // type:function size:0x10 @@ -4757,43 +4757,43 @@ fn_800EF590 = .text:0x800EF590; // type:function size:0x13C fn_800EF6CC = .text:0x800EF6CC; // type:function size:0x13C fn_800EF808 = .text:0x800EF808; // type:function size:0x11C fn_800EF924 = .text:0x800EF924; // type:function size:0x118 -fn_800EFA3C = .text:0x800EFA3C; // type:function size:0xBC -fn_800EFAF8 = .text:0x800EFAF8; // type:function size:0x220 -fn_800EFD18 = .text:0x800EFD18; // type:function size:0x188 -fn_800EFEA0 = .text:0x800EFEA0; // type:function size:0xAC -fn_800EFF4C = .text:0x800EFF4C; // type:function size:0xA0 -fn_800EFFEC = .text:0x800EFFEC; // type:function size:0x120 -fn_800F010C = .text:0x800F010C; // type:function size:0xB8 -fn_800F01C4 = .text:0x800F01C4; // type:function size:0x88 +btm_remove_acl = .text:0x800EFA3C; // type:function size:0xBC +btm_chg_all_acl_pkt_types = .text:0x800EFAF8; // type:function size:0x220 +BTM_SecAddDevice = .text:0x800EFD18; // type:function size:0x188 +BTM_SecDeleteDevice = .text:0x800EFEA0; // type:function size:0xAC +BTM_SecReadDevName = .text:0x800EFF4C; // type:function size:0xA0 +btm_sec_alloc_dev = .text:0x800EFFEC; // type:function size:0x120 +btm_find_dev_by_handle = .text:0x800F010C; // type:function size:0xB8 +btm_find_dev = .text:0x800F01C4; // type:function size:0x88 fn_800F024C = .text:0x800F024C; // type:function size:0x198 fn_800F03E4 = .text:0x800F03E4; // type:function size:0xA0 fn_800F0484 = .text:0x800F0484; // type:function size:0xB0 fn_800F0534 = .text:0x800F0534; // type:function size:0x9C fn_800F05D0 = .text:0x800F05D0; // type:function size:0xA8 -fn_800F0678 = .text:0x800F0678; // type:function size:0x1C -fn_800F0694 = .text:0x800F0694; // type:function size:0xF0 -fn_800F0784 = .text:0x800F0784; // type:function size:0x298 +BTM_IsDeviceUp = .text:0x800F0678; // type:function size:0x1C +BTM_SetAfhChannels = .text:0x800F0694; // type:function size:0xF0 +btm_dev_timeout = .text:0x800F0784; // type:function size:0x298 fn_800F0A1C = .text:0x800F0A1C; // type:function size:0x1C4 fn_800F0BE0 = .text:0x800F0BE0; // type:function size:0xC8 fn_800F0CA8 = .text:0x800F0CA8; // type:function size:0xBC fn_800F0D64 = .text:0x800F0D64; // type:function size:0x4FC -fn_800F1260 = .text:0x800F1260; // type:function size:0xB8 +BTM_SetLocalDeviceName = .text:0x800F1260; // type:function size:0xB8 fn_800F1318 = .text:0x800F1318; // type:function size:0x8C -fn_800F13A4 = .text:0x800F13A4; // type:function size:0x40 +BTM_ReadLocalDeviceAddr = .text:0x800F13A4; // type:function size:0x40 fn_800F13E4 = .text:0x800F13E4; // type:function size:0x48 -fn_800F142C = .text:0x800F142C; // type:function size:0x4C -fn_800F1478 = .text:0x800F1478; // type:function size:0x80 -fn_800F14F8 = .text:0x800F14F8; // type:function size:0x10 -fn_800F1508 = .text:0x800F1508; // type:function size:0x10 -fn_800F1518 = .text:0x800F1518; // type:function size:0x18 -fn_800F1530 = .text:0x800F1530; // type:function size:0xFC -fn_800F162C = .text:0x800F162C; // type:function size:0x6C -fn_800F1698 = .text:0x800F1698; // type:function size:0x38 -fn_800F16D0 = .text:0x800F16D0; // type:function size:0x98 -fn_800F1768 = .text:0x800F1768; // type:function size:0xA0 -fn_800F1808 = .text:0x800F1808; // type:function size:0xD8 +BTM_ReadLocalVersion = .text:0x800F142C; // type:function size:0x4C +BTM_SetDeviceClass = .text:0x800F1478; // type:function size:0x80 +BTM_ReadDeviceClass = .text:0x800F14F8; // type:function size:0x10 +BTM_ReadLocalFeatures = .text:0x800F1508; // type:function size:0x10 +BTM_RegisterForDeviceStatusNotif = .text:0x800F1518; // type:function size:0x18 +BTM_VendorSpecificCommand = .text:0x800F1530; // type:function size:0xFC +btm_vsc_complete = .text:0x800F162C; // type:function size:0x6C +BTM_RegisterForVSEvents = .text:0x800F1698; // type:function size:0x38 +btm_vendor_specific_evt = .text:0x800F16D0; // type:function size:0x98 +BTM_WritePageTimeout = .text:0x800F1768; // type:function size:0xA0 +BTM_ReadStoredLinkKey = .text:0x800F1808; // type:function size:0xD8 fn_800F18E0 = .text:0x800F18E0; // type:function size:0xD0 -fn_800F19B0 = .text:0x800F19B0; // type:function size:0xD0 +BTM_DeleteStoredLinkKey = .text:0x800F19B0; // type:function size:0xD0 fn_800F1A80 = .text:0x800F1A80; // type:function size:0x7C fn_800F1AFC = .text:0x800F1AFC; // type:function size:0x5C fn_800F1B58 = .text:0x800F1B58; // type:function size:0x68 @@ -4822,15 +4822,15 @@ fn_800F2DF0 = .text:0x800F2DF0; // type:function size:0xDC fn_800F2ECC = .text:0x800F2ECC; // type:function size:0x104 fn_800F2FD0 = .text:0x800F2FD0; // type:function size:0xE4 fn_800F30B4 = .text:0x800F30B4; // type:function size:0x220 -fn_800F32D4 = .text:0x800F32D4; // type:function size:0x278 -fn_800F354C = .text:0x800F354C; // type:function size:0x104 -fn_800F3650 = .text:0x800F3650; // type:function size:0x150 -fn_800F37A0 = .text:0x800F37A0; // type:function size:0x158 -fn_800F38F8 = .text:0x800F38F8; // type:function size:0x40 -fn_800F3938 = .text:0x800F3938; // type:function size:0x5C -fn_800F3994 = .text:0x800F3994; // type:function size:0xBC -fn_800F3A50 = .text:0x800F3A50; // type:function size:0x1D0 -fn_800F3C20 = .text:0x800F3C20; // type:function size:0xB8 +btm_process_inq_results = .text:0x800F32D4; // type:function size:0x278 +btm_process_inq_complete = .text:0x800F354C; // type:function size:0x104 +btm_initiate_rem_name = .text:0x800F3650; // type:function size:0x150 +btm_process_remote_name = .text:0x800F37A0; // type:function size:0x158 +btm_inq_rmt_name_failed = .text:0x800F38F8; // type:function size:0x40 +btm_init = .text:0x800F3938; // type:function size:0x5C +BTM_PmRegister = .text:0x800F3994; // type:function size:0xBC +BTM_SetPowerMode = .text:0x800F3A50; // type:function size:0x1D0 +BTM_ReadPowerMode = .text:0x800F3C20; // type:function size:0xB8 fn_800F3CD8 = .text:0x800F3CD8; // type:function size:0x78 fn_800F3D50 = .text:0x800F3D50; // type:function size:0x50 fn_800F3DA0 = .text:0x800F3DA0; // type:function size:0x21C @@ -17056,42 +17056,136 @@ jumptable_803726CC = .data:0x803726CC; // type:object size:0x20 scope:local lbl_803726EC = .data:0x803726EC; // type:object size:0x154 @3823 = .data:0x80372840; // type:object size:0x20 scope:local lbl_80372860 = .data:0x80372860; // type:object size:0x590 -lbl_80372DF0 = .data:0x80372DF0; // type:object size:0xDC +descriptor = .data:0x80372DF0; // type:object size:0xD9 lbl_80372ECC = .data:0x80372ECC; // type:object size:0xE data:string -lbl_80372EDC = .data:0x80372EDC; // type:object size:0xD data:string -lbl_80372EEC = .data:0x80372EEC; // type:object size:0x24 data:string -lbl_80372F10 = .data:0x80372F10; // type:object size:0x28 data:string -lbl_80372F38 = .data:0x80372F38; // type:object size:0x28 data:string -lbl_80372F60 = .data:0x80372F60; // type:object size:0x1F data:string -lbl_80372F80 = .data:0x80372F80; // type:object size:0x10C -jumptable_8037308C = .data:0x8037308C; // type:object size:0x24 scope:local -lbl_803730B0 = .data:0x803730B0; // type:object size:0xDC -lbl_8037318C = .data:0x8037318C; // type:object size:0x17 data:string -lbl_803731A4 = .data:0x803731A4; // type:object size:0x14 data:string -lbl_803731B8 = .data:0x803731B8; // type:object size:0xF data:string -lbl_803731C8 = .data:0x803731C8; // type:object size:0x1A data:string -lbl_803731E4 = .data:0x803731E4; // type:object size:0x34 -lbl_80373218 = .data:0x80373218; // type:object size:0x30 -lbl_80373248 = .data:0x80373248; // type:object size:0x15 data:string -lbl_80373260 = .data:0x80373260; // type:object size:0x17 data:string -lbl_80373278 = .data:0x80373278; // type:object size:0x18 data:string -lbl_80373290 = .data:0x80373290; // type:object size:0x1B data:string -lbl_803732AC = .data:0x803732AC; // type:object size:0x19 data:string -lbl_803732C8 = .data:0x803732C8; // type:object size:0x19 data:string -lbl_803732E8 = .data:0x803732E8; // type:object size:0x40 data:byte -lbl_80373328 = .data:0x80373328; // type:object size:0x44 data:byte -lbl_8037336C = .data:0x8037336C; // type:object size:0x138 -lbl_803734A4 = .data:0x803734A4; // type:object size:0x17 data:string -lbl_803734BC = .data:0x803734BC; // type:object size:0x27C -jumptable_80373738 = .data:0x80373738; // type:object size:0x24 scope:local -lbl_8037375C = .data:0x8037375C; // type:object size:0x17C +@3895 = .data:0x80372EDC; // type:object size:0xD data:string +@3901 = .data:0x80372EEC; // type:object size:0x24 data:string +@3906 = .data:0x80372F10; // type:object size:0x28 data:string +@3908 = .data:0x80372F38; // type:object size:0x28 data:string +@4057 = .data:0x80372F60; // type:object size:0x1F data:string +@3944 = .data:0x80372F80; // type:object size:0xE data:string +@4122 = .data:0x80372F90; // type:object size:0x11 data:string +@4123 = .data:0x80372FA4; // type:object size:0x17 data:string +@4238 = .data:0x80372FBC; // type:object size:0x26 data:string +@4239 = .data:0x80372FE8; // type:object size:0x58 data:string +@4240 = .data:0x80373040; // type:object size:0x2F data:string +@4241 = .data:0x80373070; // type:object size:0x19 data:string +@4291 = .data:0x8037308C; // type:object size:0x24 scope:local +@4331 = .data:0x803730B0; // type:object size:0x16 data:string +@4332 = .data:0x803730C8; // type:object size:0x16 data:string +@4333 = .data:0x803730E0; // type:object size:0x16 data:string +@4334 = .data:0x803730F8; // type:object size:0x16 data:string +lbl_80373110 = .data:0x80373110; // type:object size:0x16 data:string +@4336 = .data:0x80373128; // type:object size:0x27 data:string +@4337 = .data:0x80373150; // type:object size:0x1A data:string +@4349 = .data:0x8037316C; // type:object size:0x14 data:string +@4350 = .data:0x80373180; // type:object size:0xB data:string +@4422 = .data:0x8037318C; // type:object size:0x17 data:string +@4423 = .data:0x803731A4; // type:object size:0x14 data:string +@4438 = .data:0x803731B8; // type:object size:0xF data:string +@4446 = .data:0x803731C8; // type:object size:0x1A data:string +@4449 = .data:0x803731E4; // type:object size:0x1B data:string +lbl_803731FF = .data:0x80373200; // type:object size:0x16 data:string +@4335 = .data:0x80373218; // type:object size:0x30 +@4481 = .data:0x80373248; // type:object size:0x15 data:string +@4488 = .data:0x80373260; // type:object size:0x17 data:string +@4366 = .data:0x80373278; // type:object size:0x18 data:string +@4367 = .data:0x80373290; // type:object size:0x1B data:string +@4369 = .data:0x803732AC; // type:object size:0x19 data:string +@4372 = .data:0x803732C8; // type:object size:0x19 data:string +patch_binary = .data:0x803732E8; // type:object size:0x40 data:byte +patch_install = .data:0x80373328; // type:object size:0x42 data:byte +@4551 = .data:0x8037336C; // type:object size:0x15 data:string +@4565 = .data:0x80373388; // type:object size:0x10 data:string +@4567 = .data:0x80373398; // type:object size:0x12 data:string +@4582 = .data:0x803733AC; // type:object size:0x19 data:string +@4592 = .data:0x803733C8; // type:object size:0x17 data:string +@4593 = .data:0x803733E0; // type:object size:0x10 data:string +@4600 = .data:0x803733F0; // type:object size:0x15 data:string +@4601 = .data:0x80373408; // type:object size:0x35 data:string +@4602 = .data:0x80373440; // type:object size:0x23 data:string +@4603 = .data:0x80373464; // type:object size:0x13 data:string +@4604 = .data:0x80373478; // type:object size:0xE data:string +@4605 = .data:0x80373488; // type:object size:0x1A data:string +@4635 = .data:0x803734A4; // type:object size:0x17 data:string +@4733 = .data:0x803734BC; // type:object size:0x1D data:string +@4797 = .data:0x803734DC; // type:object size:0x16 data:string +@4798 = .data:0x803734F8; // type:object size:0x10 data:string +@4799 = .data:0x80373508; // type:object size:0x26 data:string +@4800 = .data:0x80373530; // type:object size:0x11 data:string +@4801 = .data:0x80373544; // type:object size:0x14 data:string +@4802 = .data:0x80373558; // type:object size:0x16 data:string +@4803 = .data:0x80373570; // type:object size:0x28 data:string +@4804 = .data:0x80373598; // type:object size:0x5A data:string +@4805 = .data:0x803735F4; // type:object size:0xF data:string +@4806 = .data:0x80373604; // type:object size:0x16 data:string +@4807 = .data:0x8037361C; // type:object size:0x14 data:string +@4808 = .data:0x80373630; // type:object size:0x29 data:string +@4809 = .data:0x8037365C; // type:object size:0x26 data:string +@4810 = .data:0x80373684; // type:object size:0xB data:string +@4811 = .data:0x80373690; // type:object size:0xE data:string +@4812 = .data:0x803736A0; // type:object size:0x16 data:string +@4813 = .data:0x803736B8; // type:object size:0xC data:string +@4814 = .data:0x803736C4; // type:object size:0x1B data:string +@4815 = .data:0x803736E0; // type:object size:0x23 data:string +@4816 = .data:0x80373704; // type:object size:0x19 data:string +@4817 = .data:0x80373720; // type:object size:0x17 data:string +@4819 = .data:0x80373738; // type:object size:0x24 scope:local +@4835 = .data:0x8037375C; // type:object size:0x43 data:string +@4836 = .data:0x803737A0; // type:object size:0x13 data:string +@4837 = .data:0x803737B4; // type:object size:0x3D data:string +lbl_803737F4 = .data:0x803737F4; // type:object size:0x14 data:string +lbl_80373808 = .data:0x80373808; // type:object size:0x10 data:string +lbl_80373818 = .data:0x80373818; // type:object size:0x30 data:string +lbl_80373848 = .data:0x80373848; // type:object size:0x18 data:string +lbl_80373860 = .data:0x80373860; // type:object size:0x17 data:string +lbl_80373877 = .data:0x80373878; // type:object size:0x23 data:string +lbl_8037389B = .data:0x8037389C; // type:object size:0x26 data:string +lbl_803738C2 = .data:0x803738C4; // type:object size:0x14 data:string lbl_803738D8 = .data:0x803738D8; // type:object size:0x19 data:string -lbl_803738F4 = .data:0x803738F4; // type:object size:0x2C4 -lbl_80373BB8 = .data:0x80373BB8; // type:object size:0x200 +lbl_803738F4 = .data:0x803738F4; // type:object size:0x25 data:string +lbl_80373919 = .data:0x8037391C; // type:object size:0x1D data:string +lbl_80373939 = .data:0x8037393C; // type:object size:0x29 data:string +lbl_80373965 = .data:0x80373968; // type:object size:0x5A data:string +lbl_803739C2 = .data:0x803739C4; // type:object size:0x23 data:string +lbl_803739E7 = .data:0x803739E8; // type:object size:0x28 data:string +lbl_80373A10 = .data:0x80373A10; // type:object size:0x22 data:string +lbl_80373A32 = .data:0x80373A34; // type:object size:0x2A data:string +lbl_80373A5E = .data:0x80373A60; // type:object size:0x23 data:string +lbl_80373A83 = .data:0x80373A84; // type:object size:0x1C data:string +lbl_80373AA0 = .data:0x80373AA0; // type:object size:0x24 data:string +lbl_80373AC4 = .data:0x80373AC4; // type:object size:0x1E data:string +lbl_80373AE2 = .data:0x80373AE4; // type:object size:0xF data:string +lbl_80373AF3 = .data:0x80373AF4; // type:object size:0x19 data:string +lbl_80373B0D = .data:0x80373B10; // type:object size:0x10 data:string +lbl_80373B20 = .data:0x80373B20; // type:object size:0x35 data:string +lbl_80373B55 = .data:0x80373B58; // type:object size:0x14 data:string +lbl_80373B6C = .data:0x80373B6C; // type:object size:0x17 data:string +lbl_80373B83 = .data:0x80373B84; // type:object size:0x19 data:string +lbl_80373B9D = .data:0x80373BA0; // type:object size:0x11 data:string +@1816 = .data:0x80373BB8; // type:object size:0x13 data:string +@1817 = .data:0x80373BCC; // type:object size:0x14 data:string +@1818 = .data:0x80373BE0; // type:object size:0x11 data:string +@1819 = .data:0x80373BF4; // type:object size:0x31 data:string +@1820 = .data:0x80373C28; // type:object size:0x10 data:string +@1821 = .data:0x80373C38; // type:object size:0x12 data:string +@1822 = .data:0x80373C4C; // type:object size:0x22 data:string +@1823 = .data:0x80373C70; // type:object size:0x14 data:string +@1824 = .data:0x80373C84; // type:object size:0x14 data:string +@1825 = .data:0x80373C98; // type:object size:0x16 data:string +@1826 = .data:0x80373CB0; // type:object size:0x16 data:string +@1827 = .data:0x80373CC8; // type:object size:0x15 data:string +@1828 = .data:0x80373CE0; // type:object size:0x15 data:string +@1829 = .data:0x80373CF8; // type:object size:0x15 data:string +@1830 = .data:0x80373D10; // type:object size:0x14 data:string +@1831 = .data:0x80373D24; // type:object size:0x3D data:string +@1832 = .data:0x80373D64; // type:object size:0x14 data:string +@1833 = .data:0x80373D78; // type:object size:0x16 data:string +@1834 = .data:0x80373D90; // type:object size:0x26 data:string jumptable_80373DB8 = .data:0x80373DB8; // type:object size:0x40 scope:local -lbl_80373DF8 = .data:0x80373DF8; // type:object size:0x15 data:string -lbl_80373E10 = .data:0x80373E10; // type:object size:0x12 data:string -lbl_80373E24 = .data:0x80373E24; // type:object size:0x13 data:string +@1842 = .data:0x80373DF8; // type:object size:0x15 data:string +@1845 = .data:0x80373E10; // type:object size:0x12 data:string +@1847 = .data:0x80373E24; // type:object size:0x13 data:string lbl_80373E38 = .data:0x80373E38; // type:object size:0x47 data:string @1001 = .data:0x80373E80; // type:object size:0x22 data:string @1060 = .data:0x80373EA4; // type:object size:0x46 data:string @@ -18751,15 +18845,15 @@ lbl_803ED440 = .bss:0x803ED440; // type:object size:0x78 lbl_803ED4B8 = .bss:0x803ED4B8; // type:object size:0x80 data:2byte lbl_803ED538 = .bss:0x803ED538; // type:object size:0x78 data:2byte lbl_803ED5B0 = .bss:0x803ED5B0; // type:object size:0x30 data:byte -lbl_803ED5E0 = .bss:0x803ED5E0; // type:object size:0x6C8 data:4byte +_wcb = .bss:0x803ED5E0; // type:object size:0x6C8 data:4byte lbl_803EDCA8 = .bss:0x803EDCA8; // type:object size:0x30 -lbl_803EDCD8 = .bss:0x803EDCD8; // type:object size:0x468 data:byte -lbl_803EE140 = .bss:0x803EE140; // type:object size:0x108 data:byte -lbl_803EE248 = .bss:0x803EE248; // type:object size:0x60 -lbl_803EE2A8 = .bss:0x803EE2A8; // type:object size:0x58 data:4byte -lbl_803EE300 = .bss:0x803EE300; // type:object size:0x1000 -lbl_803EF300 = .bss:0x803EF300; // type:object size:0x20 data:2byte -lbl_803EF320 = .bss:0x803EF320; // type:object size:0x20 data:2byte +_scArray = .bss:0x803EDCD8; // type:object size:0x461 data:byte +_discResp = .bss:0x803EE140; // type:object size:0x108 data:byte +_work = .bss:0x803EE248; // type:object size:0x60 +_dev_handle_to_bda = .bss:0x803EE2A8; // type:object size:0x40 data:4byte +__WUDHandlerStack = .bss:0x803EE300; // type:object size:0x1000 +_dev_handle_queue_size = .bss:0x803EF300; // type:object size:0x20 data:2byte +_dev_handle_notack_num = .bss:0x803EF320; // type:object size:0x20 data:2byte lbl_803EF340 = .bss:0x803EF340; // type:object size:0x80 data:4byte lbl_803EF3C0 = .bss:0x803EF3C0; // type:object size:0x80 data:4byte lbl_803EF440 = .bss:0x803EF440; // type:object size:0xD80 data:4byte @@ -20510,16 +20604,16 @@ lbl_804DF6B4 = .sbss:0x804DF6B4; // type:object size:0x4 data:4byte lbl_804DF6B8 = .sbss:0x804DF6B8; // type:object size:0x4 data:4byte lbl_804DF6BC = .sbss:0x804DF6BC; // type:object size:0x4 data:4byte lbl_804DF6C0 = .sbss:0x804DF6C0; // type:object size:0x8 data:4byte -lbl_804DF6C8 = .sbss:0x804DF6C8; // type:object size:0x4 data:4byte -lbl_804DF6CC = .sbss:0x804DF6CC; // type:object size:0x1 data:byte -lbl_804DF6D0 = .sbss:0x804DF6D0; // type:object size:0x1 -lbl_804DF6D1 = .sbss:0x804DF6D1; // type:object size:0x1 data:byte -lbl_804DF6D2 = .sbss:0x804DF6D2; // type:object size:0x1 data:byte -lbl_804DF6D4 = .sbss:0x804DF6D4; // type:object size:0x4 data:4byte -lbl_804DF6D8 = .sbss:0x804DF6D8; // type:object size:0x4 data:4byte -lbl_804DF6DC = .sbss:0x804DF6DC; // type:object size:0x4 data:4byte -lbl_804DF6E0 = .sbss:0x804DF6E0; // type:object size:0x1 data:byte -lbl_804DF6E1 = .sbss:0x804DF6E1; // type:object size:0x7 data:byte +_initialized = .sbss:0x804DF6C8; // type:object size:0x4 data:4byte +__bte_trace_level = .sbss:0x804DF6CC; // type:object size:0x1 data:byte +remove_patch = .sbss:0x804DF6D0; // type:object size:0x1 +install_num = .sbss:0x804DF6D1; // type:object size:0x1 data:byte +patch_num = .sbss:0x804DF6D2; // type:object size:0x1 data:byte +addr = .sbss:0x804DF6D4; // type:object size:0x4 data:4byte +offset = .sbss:0x804DF6D8; // type:object size:0x4 data:4byte +size = .sbss:0x804DF6DC; // type:object size:0x4 data:4byte +_discRssi = .sbss:0x804DF6E0; // type:object size:0x1 data:byte +_discNumResps = .sbss:0x804DF6E1; // type:object size:0x1 data:byte lbl_804DF6E8 = .sbss:0x804DF6E8; // type:object size:0x4 data:4byte lbl_804DF6EC = .sbss:0x804DF6EC; // type:object size:0x4 data:4byte lbl_804DF6F0 = .sbss:0x804DF6F0; // type:object size:0x4 data:4byte @@ -21882,13 +21976,8 @@ lbl_804E1320 = .sdata2:0x804E1320; // type:object size:0x2 data:2byte lbl_804E1322 = .sdata2:0x804E1322; // type:object size:0x2 data:2byte lbl_804E1324 = .sdata2:0x804E1324; // type:object size:0x2 data:2byte lbl_804E1326 = .sdata2:0x804E1326; // type:object size:0x2 data:2byte -lbl_804E1328 = .sdata2:0x804E1328; // type:object size:0x1 data:byte -lbl_804E1329 = .sdata2:0x804E1329; // type:object size:0x1 data:byte -lbl_804E132A = .sdata2:0x804E132A; // type:object size:0x1 data:byte -lbl_804E132B = .sdata2:0x804E132B; // type:object size:0x1 data:byte -lbl_804E132C = .sdata2:0x804E132C; // type:object size:0x1 data:byte -lbl_804E132D = .sdata2:0x804E132D; // type:object size:0x1 data:byte -lbl_804E132E = .sdata2:0x804E132E; // type:object size:0x1 data:byte +lbl_804E1328 = .sdata2:0x804E1328; // type:object size:0x4 data:byte +lbl_804E132C = .sdata2:0x804E132C; // type:object size:0x3 data:byte lbl_804E1330 = .sdata2:0x804E1330; // type:object size:0x4 align:4 data:float lbl_804E1334 = .sdata2:0x804E1334; // type:object size:0x4 align:4 data:float lbl_804E1338 = .sdata2:0x804E1338; // type:object size:0x4 align:4 data:float diff --git a/configure.py b/configure.py index 2a8866c6c..6db4e8006 100755 --- a/configure.py +++ b/configure.py @@ -1026,7 +1026,7 @@ def MatchingFor(*versions): Object(NonMatching, "revolution/VI/vi.c"), Object(NonMatching, "revolution/VI/i2c.c"), Object(NonMatching, "revolution/VI/vi3in1.c"), - Object(Matching, "revolution/WUD/WUD.c"), + Object(not MatchingFor("RSPE01_00"), "revolution/WUD/WUD.c"), Object(Matching, "revolution/WUD/WUDHidHost.c"), Object(Matching, "revolution/WUD/debug_msg.c"), Object(Matching, "revolution/AI/ai.c"), diff --git a/include/revolution/WUD/WUDInternal.h b/include/revolution/WUD/WUDInternal.h index 6ed4b2314..4a3fb8a45 100644 --- a/include/revolution/WUD/WUDInternal.h +++ b/include/revolution/WUD/WUDInternal.h @@ -158,9 +158,11 @@ typedef struct WUDCB { WUDDevInfoList* smpListTail; // at 0x18 WUDDevInfoList smpList[WUD_MAX_DEV_ENTRY_FOR_SMP]; // at 0x1C +#if defined(VERSION_RSPE01_01) WUDDevInfoList* stdListHead; // at 0x64 WUDDevInfoList* stdListTail; // at 0x68 WUDDevInfoList stdList[WUD_MAX_DEV_ENTRY_FOR_STD]; // at 0x6C +#endif WUDDevInfo stdDevs[WUD_MAX_DEV_ENTRY_FOR_STD]; // at 0xE4 WUDDevInfo smpDevs[WUD_MAX_DEV_ENTRY_FOR_SMP]; // at 0x4A4 diff --git a/src/revolution/WUD/WUD.c b/src/revolution/WUD/WUD.c index b6bc41c6c..f1989b737 100644 --- a/src/revolution/WUD/WUD.c +++ b/src/revolution/WUD/WUD.c @@ -481,12 +481,14 @@ static u8 WUDiSaveDeviceToNand(void) { _scArray.numRegist = WUDiGetDevNumber(); +#if defined(VERSION_RSPE01_01) for (pIt = _wcb.stdListHead, i = 0; pIt != NULL; i++, pIt = pIt->next) { WUD_BDCPY(_scArray.regist[i].addr, pIt->devInfo->devAddr); memcpy(&_scArray.regist[i].info, &pIt->devInfo->conf, sizeof(SCDevInfo)); } +#endif DEBUGPrint("%d devices is stored into SC.\n", i); @@ -683,7 +685,9 @@ static u8 WUDiSyncDone(void) { OSCancelAlarm(&p->alarm); +#if defined(VERSION_RSPE01_01) WUDSetVisibility(FALSE, TRUE); +#endif pSyncCallback = p->syncType == WUD_SYNC_TYPE_STANDARD ? p->syncStdCB : p->syncSmpCB; @@ -882,7 +886,11 @@ static void WUDiCleanUp(void) { WUDCB* p = &_wcb; BOOL success = FALSE; +#if defined(VERSION_RSPE01_00) + if (SCCheckStatus() != SC_STATUS_OK) { +#elif defined(VERSION_RSPE01_01) if (SCCheckStatus() == SC_STATUS_BUSY) { +#endif return; } @@ -1035,6 +1043,15 @@ static void EnableStackHandler0(OSAlarm* pAlarm, OSContext* pContext) { } static WUDInitState WUDiWaitSCSetup(void) { +#if defined(VERSION_RSPE01_00) + WUDInitState nextState = WUD_STATE_INIT_WAIT_FOR_INITIALIZATION; + + if (SCCheckStatus() != SC_STATUS_BUSY) { + nextState = WUD_STATE_INIT_GET_DEV_INFO; + } + + return nextState; +#elif defined(VERSION_RSPE01_01) s32 diff = 0; WUDInitState nextState = WUD_STATE_INIT_WAIT_FOR_INITIALIZATION; s64 time = __OSGetSystemTime(); @@ -1047,6 +1064,7 @@ static WUDInitState WUDiWaitSCSetup(void) { } return nextState; +#endif } static WUDInitState WUDiGetRegisteredDevice(void) { @@ -1101,6 +1119,7 @@ static void InitHandler(void) { WUDCB* p = &_wcb; switch (p->initState) { + case WUD_STATE_INIT_WAIT_FOR_INITIALIZATION: { p->initState = WUDiWaitSCSetup(); break; @@ -1127,8 +1146,13 @@ static void WUDiContMapTableFlush(void) { WUDCB* p = &_wcb; u8 nextState; +#if defined(VERSION_RSPE01_00) + if (SCCheckStatus() == SC_STATUS_OK && + SCSetBtDeviceInfoArray(&_scArray)) { +#elif defined(VERSION_RSPE01_01) if (SCCheckStatus() != SC_STATUS_BUSY && SCSetBtDeviceInfoArray(&_scArray)) { +#endif SCFlushAsync(ShutFlushCallback); nextState = WUD_STATE_SHUTDOWN_FLUSH_SETTINGS; @@ -1181,6 +1205,7 @@ static void InitCore(void) { i == WUD_MAX_DEV_ENTRY_FOR_SMP - 1 ? NULL : &p->smpList[i + 1]; } +#if defined(VERSION_RSPE01_01) p->stdListTail = &p->stdList[WUD_MAX_DEV_ENTRY_FOR_STD - 1]; p->stdListHead = &p->stdList[0]; @@ -1190,6 +1215,7 @@ static void InitCore(void) { p->stdList[i].next = i == WUD_MAX_DEV_ENTRY_FOR_STD - 1 ? NULL : &p->stdList[i + 1]; } +#endif p->syncState = WUD_STATE_SYNC_START; p->linkKeyState = WUD_STATE_LINK_KEY_START; @@ -1288,12 +1314,14 @@ void WUDShutdown(void) { memset(_scArray.devices, 0, sizeof(SCBtDeviceInfo) * WUD_MAX_DEV_ENTRY_FOR_STD); +#if defined(VERSION_RSPE01_01) for (i = 0, pIt = _wcb.stdListHead; pIt != NULL; pIt = pIt->next, i++) { WUD_BDCPY(_scArray.devices[i].addr, pIt->devInfo->devAddr); memcpy(&_scArray.devices[i].info, &pIt->devInfo->conf, sizeof(SCDevInfo)); } +#endif p->shutdownState = WUD_STATE_SHUTDOWN_STORE_SETTINGS; @@ -1401,8 +1429,14 @@ static BOOL StartSyncDevice(u8 syncType, s8 syncLoopNum, BOOL syncSkipChecks) { p->syncedNum = 0; OSCreateAlarm(&p->alarm); + +#if defined(VERSION_RSPE01_00) + OSSetPeriodicAlarm(&p->alarm, __OSGetSystemTime(), OS_MSEC_TO_TICKS(20), + SyncHandler0); +#elif defined(VERSION_RSPE01_01) OSSetPeriodicAlarm(&p->alarm, OSGetTime(), OS_MSEC_TO_TICKS(20), SyncHandler0); +#endif OSRestoreInterrupts(enabled); @@ -1447,7 +1481,12 @@ BOOL WUDStartFastSyncSimple(void) { WUDSyncDeviceCallback pSyncCallback; DEBUGPrint("WUDStartSyncSimple()\n"); + +#if defined(VERSION_RSPE01_00) + success = StartSyncSimple(FALSE); +#elif defined(VERSION_RSPE01_01) success = StartSyncSimple(TRUE); +#endif enabled = OSDisableInterrupts(); pSyncCallback = p->syncSmpCB; @@ -1534,8 +1573,13 @@ BOOL WUDStartClearDevice(void) { p->deleteState = WUD_STATE_DELETE_DISALLOW_INCOMING; OSCreateAlarm(&p->alarm); +#if defined(VERSION_RSPE01_00) + OSSetPeriodicAlarm(&p->alarm, __OSGetSystemTime(), OS_MSEC_TO_TICKS(20), + DeleteAllHandler0); +#elif defined(VERSION_RSPE01_01) OSSetPeriodicAlarm(&p->alarm, OSGetTime(), OS_MSEC_TO_TICKS(20), DeleteAllHandler0); +#endif OSRestoreInterrupts(enabled); @@ -1657,7 +1701,11 @@ void reset_again(void) { // clang-format off static u8 patch_binary[] = { 0x70, 0x99, 0x08, 0x00, // address (little-endian) +#if defined(VERSION_RSPE01_00) + 0x38, 0x00, 0x00, 0x00, // size (little-endian) +#elif defined(VERSION_RSPE01_01) 0xB4, 0x00, 0x00, 0x00, // size (little-endian) +#endif // patch data 0x88, 0x43, 0xD1, 0x07, @@ -1674,6 +1722,7 @@ static u8 patch_binary[] = { 0x01, 0x49, 0x0B, 0x60, 0x90, 0xF7, 0x96, 0xFB, 0xD8, 0x1D, 0x08, 0x00, +#if defined(VERSION_RSPE01_01) 0x00, 0xF0, 0x04, 0xF8, 0x00, 0x23, 0x79, 0xF7, 0xE3, 0xFA, 0x00, 0x00, @@ -1705,20 +1754,27 @@ static u8 patch_binary[] = { 0xFF, 0x9F, 0x00, 0x00, 0x30, 0xFC, 0x0E, 0x00, 0x7F, 0xFF, 0x00, 0x00 +#endif }; // clang-format on // clang-format off static WUDPatchList patch_install = { +#if defined(VERSION_RSPE01_00) + 5, +#elif defined(VERSION_RSPE01_01) 7, +#endif { {0x20, 0xBC, 0x65, 0x01, 0x00, 0x84, 0x42, 0x09, 0xD2, 0x84, 0x42, 0x09, 0xD1}, {0x21, 0x84, 0x5A, 0x00, 0x00, 0x83, 0xF0, 0x74, 0xFF, 0x09, 0x0C, 0x08, 0x43}, {0x22, 0x00, 0x61, 0x00, 0x00, 0x83, 0xF0, 0x40, 0xFC, 0x00, 0x00, 0x00, 0x00}, {0x23, 0xCC, 0x9F, 0x01, 0x00, 0x6F, 0xF0, 0xE4, 0xFC, 0x03, 0x28, 0x7D, 0xD1}, {0x24, 0x3C, 0x62, 0x01, 0x00, 0x28, 0x20, 0x00, 0xE0, 0x60, 0x8D, 0x23, 0x68}, +#if defined(VERSION_RSPE01_01) {0x25, 0x04, 0x12, 0x01, 0x00, 0x20, 0x1C, 0x20, 0x1C, 0x24, 0xE0, 0xB0, 0x21}, {0x26, 0x74, 0x2F, 0x00, 0x00, 0x86, 0xF0, 0x18, 0xFD, 0x21, 0x4F, 0x3B, 0x60} +#endif } }; // clang-format on @@ -1757,7 +1813,11 @@ static void write_patch_cb(tBTM_VSC_CMPL* p1) { WUDiWritePatch(); } } else { +#if defined(VERSION_RSPE01_00) + WUDiInitSub(); +#elif defined(VERSION_RSPE01_01) reset_again(); +#endif } } @@ -1785,12 +1845,20 @@ static void WUDiWritePatch(void) { static void install_patch_cb(tBTM_VSC_CMPL* p1) { if (p1 != NULL) { if (patch_num == install_num) { +#if defined(VERSION_RSPE01_00) + WUDiInitSub(); +#elif defined(VERSION_RSPE01_01) reset_again(); +#endif } else { WUDiInstallPatch(); } } else { +#if defined(VERSION_RSPE01_00) + WUDiInitSub(); +#elif defined(VERSION_RSPE01_01) reset_again(); +#endif } } @@ -2303,6 +2371,7 @@ void WUDiMoveTopOfDisconnectedSmpDevice(WUDDevInfo* pInfo) { OSRestoreInterrupts(enabled); } +#if defined(VERSION_RSPE01_01) void WUDiMoveTopStdDevInfoPtr(WUDDevInfo* pInfo) { WUDCB* p = &_wcb; BOOL enabled; @@ -2437,6 +2506,7 @@ void WUDiMoveTopOfDisconnectedStdDevice(WUDDevInfo* pInfo) { OSRestoreInterrupts(enabled); } +#endif BOOL WUDIsBusy(void) { WUDCB* p = &_wcb; diff --git a/src/revolution/WUD/WUDHidHost.c b/src/revolution/WUD/WUDHidHost.c index c04a806e9..2c04a864c 100644 --- a/src/revolution/WUD/WUDHidHost.c +++ b/src/revolution/WUD/WUDHidHost.c @@ -83,8 +83,10 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { if (pInfo->UNK_0x5B == 3 || pInfo->UNK_0x5B == 1) { WUDiMoveTopSmpDevInfoPtr(pInfo); +#if defined(VERSION_RSPE01_01) } else { WUDiMoveTopStdDevInfoPtr(pInfo); +#endif } WUDSetSniffMode(pInfo->devAddr, 8); @@ -124,6 +126,7 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { DEBUGPrint("device handle : %d status = %d\n", pCbData->handle, pCbData->status); +#if defined(VERSION_RSPE01_01) pInfo = WUDiGetDevInfo(_dev_handle_to_bda[pCbData->handle]); if (pInfo != NULL) { if (pInfo->UNK_0x5B == 3 || pInfo->UNK_0x5B == 1) { @@ -132,6 +135,7 @@ void WUDHidHostCallback(tBTA_HH_EVT event, tBTA_HH* pData) { WUDiMoveTopOfDisconnectedStdDevice(pInfo); } } +#endif _dev_handle_to_bda[pCbData->handle] = NULL; _dev_handle_queue_size[pCbData->handle] = 0; From 2359475ca540754119b7868a49fedcab35ff177b Mon Sep 17 00:00:00 2001 From: Texline666 <93364055+Tanline666@users.noreply.github.com> Date: Fri, 25 Sep 2026 14:32:03 -0600 Subject: [PATCH 3/3] workflow should support US Rev 0 now --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbcfc00ea..37675770a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: # Add game versions here - version: [RSPE01_01] + version: [RSPE01_00, RSPE01_01] steps: # Checkout the repository