Skip to content

Commit

Permalink
Created TLString.h
Browse files Browse the repository at this point in the history
  • Loading branch information
AdventureT committed Dec 9, 2023
1 parent 57ef274 commit 5369f96
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 20 deletions.
25 changes: 25 additions & 0 deletions Toshi/Include/TKernel/TLString.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once

#include "TDebug.h"
#include "TFreeList.h"

TOSHI_NAMESPACE_BEGIN

class TOSHI_EXPORT TLocale
{
public:
static int const TEMP_START_INDEX = 0x40000000;
};

class TOSHI_EXPORT TLocalisedString
{
public:
static TFreeList& __stdcall GetFreeList() { return m_oFreelist; }

private:
static TFreeList m_oFreelist;

TINT m_iIDInt; // 0x4
};

TOSHI_NAMESPACE_END
18 changes: 15 additions & 3 deletions Toshi/Include/TKernel/TMemory.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "TDebug.h"
#include "TThread.h"
#include "TNodeList.h"

#define TMEMORY_ROUNDUP 4

Expand Down Expand Up @@ -34,25 +35,36 @@ class TOSHI_EXPORT TMemory

};

class MemBlockSlot
{

class MemBlockSlot : TNodeList<MemBlockSlot>::TNode
{
public:
TINT m_iSlot; // 0xC
};

class MemBlock
{
TPVOID m_pMemBlockSlot; // 0x0 TNodeList
public:
MemBlockSlot* m_pMemBlockSlot; // 0x0
// 0x4
TPVOID m_pMemory; // 0x8
TUINT m_uiMemorySize; // 0xC
};
public:

static TBOOL __stdcall Initialise();
static void __stdcall DebugPrintHALMemInfo(TCHAR const*) {};
static TMemory& __stdcall GetMemMangager();
static MemBlock* __stdcall GetGlobalBlock();
static MemNode* __stdcall GetMemNodeFromAddress(TPVOID a_pAddr);
static void __stdcall ExtendNodeSize(MemNode* a_pMemNode, TUINT a_iuSize);

TPVOID Alloc(TUINT a_uiSize, TUINT a_uiAlignment, MemBlock* a_pMemBlock, TPCHAR a_pBuffer ,TINT a_iUnk3);
TBOOL Free(TPVOID a_pMem);

protected:
static TUINT __stdcall GetFreePhysicalMemory() { return 0x8000000; }

private:
inline static TBOOL m_bInitialised = TFALSE;

Expand Down
20 changes: 3 additions & 17 deletions Toshi/Include/TKernel/TNodeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,26 +323,12 @@ class TOSHI_EXPORT TGenericNodeList
TINT m_iCount; // 0x10
};

template <class T, int C = 0>
class TDList : public TGenericDList
template <class T>
class TNodeList : public TGenericNodeList
{
public:

TDList() { }




T* Head() { return static_cast<T*>(TGenericDList::Head()); }
T* Tail() { return static_cast<T*>(TGenericDList::Tail()); }
Iterator Begin() { return (T*)(TGenericDList::Begin()); }
Iterator End() const { return (T*)(TGenericDList::End()); }
TBOOL IsEmpty() { return TGenericDList::IsEmpty(); }
TBOOL IsLinked() { return m_Root.IsLinked(); }
void RemoveHead() { TGenericDList::RemoveHead(); }
void RemoveTail() { TGenericDList::RemoveTail(); }
void InsertHead(TNode* a_pNode) { TGenericDList::InsertHead(a_pNode); }
void InsertTail(TNode* a_pNode) { TGenericDList::InsertTail(a_pNode); }
TNodeList() { }
};

TOSHI_NAMESPACE_END
5 changes: 5 additions & 0 deletions Toshi/Source/TKernel/TLString.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "TLString.h"

TOSHI_NAMESPACE_USING

TFreeList TLocalisedString::m_oFreelist = TFreeList(sizeof(TLocalisedString), 0, 2000, (char*)"")
9 changes: 9 additions & 0 deletions Toshi/Source/TKernel/TMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ TMemory::MemBlock* __stdcall TMemory::GetGlobalBlock()
return g_oMemManager.m_pMemBlock;
}

TMemory::MemNode* __stdcall TMemory::GetMemNodeFromAddress(TPVOID a_pAddr)
{
return TNULL;
}

void __stdcall TMemory::ExtendNodeSize(MemNode* a_pMemNode, TUINT a_uiSize)
{
}

TPVOID TMemory::Alloc(TUINT a_uiSize, TUINT a_uiAlignment, MemBlock* a_pMemBlock, TPCHAR a_pBuffer, TINT a_iUnk3)
{
// Let's just use malloc until i implemented this
Expand Down

0 comments on commit 5369f96

Please sign in to comment.