From 6ee36ca893c7c1b88ba2be91fd7e902e8ebb7747 Mon Sep 17 00:00:00 2001 From: AdventureT Date: Sun, 17 Dec 2023 10:27:10 +0100 Subject: [PATCH] !BROKEN! --- OpenJPOG/Source/ARootTask.cpp | 11 +++++++++++ OpenJPOG/Source/ARootTask.h | 6 ++++++ OpenJPOG/Source/AVibrationManager.cpp | 5 +++++ OpenJPOG/Source/AVibrationManager.h | 15 +++++++++++++++ OpenJPOG/Source/main.cpp | 13 +++++++++++++ Toshi/Include/TKernel/TKernelInterface.h | 1 + Toshi/Include/TKernel/TTask.h | 2 ++ Toshi/Source/TKernel/TTask.cpp | 4 ++++ 8 files changed, 57 insertions(+) create mode 100644 OpenJPOG/Source/AVibrationManager.cpp create mode 100644 OpenJPOG/Source/AVibrationManager.h diff --git a/OpenJPOG/Source/ARootTask.cpp b/OpenJPOG/Source/ARootTask.cpp index 67a6c35..6b44389 100644 --- a/OpenJPOG/Source/ARootTask.cpp +++ b/OpenJPOG/Source/ARootTask.cpp @@ -1,6 +1,17 @@ #include "ARootTask.h" +class AApplication; +extern AApplication g_oTheApp; + TOSHI_NAMESPACE_USING IMPLEMENT_DYNCREATE(ARootTask, TTask); +void ARootTask::AllocateInputSystem() +{ + TScheduler* pScheduler = g_oTheApp.GetKernel()->GetScheduler(); + ADummyTask* pInputTask = g_oTheApp.GetInputRootTask(); + m_pInputTask = pScheduler->CreateTask(TGetClass(ADummyTask), pInputTask); + m_pVibrationTask = (AVibrationManager*)pScheduler->CreateTask(TGetClass(AVibrationManager), pInputTask); + +} diff --git a/OpenJPOG/Source/ARootTask.h b/OpenJPOG/Source/ARootTask.h index ebe1187..ea17467 100644 --- a/OpenJPOG/Source/ARootTask.h +++ b/OpenJPOG/Source/ARootTask.h @@ -2,6 +2,7 @@ #include "TKernel/TTask.h" #include "TKernel/TCString.h" +#include "AVibrationManager.h" class ARootTask : public Toshi::TTask { @@ -15,6 +16,11 @@ class ARootTask : public Toshi::TTask m_szName = a_szName; } +private: + void AllocateInputSystem(); + private: Toshi::TCString m_szName; + TTask* m_pInputTask; // 0x38 + AVibrationManager* m_pVibrationTask; // 0xE8 }; \ No newline at end of file diff --git a/OpenJPOG/Source/AVibrationManager.cpp b/OpenJPOG/Source/AVibrationManager.cpp new file mode 100644 index 0000000..b77139d --- /dev/null +++ b/OpenJPOG/Source/AVibrationManager.cpp @@ -0,0 +1,5 @@ +#include "AVibrationManager.h" + +TOSHI_NAMESPACE_USING + +IMPLEMENT_DYNCREATE(AVibrationManager, TTask); \ No newline at end of file diff --git a/OpenJPOG/Source/AVibrationManager.h b/OpenJPOG/Source/AVibrationManager.h new file mode 100644 index 0000000..839fc49 --- /dev/null +++ b/OpenJPOG/Source/AVibrationManager.h @@ -0,0 +1,15 @@ +#pragma once +#include "TKernel/TTask.h" +#include "TKernel/TCString.h" + +class AVibrationManager : public Toshi::TTask +{ + DECLARE_DYNAMIC(AVibrationManager); +public: + AVibrationManager() = default; + virtual ~AVibrationManager() = default; + +private: + +private: +}; \ No newline at end of file diff --git a/OpenJPOG/Source/main.cpp b/OpenJPOG/Source/main.cpp index 5654b61..b795d11 100644 --- a/OpenJPOG/Source/main.cpp +++ b/OpenJPOG/Source/main.cpp @@ -1,12 +1,25 @@ #include "TApplication/TApplication.h" #include "TKernel/TMemory.h" +#include "ADummyTask.h" class AApplication : public Toshi::TApplication { virtual TBOOL OnCreate(TINT argc, TPCHAR* const argv) override { + + m_pInputTask = (ADummyTask*)GetKernel()->GetScheduler()->CreateTask(TGetClass(ADummyTask), m_pInputTask); + m_pInputTask->Create(); + m_pInputTask->Activate(TTRUE); + m_pInputTask->SetName((TPCHAR)"InputTask"); + return TApplication::OnCreate(argc, argv); } +public: + ADummyTask* GetInputRootTask() const { return m_pInputTask; } + +private: + // TApplication 0x0 -> 0x1C + ADummyTask* m_pInputTask; // 0x1C }; static AApplication g_oTheApp; diff --git a/Toshi/Include/TKernel/TKernelInterface.h b/Toshi/Include/TKernel/TKernelInterface.h index f6d2785..9f8f214 100644 --- a/Toshi/Include/TKernel/TKernelInterface.h +++ b/Toshi/Include/TKernel/TKernelInterface.h @@ -17,6 +17,7 @@ class TOSHI_EXPORT TKernelInterface : public TObject void DumpInfo(); THPTimer* GetSystemTimer() { return &m_oSysTimer; } + TScheduler* GetScheduler() const { return (TScheduler*)&m_pScheduler; } private: THPTimer m_oSysTimer; // 0x8 TManagedPointer m_pScheduler; // 0x30 diff --git a/Toshi/Include/TKernel/TTask.h b/Toshi/Include/TKernel/TTask.h index 02633e1..34bb54b 100644 --- a/Toshi/Include/TKernel/TTask.h +++ b/Toshi/Include/TKernel/TTask.h @@ -29,6 +29,8 @@ class TOSHI_EXPORT TTask : public TObject, public TNodeTree::TNode virtual void OnActivate(); virtual void OnDeactivate(); + void Activate(TBOOL a_bActivate); + TBOOL IsCreated() const { return HASFLAG(m_iState & State_Created); } TBOOL IsActive() const { return HASFLAG(m_iState & State_Active); } TBOOL IsDying() const { return HASFLAG(m_iState & State_Dying); } diff --git a/Toshi/Source/TKernel/TTask.cpp b/Toshi/Source/TKernel/TTask.cpp index 995a49e..33283c8 100644 --- a/Toshi/Source/TKernel/TTask.cpp +++ b/Toshi/Source/TKernel/TTask.cpp @@ -59,3 +59,7 @@ void TTask::OnActivate() void TTask::OnDeactivate() { } + +void TTask::Activate(TBOOL a_bActivate) +{ +}