summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-01-23 02:36:34 +0300
committerNikolay Korolev <nickvnuk@gmail.com>2021-01-23 02:36:34 +0300
commit965a3d6eec31f4f7f98cd01ac2fad606dcb3f8fa (patch)
tree271fa6491edb2fe5b97486f5df4ec83b77a5e8ed
parent917cf44defae5d304f590c8754e448b875d56357 (diff)
parentc884edd923a20e2fdf697bb7101039c812c6db25 (diff)
Merge remote-tracking branch 'upstream/lcs' into lcs
-rw-r--r--premake5.lua2
-rw-r--r--src/control/Script.cpp5
-rw-r--r--src/leeds/smallHeap.cpp20
-rw-r--r--src/leeds/smallHeap.h17
4 files changed, 42 insertions, 2 deletions
diff --git a/premake5.lua b/premake5.lua
index 2fe5cc97..2a8e6c93 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -242,6 +242,7 @@ project "reLCS"
files { addSrcFiles("src/control") }
files { addSrcFiles("src/core") }
files { addSrcFiles("src/entities") }
+ files { addSrcFiles("src/leeds") }
files { addSrcFiles("src/leeds/base") }
files { addSrcFiles("src/math") }
files { addSrcFiles("src/modelinfo") }
@@ -267,6 +268,7 @@ project "reLCS"
includedirs { "src/control" }
includedirs { "src/core" }
includedirs { "src/entities" }
+ includedirs { "src/leeds" }
includedirs { "src/leeds/base" }
includedirs { "src/math" }
includedirs { "src/modelinfo" }
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 17572531..7712a335 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -50,7 +50,7 @@
#include "Timecycle.h"
#include "TxdStore.h"
#include "Bike.h"
-#include "memoryManager.h"
+#include "smallHeap.h"
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#include <stdarg.h>
#endif
@@ -2644,7 +2644,8 @@ bool CTheScripts::Init(bool loaddata)
CFileMgr::Read(mainf, (char*)&MainScriptSize, sizeof(MainScriptSize));
int nLargestMissionSize = 0;
CFileMgr::Read(mainf, (char*)&nLargestMissionSize, sizeof(nLargestMissionSize));
- // some cSmallHeap shit - TODO
+ if (!cSmallHeap::msInstance.IsLocked())
+ cSmallHeap::msInstance.Lock();
ScriptSpace = (uint8*)base::cMainMemoryManager::Instance()->Allocate(MainScriptSize + nLargestMissionSize);
memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize);
CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize);
diff --git a/src/leeds/smallHeap.cpp b/src/leeds/smallHeap.cpp
new file mode 100644
index 00000000..262113af
--- /dev/null
+++ b/src/leeds/smallHeap.cpp
@@ -0,0 +1,20 @@
+#include "common.h"
+#include "smallHeap.h"
+
+cSmallHeap cSmallHeap::msInstance;
+
+cSmallHeap::cSmallHeap()
+{
+ bLocked = false;
+ bUnk = false;
+}
+
+void cSmallHeap::Lock()
+{
+ // TODO: PS2 code
+}
+
+void cSmallHeap::Unlock()
+{
+ // TODO: PS2 code
+} \ No newline at end of file
diff --git a/src/leeds/smallHeap.h b/src/leeds/smallHeap.h
new file mode 100644
index 00000000..f2897688
--- /dev/null
+++ b/src/leeds/smallHeap.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "memoryManager.h"
+
+class cSmallHeap : public base::cMemoryManager
+{
+ bool bLocked;
+ bool bUnk;
+public:
+ cSmallHeap();
+ void Lock();
+ void Unlock();
+
+ bool IsLocked() const { return bLocked; }
+
+ static cSmallHeap msInstance;
+}; \ No newline at end of file