Skip to content

Commit 8fc3436

Browse files
committed
Added cJob and JobManager
1 parent ea3cba9 commit 8fc3436

File tree

7 files changed

+124
-4
lines changed

7 files changed

+124
-4
lines changed

Spore ModAPI/SourceCode/DLL/AddressesApp.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <Spore\App\IMessageManager.h>
1414
#include <Spore\App\IPropManager.h>
1515
#include <Spore\App\IClassManager.h>
16+
#include <Spore\App\JobManager.h>
17+
#include <Spore\App\cJob.h>
1618
//#include <Spore\App\IStateManager.h>
1719
#include <Spore\App\Property.h>
1820
#include <Spore\App\PropertyList.h>
@@ -386,5 +388,23 @@ namespace App
386388
{
387389
DefineAddress(Get, SelectAddress(0x67DF80, , 0x67DE20));
388390
}
391+
392+
namespace Addresses(IJobManager)
393+
{
394+
DefineAddress(Get, SelectAddress(0x68F980, , 0x68F490));
395+
}
396+
397+
namespace Addresses(cJob)
398+
{
399+
DefineAddress(AddRef, SelectAddress(0x68FE20, , 0x68F910));
400+
DefineAddress(Release, SelectAddress(0x690540, , 0x6900E0));
401+
DefineAddress(AddDependency, SelectAddress(0x6915D0, , 0x691340));
402+
DefineAddress(AddWeakDependency, SelectAddress(0x691610, , 0x691380));
403+
DefineAddress(Wait, SelectAddress(0x692900, , 0x692670));
404+
DefineAddress(Cancel, SelectAddress(0x692650, , 0x6923C0));
405+
DefineAddress(Resume, SelectAddress(0x690DD0, , 0x690970));
406+
DefineAddress(Continuation, SelectAddress(0x68FE80, , 0x68F9B0));
407+
DefineAddress(GetStatus, SelectAddress(0x68FE40, , 0x68F930));
408+
}
389409
}
390410
#endif

Spore ModAPI/SourceCode/DLL/TextureOverride.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ReplacedModelInstance
5151
Graphics::cModelInstance* CopyMesh(Graphics::cModelInstance* mesh) {
5252
Graphics::cModelInstance* copy = new Graphics::cModelInstance();
5353
copy->mMeshes = mesh->mMeshes;
54-
copy->field_1C = mesh->field_1C;
54+
copy->mBoneRanges = mesh->mBoneRanges;
5555
copy->mMaterialInfos = mesh->mMaterialInfos;
5656
copy->mRegionMaterialInfos = mesh->mRegionMaterialInfos;
5757
copy->field_70 = mesh->field_70;

Spore ModAPI/Spore ModAPI.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@
313313
<ClInclude Include="Spore\App\GameSpace.h" />
314314
<ClInclude Include="Spore\App\ITokenTranslator.h" />
315315
<ClInclude Include="Spore\App\IDGenerator.h" />
316+
<ClInclude Include="Spore\App\JobManager.h" />
316317
<ClInclude Include="Spore\App\Thumbnail_cImportExport.h" />
317318
<ClInclude Include="Spore\BasicIncludes.h" />
318319
<ClInclude Include="Spore\CppRevEng.h" />

Spore ModAPI/Spore ModAPI.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,6 +1926,9 @@
19261926
<ClInclude Include="Spore\Skinner\cSkinPainter.h">
19271927
<Filter>Header Files</Filter>
19281928
</ClInclude>
1929+
<ClInclude Include="Spore\App\JobManager.h">
1930+
<Filter>Header Files</Filter>
1931+
</ClInclude>
19291932
</ItemGroup>
19301933
<ItemGroup>
19311934
<ClCompile Include="SourceCode\Allocator.cpp">
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#pragma once
2+
3+
#include <Spore\App\cJob.h>
4+
#include <Spore\Internal.h>
5+
6+
#define JobManager (*App::IJobManager::Get())
7+
8+
namespace App
9+
{
10+
class cJobThread; //TODO
11+
class LimitStopwatch; //TODO
12+
13+
class IJobManager
14+
{
15+
public:
16+
/* 00h */ virtual ~IJobManager() = 0;
17+
/* 04h */ virtual bool Initialize() = 0;
18+
/* 08h */ virtual void PreShutdown() = 0;
19+
/* 0Ch */ virtual void Dispose() = 0;
20+
/* 10h */ virtual bool CreateJob(cJob*& pDst) = 0;
21+
/* 14h */ virtual cJobThread* CreateJobThread(int, bool, int) = 0;
22+
/* 18h */ virtual void DestroyJobThread(cJobThread* thread) = 0;
23+
/* 1Ch */ virtual bool Run(cJobThread* thread, LimitStopwatch* stopwatch = nullptr, bool = false) = 0;
24+
/* 20h */ virtual void Lock() = 0;
25+
/* 24h */ virtual void Unlock() = 0;
26+
/* 28h */ virtual void RaiseThreadPriorities(int priority) = 0;
27+
/* 2Ch */ virtual void RestoreThreadPriorities() = 0;
28+
/* 30h */ virtual bool CircularRef(cJob* job1, cJob* job2) = 0;
29+
/* 34h */ virtual bool JobsAreActive(int) = 0;
30+
/* 38h */ virtual void DebugDumpStatus() = 0; // does nothing
31+
/* 3Ch */ virtual void DebugDumpDot(int) = 0; // does nothing
32+
/* 40h */ virtual void DebugAddBackgroundScopes() = 0; // does nothing
33+
34+
static IJobManager* Get();
35+
};
36+
37+
namespace Addresses(IJobManager)
38+
{
39+
DeclareAddress(Get); // 0x68F980 0x68F490
40+
}
41+
}

Spore ModAPI/Spore/App/cJob.h

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,60 @@
22

33
namespace App
44
{
5-
class cJob; // TODO
5+
class cJob;
6+
7+
typedef bool(*cJobCallback)(cJob*, void*);
8+
9+
class cJob
10+
{
11+
// We only care about the methods, not the fields
12+
13+
int AddRef();
14+
int Release();
15+
16+
/// Sets the method that is called to execute this job.
17+
/// @param callback
18+
/// @param object Additional parameter that is passed to the callback method.
19+
void SetMethodCallback(cJobCallback callback, void* object);
20+
21+
void AddDependency(cJob* other);
22+
void AddWeakDependency(cJob* other);
23+
24+
/// Blocks the current thread until this job finishes executing.
25+
void Wait();
26+
27+
/// Cancels the execution of the job.
28+
/// @param wait
29+
void Cancel(bool wait);
30+
31+
void Resume();
32+
33+
/// Sets a function that must be executed when the job finishes.
34+
/// @param callback Function that will be executed
35+
/// @param data Additional data that is passed to the function.
36+
void Continuation(void(*callback)(cJob*, void*), void* data);
37+
38+
int GetStatus();
39+
40+
void SetThreadAffinity(uint32_t affinity = 0x80000000);
41+
42+
public:
43+
/* 00h */ cJobCallback mCallback;
44+
/* 04h */ void* mpCallbackObject;
45+
/* 08h */ char padding[0x18 - 0x8];
46+
/* 18h */ uint32_t mThreadAffinity;
47+
};
48+
49+
namespace Addresses(cJob)
50+
{
51+
DeclareAddress(AddRef); // 0x68FE20 0x68F910
52+
DeclareAddress(Release); // 0x690540 0x6900E0
53+
DeclareAddress(AddDependency); // 0x6915D0 0x691340
54+
DeclareAddress(AddWeakDependency); // 0x691610 0x691380
55+
DeclareAddress(Wait); // 0x692900 0x692670
56+
DeclareAddress(Cancel); // 0x692650 0x6923C0
57+
DeclareAddress(Resume); // 0x690DD0 0x690970
58+
DeclareAddress(Continuation); // 0x68FE80 0x68F9B0
59+
DeclareAddress(GetStatus); // 0x68FE40 0x68F930
60+
}
661
}

Spore ModAPI/Spore/Object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class MultithreadObject
150150
class RefCountTemplate
151151
{
152152
public:
153-
virtual ~RefCountTemplate();
153+
virtual ~RefCountTemplate() {};
154154

155155
int AddRef();
156156
int Release();
@@ -162,7 +162,7 @@ class RefCountTemplate
162162
class RefCountTemplateAtomic
163163
{
164164
public:
165-
virtual ~RefCountTemplateAtomic();
165+
virtual ~RefCountTemplateAtomic() {};
166166

167167
int AddRef();
168168
int Release();

0 commit comments

Comments
 (0)