From fec1731d2be5ab94ca570e3f22125227ac0ec5bb Mon Sep 17 00:00:00 2001 From: "ieee 802.11ac" Date: Thu, 6 Aug 2026 22:35:55 -0700 Subject: [PATCH] dfhjhbdfbjkdfbjklcfbnjhkfgjnhdfbjbhcvbubkdfuyhdf --- config/373307D9/symbols.txt | 32 +++--- src/system/dsp/EQEffect.cpp | 34 ++++++ src/system/dsp/EQEffect.h | 18 ++- src/system/gesture/ArcDetector.cpp | 153 ++++++++++++++++++++++++++ src/system/gesture/ArcDetector.h | 4 +- src/system/gesture/LiveCameraInput.h | 3 +- src/system/gesture/StreamRenderer.cpp | 79 ++++++++++++- src/system/obj/Object.h | 4 +- src/system/os/Memory_Xbox.cpp | 73 ++++++++++-- src/system/rndobj/RenderState.h | 2 +- 10 files changed, 368 insertions(+), 34 deletions(-) diff --git a/config/373307D9/symbols.txt b/config/373307D9/symbols.txt index 570592322..fbe68e675 100644 --- a/config/373307D9/symbols.txt +++ b/config/373307D9/symbols.txt @@ -21643,7 +21643,7 @@ lbl_8209D588 = .rdata:0x8209D588; // type:object size:0x18 ??_C@_0BE@HGGBKAPA@rndtex?4debug_mirror?$AA@ = .rdata:0x8209D5B8; // type:object size:0x18 scope:global ??_C@_0FP@JLAHJNGD@?$CFs?5could?5not?5do?5mirroring?5becaus@ = .rdata:0x8209D5D0; // type:object size:0x60 scope:global ??_C@_0EM@BMMNJFBC@?$CFs?5could?5not?5find?5mesh?5to?5mirror@ = .rdata:0x8209D630; // type:object size:0x50 scope:global -??_C@_0EL@GLPGHLJM@?$CFs?3?5Cannot?5render?5to?5texture?5?$CI?$CFs@ = .rdata:0x8209D680; // type:object size:0x4C scope:global +??_C@_0EL@GLPGHLJM@?$CFs?3?5Cannot?5render?5to?5texture?5?$CI?$CFs@ = .rdata:0x8209D680; // type:object size:0x4C scope:global data:string ??_C@_0L@OAIJIIOI@pre_render?$AA@ = .rdata:0x8209D6CC; // type:object size:0xC scope:global ??_C@_0BC@LEOPHPGG@?$CFs?5not?5renderable?$AA@ = .rdata:0x8209D6D8; // type:object size:0x18 scope:global lbl_8209D6F0 = .rdata:0x8209D6F0; // type:object size:0x18 @@ -22049,7 +22049,7 @@ lbl_8209F850 = .rdata:0x8209F850; // type:object size:0xC align:4 data:float lbl_8209F85C = .rdata:0x8209F85C; // type:object size:0x8 align:4 data:float lbl_8209F864 = .rdata:0x8209F864; // type:object size:0x4 __real@c47a0000 = .rdata:0x8209F868; // type:object size:0x4 scope:global align:4 data:float -merged_8209F86C = .rdata:0x8209F86C; // type:object size:0x4 scope:global align:4 data:float +__real@3dcccccd = .rdata:0x8209F86C; // type:object size:0x4 scope:global align:4 data:float ??_C@_0DB@FPOLGBDK@e?3?2lazer_build_gmc1?2system?2src?2r@ = .rdata:0x8209F870; // type:object size:0x38 scope:global ??_C@_0EA@MEKPFPHE@?$CI0?$CJ?5?$DM?$DN?5?$CIiIndex?$CJ?5?$CG?$CG?5?$CIiIndex?$CJ?5?$DM?5?$CI?$CI@ = .rdata:0x8209F8A8; // type:object size:0x40 scope:global data:string ??_C@_0BJ@CAHAJFCE@iStartIndex?5?$DM?$DN?5iEndIndex?$AA@ = .rdata:0x8209F8E8; // type:object size:0x20 scope:global @@ -142718,7 +142718,7 @@ __unwind$132752 = .text:0x8261CB94; // type:function size:0x28 scope:global ?clear@?$_List_base@UShaderTree@RndShaderMgr@@V?$StlNodeAlloc@UShaderTree@RndShaderMgr@@@stlpmtx_std@@@stlpmtx_std@@QAAXXZ = .text:0x8261CEF8; // type:function size:0x5C scope:global ?EstimatedCost@DxShader@@UAAXAAM0@Z = .text:0x8261CF58; // type:function size:0xF4 scope:global merged_8261D050 = .text:0x8261D050; // type:function size:0x8 scope:global -merged_8261D058 = .text:0x8261D058; // type:function size:0x8 scope:global +merged_Get0x48 = .text:0x8261D058; // type:function size:0x8 scope:global merged_8261D060 = .text:0x8261D060; // type:function size:0x8 scope:global merged_8261D068 = .text:0x8261D068; // type:function size:0x8 scope:global merged_8261D070 = .text:0x8261D070; // type:function size:0x5C scope:global @@ -171875,8 +171875,8 @@ __unwind$211220 = .text:0x829658EC; // type:function size:0x20 scope:global ?MoveOn@MQSongSortMgr@@UAA?AVSymbol@@XZ = .text:0x82965910; // type:function size:0x78 scope:global ?IsCharacter@MQSongSortMgr@@QBA_NVSymbol@@@Z = .text:0x82965988; // type:function size:0x64 scope:global ??1MQSongSort@@UAA@XZ = .text:0x829659F0; // type:function size:0x1C scope:global -merged_82965A10 = .text:0x82965A10; // type:function size:0x8 scope:global -merged_82965A18 = .text:0x82965A18; // type:function size:0x64 scope:global +??_EMQSongSort@@W3AAPAXI@Z = .text:0x82965A10; // type:function size:0x8 scope:global +??_GMQSongSort@@UAAPAXI@Z = .text:0x82965A18; // type:function size:0x64 scope:global except_data_82965A88 = .text:0x82965A80; // type:object size:0x8 scope:global ??0MQSongSortByCharacter@@QAA@XZ = .text:0x82965A88; // type:function size:0x78 scope:global __unwind$214419 = .text:0x82965B00; // type:function size:0x28 scope:global @@ -173175,7 +173175,7 @@ except_data_82988BE8 = .text:0x82988BE0; // type:object size:0x8 scope:global ??1NavListFunctionNode@@UAA@XZ = .text:0x82988BE8; // type:function size:0x54 scope:global __unwind$218791 = .text:0x82988C3C; // type:function size:0x28 scope:global merged_82988C68 = .text:0x82988C68; // type:function size:0xC scope:global -merged_82988C78 = .text:0x82988C78; // type:function size:0x4C scope:global +??_GNavListFunctionNode@@UAAPAXI@Z = .text:0x82988C78; // type:function size:0x4C scope:global ?DeleteItemList@SongSort@@UAAXXZ = .text:0x82988CC8; // type:function size:0x2C scope:global ?UpdateHighlight@SongSort@@UAAXXZ = .text:0x82988CF8; // type:function size:0x2C scope:global ?OnSelectShortcut@SongSort@@UAAXH@Z = .text:0x82988D28; // type:function size:0x2C scope:global @@ -173187,7 +173187,7 @@ merged_82988C78 = .text:0x82988C78; // type:function size:0x4C scope:global except_data_82989050 = .text:0x82989048; // type:object size:0x8 scope:global ??0NavListFunctionNode@@QAA@PAVNavListItemSortCmp@@VSymbol@@PBD@Z = .text:0x82989050; // type:function size:0x4C scope:global __unwind$221927 = .text:0x8298909C; // type:function size:0x28 scope:global -merged_829890C8 = .text:0x829890C8; // type:function size:0x58 scope:global +??_GSongFunctionNode@@UAAPAXI@Z = .text:0x829890C8; // type:function size:0x58 scope:global ??0SongSort@@QAA@XZ = .text:0x82989120; // type:function size:0x48 scope:global except_data_82989170 = .text:0x82989168; // type:object size:0x8 scope:global ?BuildItemList@SongSort@@UAAXXZ = .text:0x82989170; // type:function size:0x4F0 scope:global @@ -194789,7 +194789,7 @@ __unwind$155274 = .text:0x82EDCEDC; // type:function size:0x28 scope:global ??__FenterMsg@?BC@??SetMode@GameMode@@QAAXVSymbol@@0@Z@YAXXZ = .text:0x82EE3E30; // type:function size:0x1C scope:global ??__FexitMsg@?5??SetMode@GameMode@@QAAXVSymbol@@0@Z@YAXXZ = .text:0x82EE3E50; // type:function size:0x1C scope:global ??__Fload_game_hud@?1??SetGameplayMode@GameMode@@QAAXVSymbol@@_N@Z@YAXXZ = .text:0x82EE3E70; // type:function size:0x1C scope:global -??__Fsongseq_intro@?DK@??OnSongLoaded@SongSequence@@QAAXXZ@YAXXZ = .text:0x82EE3E90; // type:function size:0x1C scope:global +??__Fsongseq_intro@?DN@??OnSongLoaded@SongSequence@@QAAXXZ@YAXXZ = .text:0x82EE3E90; // type:function size:0x1C scope:global ??__FTheSongSequence@@YAXXZ = .text:0x82EE3EB0; // type:function size:0x3C scope:global ??__FTheHamUI@@YAXXZ = .text:0x82EE3EF0; // type:function size:0xC scope:global ??__Finit@?1??OnMsg@HamUI@@IAA?AVDataNode@@ABVContentReadFailureMsg@@@Z@YAXXZ = .text:0x82EE3F00; // type:function size:0x1C scope:global @@ -198434,8 +198434,8 @@ lbl_82F446EC = .data:0x82F446EC; // type:object size:0x2 lbl_82F446EE = .data:0x82F446EE; // type:object size:0xA lbl_82F446F8 = .data:0x82F446F8; // type:object size:0x4 align:4 data:float ??_R0PAV?$_List_node@VVector3@@@stlpmtx_std@@@8 = .data:0x82F446FC; // type:object size:0x34 scope:global -lbl_82F44730 = .data:0x82F44730; // type:object size:0x4 align:4 data:float -lbl_82F44734 = .data:0x82F44734; // type:object size:0x4 data:4byte +__real@3e4ccccd = .data:0x82F44730; // type:object size:0x4 align:4 data:float +?lock_in_point_req@?1??IsLockedIn@ArcDetector@@QBA_NXZ@4HA = .data:0x82F44734; // type:object size:0x4 data:4byte ??_R0?AVArcDetector@@@8 = .data:0x82F44738; // type:object size:0x1C scope:global lbl_82F44754 = .data:0x82F44754; // type:object size:0x4 align:4 data:float lbl_82F44758 = .data:0x82F44758; // type:object size:0x4 align:4 data:float @@ -207460,7 +207460,7 @@ lbl_831177B4 = .data:0x831177B4; // type:object size:0x4 data:4byte lbl_831177BC = .data:0x831177BC; // type:object size:0x4 data:4byte lbl_831177C0 = .data:0x831177C0; // type:object size:0x4 lbl_831177C4 = .data:0x831177C4; // type:object size:0x4 data:4byte -lbl_831177C8 = .data:0x831177C8; // type:object size:0x8 data:4byte +?songseq_intro@?DN@??OnSongLoaded@SongSequence@@QAAXXZ@4VMessage@@A = .data:0x831177C8; // type:object size:0x8 data:4byte lbl_831177D0 = .data:0x831177D0; // type:object size:0x4 data:4byte lbl_831177D4 = .data:0x831177D4; // type:object size:0x4 data:4byte lbl_831177D8 = .data:0x831177D8; // type:object size:0x4 data:4byte @@ -210487,9 +210487,9 @@ lbl_8311B338 = .data:0x8311B338; // type:object size:0x4 data:4byte lbl_8311B33C = .data:0x8311B33C; // type:object size:0x4 lbl_8311B340 = .data:0x8311B340; // type:object size:0x4 data:4byte lbl_8311B344 = .data:0x8311B344; // type:object size:0x4 data:4byte -lbl_8311B348 = .data:0x8311B348; // type:object size:0x4 data:4byte -lbl_8311B34C = .data:0x8311B34C; // type:object size:0x4 data:4byte -lbl_8311B350 = .data:0x8311B350; // type:object size:0x4 data:4byte +?$S2@?5??BuildTree@SongSort@@UAAXXZ@4IA = .data:0x8311B348; // type:object size:0x4 data:4byte +?by_song@?5??BuildTree@SongSort@@UAAXXZ@4VSymbol@@A = .data:0x8311B34C; // type:object size:0x4 data:4byte +?by_artist@?5??BuildTree@SongSort@@UAAXXZ@4VSymbol@@A = .data:0x8311B350; // type:object size:0x4 data:4byte lbl_8311B354 = .data:0x8311B354; // type:object size:0x4 data:4byte lbl_8311B358 = .data:0x8311B358; // type:object size:0x4 data:4byte lbl_8311B35C = .data:0x8311B35C; // type:object size:0x4 data:4byte @@ -211491,8 +211491,8 @@ lbl_8316B1A8 = .data:0x8316B1A8; // type:object size:0x4 data:4byte lbl_8316B1AC = .data:0x8316B1AC; // type:object size:0x4 data:4byte lbl_8316B1B0 = .data:0x8316B1B0; // type:object size:0x8 data:4byte lbl_8316B1B8 = .data:0x8316B1B8; // type:object size:0x4 data:4byte -lbl_8316B1BC = .data:0x8316B1BC; // type:object size:0x8 data:4byte -lbl_8316B1C4 = .data:0x8316B1C4; // type:object size:0x4 data:4byte +?_dw@?BL@??DrawToTexture@StreamRenderer@@IAAXXZ@4VDebugNotifyOncer@@A = .data:0x8316B1BC; // type:object size:0x8 data:4byte +?$S6@?BL@??DrawToTexture@StreamRenderer@@IAAXXZ@4IA = .data:0x8316B1C4; // type:object size:0x4 data:4byte ?types@?5??SetType@StreamRenderer@@UAAXVSymbol@@@Z@4PAVDataArray@@A = .data:0x8316B1C8; // type:object size:0x4 scope:global data:4byte ??_B?5??SetType@StreamRenderer@@UAAXVSymbol@@@Z@55 = .data:0x8316B1CC; // type:object size:0x4 scope:global data:4byte ?types@?5??SetType@HandsUpGestureFilter@@UAAXVSymbol@@@Z@4PAVDataArray@@A = .data:0x8316B1D0; // type:object size:0x4 scope:global data:4byte diff --git a/src/system/dsp/EQEffect.cpp b/src/system/dsp/EQEffect.cpp index b3a65b623..a98285766 100644 --- a/src/system/dsp/EQEffect.cpp +++ b/src/system/dsp/EQEffect.cpp @@ -5,6 +5,23 @@ #include "xdk/xaudio2/xaudio2.h" #include +void EQEffect::Process(float *samples, int sampct, int numChans) { + if (unk2c != 0.0f) { + MILO_ASSERT(numChans <= 2, 120); + if (numChans <= 0) + return; + for (int i = 0; i < sampct; i++) { + } + return; + } else { + MILO_ASSERT(numChans <= 2, 217); + if (numChans <= 0) + return; + for (int i = 0; i < numChans; i++) { + } + } +} + void EQEffect::SetParameter(int idx, float val) { bool dirty29 = false, dirty30 = false, dirty28 = false, dirty27 = false, dirty26 = false, dirty25 = false; @@ -289,3 +306,20 @@ void EQEffect::SetParameters(const EQEffect::Params ¶ms) { SetParameter(11, params.lrMode); SetParameter(12, params.transitionTime); } + +void EQEffect::Reset() { + unkc8 = unkc0 = 0.0f; + for (int i = 0; i < 2; i++) { + } + unk44 = unk40; + unk64 = unk60; + unk80 = unk7c; + unk4c = unk48; + unk6c = unk68; + unk88 = unk84; + if (unk30 != 0.0f) { + unk34 = powf(0.368, 1.0f / (unk30 * 48.0f)); + } else { + unk34 = 1.0f; + } +} diff --git a/src/system/dsp/EQEffect.h b/src/system/dsp/EQEffect.h index c325b2db0..838bd5fec 100644 --- a/src/system/dsp/EQEffect.h +++ b/src/system/dsp/EQEffect.h @@ -94,7 +94,23 @@ class EQEffect { float unkb4; float unkb8; float unkbc; - char pad[0x70]; + float unkc0; + float unkc4; + float unkc8; + float unkcc; + float unkd0; + float unkd4; + float unkd8; + float unkdc; + float unke0; + float unke4; + float unke8; + float unkec; + float unkf0; + float unkf4; + float unkf8; + float unkfc; + char pad[0x30]; float unk_0x130; float unk_0x134; float unk_0x138; diff --git a/src/system/gesture/ArcDetector.cpp b/src/system/gesture/ArcDetector.cpp index ce470dc7f..13493d4df 100644 --- a/src/system/gesture/ArcDetector.cpp +++ b/src/system/gesture/ArcDetector.cpp @@ -1,7 +1,9 @@ #include "gesture/ArcDetector.h" #include "gesture/BaseSkeleton.h" #include "os/Debug.h" +#include "rndobj/Rnd.h" #include "utl/Std.h" +#include float ArcDetector::_swipeRetentionFactor = 0.5; float ArcDetector::_acceptablePathErrorRatio = 0.89999998; @@ -27,6 +29,58 @@ void ArcDetector::Initialize( unkc = j2; } +void ArcDetector::Update(const Skeleton &skel, int playernum) { + if (!unk34) { + MILO_ASSERT(false, 74); + } + if (!skel.IsTracked()) { + Clear(); + return; + } + const Vector3 &body_maybe = skel.TrackedJoints()[unkc].mJointPos[0], + &hand_maybe = skel.TrackedJoints()[unk8].mJointPos[0]; + float hpos_x = hand_maybe.x - body_maybe.x, hpos_y = hand_maybe.y - body_maybe.y, + hpos_z = hand_maybe.z - body_maybe.z; // why + Vector3 hand_pos(hpos_x, hpos_y, hpos_z); // in body coords? i think + unk40 = hand_pos; + if (mJointPath.empty()) { + TryToStartSwipe(hand_pos, skel); + } else if (unk35) { + Vector3 unk = *mJointPath.begin(); + Clear(); + mJointPath.insert(mJointPath.begin(), hand_pos); + if (mSide == kSkeletonLeft && hpos_x >= unk.x + 0.01f) { + unk35 = false; + } + if (mSide == kSkeletonRight && hpos_x <= unk.x - 0.01f) { + unk35 = false; + } + } else { + Vector3 v = unk18 = GetCurveStart(); + v.x -= hpos_x; + v.y -= hpos_y; + v.z -= hpos_z; + if (LengthSquared(v) > 0.0001f) { + mJointPath.insert(mJointPath.begin(), hand_pos); + } + const Vector3 &body_maybe = skel.TrackedJoints()[unkc].mJointPos[0], + &hand_maybe = skel.TrackedJoints()[unk8].mJointPos[0]; + float hpos_x_recalc = hand_maybe.x - body_maybe.x, + hpos_z_recalc = hand_maybe.z - body_maybe.z; + unk28 = (Vector2(hpos_x_recalc, hpos_z_recalc).Length() + unk28) / 2; + } + unk2c = skel.TrackedJoints()[unk8].mJointPos[0].y + - skel.TrackedJoints()[unkc].mJointPos[0].y; + CullPath(); + unk38 = Max(unk38, GetSwipeAmount()); + if (!IsPathAcceptable()) { + SwipeFailed(skel); + } + if (GetSwipeAmount() < 0.1f) { + unk3c = Max(0, unk3c - playernum); + } +} + Vector3 ArcDetector::GetCurveStart() const { MILO_ASSERT(!mJointPath.empty(), 0xE9); return Vector3((mSide)*unk28, unk2c, 0); @@ -65,6 +119,11 @@ void ArcDetector::SwipeFailed(const Skeleton &skeleton) { TryToStartSwipe(vec, skeleton); } +bool ArcDetector::IsLockedIn() const { + static int lock_in_point_req = 2; + return mJointPath.size() > lock_in_point_req || GetSwipeAmount() > 0.2f; +} + void ArcDetector::CullPath() { if (!mJointPath.empty()) { std::list other; @@ -81,3 +140,97 @@ void ArcDetector::CullPath() { mJointPath = other; } } + +float ArcDetector::GetPathError() const { + if (mJointPath.empty()) { + return 0.0f; + } + float accumulator = 0.0f; + static float unk_static = 2.0f; + float inv_static = 1.0f / unk_static; + FOREACH_CONST (joint, mJointPath) { + Vector3 this_joint = *joint; + // the hand location relative to this joint. + float jointspace_x = unk18.x - this_joint.x; + if (mSide == kSkeletonRight) { + jointspace_x *= -1.0f; + } + float jspace_x_scl = jointspace_x * unk28; + float jointspace_z = unk18.z - this_joint.z; + float sqrt_jspace_x = jspace_x_scl * 2 - (jointspace_x * jointspace_x); + if (sqrt_jspace_x <= 0) { + sqrt_jspace_x = 0; + } else { + sqrt_jspace_x = sqrt(sqrt_jspace_x); + } + jointspace_z -= sqrt_jspace_x; + float jspace_y = this_joint.y - unk2c; + accumulator += LengthSquared(Vector3(0, jointspace_z, jspace_y * inv_static)); + } + return accumulator; +} + +void ArcDetector::TryToStartSwipe(const Vector3 &startpos, const Skeleton &skel) { + MILO_ASSERT(mJointPath.empty(), 139); + bool joint_not_tracked = true; + if (skel.TrackedJoints()[unk8].mJointConf != kConfidenceTracked + || skel.TrackedJoints()[unkc].mJointConf != kConfidenceTracked) { + joint_not_tracked = false; + } + if (joint_not_tracked) { + mJointPath.push_front(startpos); + const Vector3 &ucjoint = skel.TrackedJoints()[unkc].mJointPos[0]; + const Vector3 &u8joint = skel.TrackedJoints()[unk8].mJointPos[0]; + unk28 = Vector2(u8joint.x - ucjoint.x, u8joint.z - ucjoint.z).Length(); + } +} + +float ArcDetector::UpdateOverlay(RndOverlay *ovl, float f) { + static std::list jointPathCopy; + if (!mJointPath.empty() && mJointPath.size() > 2) { + jointPathCopy.clear(); + FOREACH_CONST (orig_joint, mJointPath) { + jointPathCopy.push_front(*orig_joint); + } + } + if (jointPathCopy.empty()) { + return f; + } + + Vector2 v(0, f); + Hmx::Color c(1, 1, 1); + TheRnd.DrawStringScreen(MakeString("%f %f"), v, c, true); + return f; +} + +void ArcDetector::Draw(const Skeleton &skel, SkeletonViz &viz) { + const size_t joint_ct = mJointPath.size(); + if (joint_ct == 0) + return; + { + std::list joints2draw; + Vector3 v; + for (int i = 0; i < 100; i++) { + float f0 = i * unk28 * 0.02f; + float f13 = unk28 * f0; + // next two lines: pretty sure this is some weird intrin stuff + int x = mSide == kSkeletonLeft ? -1 : 1; // why is this an int...? + + f13 = f13 * 2.0f - (f0 * f0); + if (f13 <= 0) { + f13 = 0; + } else { + f13 = sqrt(f13); + } + v.z = -f13; + v.y = 0.0f; + v.x = x * f0; + joints2draw.insert(joints2draw.begin(), v); + } + Add(skel.TrackedJoints()[unkc].mJointPos[0], unk18, v); + DrawPath(joints2draw, viz, Hmx::Color(1, 1, 0), v); + } + DrawPath( + mJointPath, viz, Hmx::Color(1, 0, 1), skel.TrackedJoints()[unkc].mJointPos[0] + ); +} diff --git a/src/system/gesture/ArcDetector.h b/src/system/gesture/ArcDetector.h index 9ca7e5f06..1bfb797dc 100644 --- a/src/system/gesture/ArcDetector.h +++ b/src/system/gesture/ArcDetector.h @@ -27,6 +27,8 @@ class ArcDetector { float GetPathError() const; void SwipeFailed(const Skeleton &); void CullPath(); + void DrawPath(std::list, SkeletonViz &, Hmx::Color, const Vector3 &) const; + bool IsPathAcceptable() const; static float _swipeRetentionFactor; static float _acceptablePathErrorRatio; @@ -43,5 +45,5 @@ class ArcDetector { bool unk35; float unk38; int unk3c; - Vector3 unk40; + Vector3 unk40; // last frame hand pos? }; diff --git a/src/system/gesture/LiveCameraInput.h b/src/system/gesture/LiveCameraInput.h index 388f013bc..eec096605 100644 --- a/src/system/gesture/LiveCameraInput.h +++ b/src/system/gesture/LiveCameraInput.h @@ -101,7 +101,8 @@ class LiveCameraInput : public CameraInput { static void NuiAudioDataCallback(NUIAUDIO_RESULTS *); static LiveCameraInput *sInstance; - bool Unk11EA() { return unk11ea; } + bool Unk11E9() const { return unk11e9; } + bool Unk11EA() const { return unk11ea; } protected: LiveCameraInput(); diff --git a/src/system/gesture/StreamRenderer.cpp b/src/system/gesture/StreamRenderer.cpp index eaa5f8f20..9851d7932 100644 --- a/src/system/gesture/StreamRenderer.cpp +++ b/src/system/gesture/StreamRenderer.cpp @@ -1,28 +1,28 @@ #include "gesture/StreamRenderer.h" -#include "gesture/BaseSkeleton.h" #include "gesture/GestureMgr.h" #include "gesture/LiveCameraInput.h" #include "hamobj/HamGameData.h" #include "math/Color.h" -#include "math/Vec.h" #include "obj/Data.h" #include "obj/Dir.h" #include "obj/Object.h" -#include "obj/Task.h" #include "os/Debug.h" #include "rnddx9/Rnd.h" #include "rndobj/Cam.h" #include "rndobj/Draw.h" +#include "rndobj/RenderState.h" #include "rndobj/Rnd.h" +#include "rndobj/ShaderMgr.h" #include "rndobj/ShaderOptions.h" #include "rndobj/Tex.h" #include "rndobj/Utl.h" -#include RndCam *StreamRenderer::mCam; RndTex *StreamRenderer::mBlurRT[2]; namespace { + int *DisplayStreams; + bool CheckTexType(RndTex *tex) { MILO_ASSERT(tex, 0x45); @@ -416,3 +416,74 @@ void StreamRenderer::SetCrewPhotoPlayerDetected(int player, bool b2) { break; } } + +void StreamRenderer::DrawToTexture() { + if (TheRnd.DrawMode() != Rnd::kDrawNormal) + return; + if (!Showing()) + return; + if (mLagPrimaryTexture && mLaggedPrimaryTexture[0] == NULL) { + MILO_ASSERT(mLaggedPrimaryTexture[1] == NULL, 245); + mLaggedPrimaryTexture[0] = New(); + mLaggedPrimaryTexture[0]->SetBitmap( + 320, 240, 16, RndTex::kRegularLinear, false, nullptr + ); + mLaggedPrimaryTexture[1] = New(); + mLaggedPrimaryTexture[1]->SetBitmap( + 320, 240, 16, RndTex::kRegularLinear, false, nullptr + ); + } + if (mOutputTex == nullptr) + return; + TheDxRnd.SetShaderRegisterAlloc(static_cast(3)); + LiveCameraInput *cam = TheGestureMgr->GetLiveCameraInput(); + int stream = DisplayStreams[mDisplay]; + int stream_wat = (stream & 2) >> 1; + if (stream & 1 && !cam->Unk11EA()) { + cam->PollNewStream(LiveCameraInput::kBufferDepth); + } else if ((stream_wat & 0xff) != 0 && !cam->Unk11E9()) { + cam->PollNewStream(LiveCameraInput::kBufferColor); + } + + // 0x254 + const RndTex *cam_tex = RndCam::Current()->TargetTex(); + if (cam_tex != nullptr) { + MILO_NOTIFY_ONCE( + "%s: Cannot render to texture (%s) while already rendering to texture (%s).", + PathName(cam_tex), + PathName(this), + PathName(cam_tex) + ); + } + mCam->SetTargetTex(nullptr); + + // 0x390 + TheRenderState.SetTextureFilter(0, RndRenderState::kFilterModePoint, false); + TheRenderState.SetTextureClamp(0, RndRenderState::kClampModeClamp); + RndTex *pal = SetPaletteTexture(mPlayer1DepthPalette, mDisplay); + TheShaderMgr.SetPConstant(static_cast(10), pal); + + TheRenderState.SetTextureFilter(10, RndRenderState::kFilterModeLinear, false); + TheRenderState.SetTextureClamp(10, RndRenderState::kClampModeWrap); + pal = SetPaletteTexture(mPlayer2DepthPalette, mDisplay); + TheShaderMgr.SetPConstant(static_cast(12), pal); + + TheRenderState.SetTextureFilter(12, RndRenderState::kFilterModeLinear, false); + TheRenderState.SetTextureClamp(12, RndRenderState::kClampModeWrap); + pal = SetPaletteTexture(mPlayerOtherDepthPalette, mDisplay); + TheShaderMgr.SetPConstant(static_cast(14), pal); + + TheRenderState.SetTextureFilter(14, RndRenderState::kFilterModeLinear, false); + TheRenderState.SetTextureClamp(14, RndRenderState::kClampModeWrap); + pal = SetPaletteTexture(mPlayerOtherDepthPalette, mDisplay); + TheShaderMgr.SetPConstant(static_cast(11), pal); + + TheRenderState.SetTextureFilter(11, RndRenderState::kFilterModeLinear, false); + TheRenderState.SetTextureClamp(11, RndRenderState::kClampModeWrap); + Vector4 v4; + v4.x = mPlayerDepthNobody.red; + v4.y = mPlayerDepthNobody.green; + v4.z = mPlayerDepthNobody.blue; + v4.w = mPlayerDepthNobody.alpha; + TheShaderMgr.SetPConstant(static_cast(64), v4); +} diff --git a/src/system/obj/Object.h b/src/system/obj/Object.h index e06320f06..6f20d5968 100644 --- a/src/system/obj/Object.h +++ b/src/system/obj/Object.h @@ -895,8 +895,8 @@ extern DataArray *SystemConfig(Symbol, Symbol, Symbol); // BEGIN LOAD MACROS -------------------------------------------------------------------- #define INIT_REVS(rev, alt) \ - static const __declspec(align(4)) unsigned short gRev = rev; \ - static const __declspec(align(4)) unsigned short gAltRev = alt; + static const ALIGN(4) unsigned short gRev = rev; \ + static const ALIGN(4) unsigned short gAltRev = alt; #define BEGIN_LOADS(objType) void objType::Load(BinStream &bs) { #define LOAD_REVS(bs) \ diff --git a/src/system/os/Memory_Xbox.cpp b/src/system/os/Memory_Xbox.cpp index 0a80871de..8946adcd1 100644 --- a/src/system/os/Memory_Xbox.cpp +++ b/src/system/os/Memory_Xbox.cpp @@ -101,7 +101,64 @@ namespace { } } - int AllocAlign(DWORD); + int AllocAlign(DWORD siz) { + DWORD siz_b8t12 = (siz >> 24) & 0xF; + if (siz & 0x80000000) { + switch (siz_b8t12) { + case 2: + return 4; + case 3: + return 8; + case 4: + return 0x10; + case 5: + return 0x20; + case 6: + return 0x40; + case 7: + return 0x80; + case 8: + return 0x100; + case 9: + return 0x200; + case 10: + return 0x400; + case 11: + return 0x800; + case 0: + case 12: + return 0x1000; + case 13: + return 0x2000; + case 14: + return 0x4000; + case 15: + return 0x8000; + default: { + MILO_FAIL("Invalid physical alignment (%d)", siz_b8t12); + return 0; + } break; + } + } else { + switch (siz_b8t12) { + case 0: { + return 0x10; + } break; + case 1: + case 2: { + return 8; + } break; + case 4: { + return 0x10; + } break; + default: { + MILO_FAIL("Invalid heap alignment (%d)", siz_b8t12); + return 0; + } break; + } + } + return 0; + } void MemAllocFailed(unsigned long requestedBytes, bool physical) { MEMORYSTATUS status; @@ -195,18 +252,18 @@ int ForceLinkXMemFuncs() { return 0x2A; } VOID *XMemAlloc(SIZE_T dwSize, DWORD dwAllocAttributes) { VOID *ptr; - BOOL memType = Attr(dwAllocAttributes).dwMemoryType; - if (!memType && (dwAllocAttributes & 0xFF0000) != 0x8C0000) { - MILO_ASSERT(Attr(dwAllocAttributes).dwMemoryProtect == XALLOC_MEMPROTECT_READWRITE, 0xF9); + DWORD dwMemoryType = dwAllocAttributes & 0x80000000; + if (dwMemoryType == 0 && (dwAllocAttributes & 0xFF0000) != 0x8C0000) { + MILO_ASSERT(Attr(dwAllocAttributes).dwMemoryProtect == XALLOC_MEMPROTECT_READWRITE, 249); ptr = _MemAllocTemp( dwSize, __FILE__, - 0x107, + 263, AllocType(dwAllocAttributes), AllocAlign(dwAllocAttributes) ); if (dwAllocAttributes & 0x4000) { - MILO_ASSERT(ptr, 0x10D); + MILO_ASSERT(ptr, 269); } if (Attr(dwAllocAttributes).dwZeroInitialize && ptr) { memset(ptr, 0, dwSize); @@ -214,12 +271,12 @@ VOID *XMemAlloc(SIZE_T dwSize, DWORD dwAllocAttributes) { } else { ptr = XMemAllocDefault(dwSize, dwAllocAttributes); if (!ptr) { - MemAllocFailed(dwSize, memType); + MemAllocFailed(dwSize, dwMemoryType); } int sizeDefault = XMemSizeDefault(ptr, dwAllocAttributes); gPhysicalUsage += sizeDefault; MemTrackAlloc( - dwSize, sizeDefault, AllocType(dwAllocAttributes), ptr, false, 0, __FILE__, 0xF0 + dwSize, sizeDefault, AllocType(dwAllocAttributes), ptr, false, 0, __FILE__, 240 ); } return ptr; diff --git a/src/system/rndobj/RenderState.h b/src/system/rndobj/RenderState.h index 02b230590..06dc27ff0 100644 --- a/src/system/rndobj/RenderState.h +++ b/src/system/rndobj/RenderState.h @@ -42,9 +42,9 @@ class RndRenderState { }; // basically D3DTEXTUREFILTERTYPE enum FilterMode { - kFilterModeNone = 0x0002, kFilterModePoint = 0x0000, kFilterModeLinear = 0x0001, + kFilterModeNone = 0x0002, kFilterModeAnisotropic = 0x0004, }; // basically D3DTEXTUREADDRESS