diff --git a/MarathonRecomp/api/Marathon.h b/MarathonRecomp/api/Marathon.h index ebdf1f766..d4f6ce612 100644 --- a/MarathonRecomp/api/Marathon.h +++ b/MarathonRecomp/api/Marathon.h @@ -17,6 +17,9 @@ #include "CSD/Platform/csdTexList.h" #include "Sonicteam/Actor.h" #include "Sonicteam/AppMarathon.h" +#include "Sonicteam/SceneLODParam.h" +#include "Sonicteam/SceneShadowMapParam.h" +#include "Sonicteam/ISceneParam.h" #include "Sonicteam/Camera/CameraMode.h" #include "Sonicteam/Camera/Cameraman.h" #include "Sonicteam/Camera/SonicCamera.h" @@ -48,12 +51,15 @@ #include "Sonicteam/Player/State/Object2.h" #include "Sonicteam/Player/State/TailsContext.h" #include "Sonicteam/SoX/AI/StateMachine.h" +#include #include "Sonicteam/SoX/Component.h" #include "Sonicteam/SoX/Engine/Doc.h" #include "Sonicteam/SoX/Engine/DocMode.h" #include "Sonicteam/SoX/Engine/Task.h" #include "Sonicteam/SoX/MessageReceiver.h" #include "Sonicteam/SoX/Object.h" +#include "Sonicteam/SoX/Scenery/Camera.h" +#include "Sonicteam/SoX/Scenery/CameraImp.h" #include "Sonicteam/TitleTask.h" #include "boost/smart_ptr/make_shared_object.h" #include "boost/smart_ptr/shared_ptr.h" diff --git a/MarathonRecomp/api/Sonicteam/ISceneParam.h b/MarathonRecomp/api/Sonicteam/ISceneParam.h new file mode 100644 index 000000000..fcc85342e --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/ISceneParam.h @@ -0,0 +1,22 @@ +#pragma once + +#include +#include + +namespace Sonicteam +{ + template + struct LinkSoxNode + { + xpointer> m_Prev; + xpointer> m_Next; + xpointer m_This; + }; + + class ISceneParam : public SoX::RefCountObject + { + public: + LinkSoxNode m_Link; + + }; +} diff --git a/MarathonRecomp/api/Sonicteam/SceneLODParam.h b/MarathonRecomp/api/Sonicteam/SceneLODParam.h new file mode 100644 index 000000000..86e696cf2 --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SceneLODParam.h @@ -0,0 +1,46 @@ +#pragma once + +#include +#include + +namespace Sonicteam +{ + + + class SceneLODParam : public ISceneParam + { + public: + struct LODParam + { + uint8_t m_IsSet; + MARATHON_INSERT_PADDING(3); + be m_FarDistance; + be m_ClipDistance; + be m_TerrainClipDistance; + }; + enum LODEnum + { + Main, + MainXp, + MainSky, + MainPsi, + MainOC, + MainGlare, + MainAfterPP, + Light0, + Light1, + Light2, + Light3, + Reflection0, + ReflectionSky, + MainUser0, + MainUser1, + User0, + User1, + MainParticle, + RaderMap + }; + LODParam m_LODParam[19]; + + }; +} diff --git a/MarathonRecomp/api/Sonicteam/SceneShadowMapParam.h b/MarathonRecomp/api/Sonicteam/SceneShadowMapParam.h new file mode 100644 index 000000000..4ed1c2106 --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SceneShadowMapParam.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include + +namespace Sonicteam +{ + class SceneShadowMapParam : public ISceneParam + { + public: + struct ShadowMapParam + { + be m_BaseSize; + be m_Float1; + be m_Float2; + be m_Float3; + be m_CenterOffsetX; + be m_CenterOffsetY; + be m_CenterOffsetZ; + be m_CenterOffsetW; + + ShadowMapParam() + { + m_BaseSize = 1000.0; + m_Float1 = 10.0; + m_Float2 = 160000.0; //Far Distance??? + m_Float3 = 40000.0; + m_CenterOffsetX = 0.0; + m_CenterOffsetY = 0.0; + m_CenterOffsetZ = 500.0; + m_CenterOffsetW = 1.0; + } + }; + }; +} diff --git a/MarathonRecomp/api/Sonicteam/SoX/RefCountObject.h b/MarathonRecomp/api/Sonicteam/SoX/RefCountObject.h new file mode 100644 index 000000000..a7aa1faae --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SoX/RefCountObject.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +namespace Sonicteam::SoX +{ + class RefCountObject + { + public: + xpointer m_pVftable; + be m_RefCount; + }; +} diff --git a/MarathonRecomp/api/Sonicteam/SoX/Scenery/Camera.h b/MarathonRecomp/api/Sonicteam/SoX/Scenery/Camera.h new file mode 100644 index 000000000..ff3c0392b --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SoX/Scenery/Camera.h @@ -0,0 +1,10 @@ +#pragma once +#include +namespace Sonicteam::SoX::Scenery +{ + class Camera + { + public: + xpointer m_pVftable; + }; +} diff --git a/MarathonRecomp/api/Sonicteam/SoX/Scenery/CameraImp.h b/MarathonRecomp/api/Sonicteam/SoX/Scenery/CameraImp.h new file mode 100644 index 000000000..aeb0f3e32 --- /dev/null +++ b/MarathonRecomp/api/Sonicteam/SoX/Scenery/CameraImp.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include + + +namespace Sonicteam::SoX::Scenery +{ + class CameraImp:Sonicteam::SoX::Scenery::Camera + { + public: + static constexpr std::string_view c_Main = "Main"; + static constexpr std::string_view c_MainSky = "MainSky"; + static constexpr std::string_view c_MainPsi = "MainPsi"; + static constexpr std::string_view c_MainOC = "MainOC"; + static constexpr std::string_view c_MainGlare = "MainGlare"; + static constexpr std::string_view c_MainAfterPP = "MainAfterPP"; + static constexpr std::string_view c_Reflection0 = "Reflection0"; + static constexpr std::string_view c_ReflectionSky = "ReflectionSky"; + static constexpr std::string_view c_MainUser0 = "MainUser0"; + static constexpr std::string_view c_MainUser1 = "MainUser1"; + static constexpr std::string_view c_User0 = "User0"; + static constexpr std::string_view c_User1 = "User1"; + static constexpr std::string_view c_MainParticle = "MainParticle"; + static constexpr std::string_view c_Light0 = "Light0"; + static constexpr std::string_view c_Light1 = "Light1"; + static constexpr std::string_view c_Light2 = "Light2"; + static constexpr std::string_view c_Light3 = "Light3"; + static constexpr std::string_view c_RaderMap = "RaderMap"; + + + stdx::string m_CamName; + be m_FOV; + be m_Param1; // == 16.0 + be m_Param2; // == 9.0 + be m_Param3; // == 1.0 + be m_Far; // + MARATHON_INSERT_PADDING(0x1EC); + }; +} diff --git a/MarathonRecomp/app.cpp b/MarathonRecomp/app.cpp index 272522297..1408da9e1 100644 --- a/MarathonRecomp/app.cpp +++ b/MarathonRecomp/app.cpp @@ -173,3 +173,43 @@ PPC_FUNC(sub_825822D0) __imp__sub_825822D0(ctx, base); } #endif + +PPC_FUNC_IMPL(__imp__sub_82590C38); +PPC_FUNC(sub_82590C38) +{ + auto pCamera = (Sonicteam::SoX::Scenery::CameraImp*)(base + ctx.r3.u32); + float pFar = ctx.f1.f64; + pCamera->m_Far = pFar; + printf("pCamera[%s] pFar = %f\n", pCamera->m_CamName.c_str(), pFar); + pCamera->m_Far = 12800000; + GuestToHostFunction(sub_82590A28,ctx.r3.u32,pFar); + return; +} + +//821728D4 (secondary) +//SceneLODParam::InitializeSceneParam +PPC_FUNC_IMPL(__imp__sub_825F3FE0); +PPC_FUNC(sub_825F3FE0) +{ + auto pSceneLOD = (Sonicteam::SceneLODParam*)(base + ctx.r3.u32); + __imp__sub_825F3FE0(ctx, base); + auto& lMain = pSceneLOD->m_LODParam[Sonicteam::SceneLODParam::Main]; + for (int i = 0; i < 19; i++) + { + pSceneLOD->m_LODParam[i].m_IsSet = 1; + pSceneLOD->m_LODParam[i].m_FarDistance = 12800000; + pSceneLOD->m_LODParam[i].m_ClipDistance = 12800000; + pSceneLOD->m_LODParam[i].m_TerrainClipDistance = 12800000; + + } + return; +} + +//SceneShadowMapParam::InitializeSceneParam +PPC_FUNC_IMPL(__imp__sub_825F5DA8); +PPC_FUNC(sub_825F5DA8) +{ + auto pSceneLOD = (Sonicteam::SceneShadowMapParam*)(base + ctx.r3.u32); + __imp__sub_825F5DA8(ctx, base); + auto pParamMarathon = (Sonicteam::SceneShadowMapParam::ShadowMapParam*)(base + 0x82B84B30); +}