Skip to content

Commit 591608b

Browse files
committed
Added cSporeApp, cAppSystem, Canvas, CommandLine to App. Added Resource::Paths::CreateSaveAreaDirectoryDatabase()
1 parent b769371 commit 591608b

File tree

12 files changed

+508
-1
lines changed

12 files changed

+508
-1
lines changed

Spore ModAPI/SourceCode/App/App.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Spore\App\AppData.h>
44
#include <Spore\App\IDGenerator.h>
55
#include <Spore\App\cCreatureModeStrategy.h>
6+
#include <Spore\App\cSporeApp.h>
67

78
namespace App
89
{
@@ -24,5 +25,26 @@ namespace App
2425
auto_STATIC_METHOD_(cIDGenerator, cIDGenerator*, Get);
2526

2627
auto_STATIC_METHOD_(cCreatureModeStrategy, cCreatureModeStrategy*, Get);
28+
29+
30+
auto_STATIC_METHOD_(IAppSystem, IAppSystem*, Get);
31+
32+
auto_STATIC_METHOD(cSporeApp, int, EAMain, Args(CommandLine* commandLine), Args(commandLine));
33+
auto_STATIC_METHOD(cSporeApp, bool, Init, Args(CommandLine* commandLine), Args(commandLine));
34+
auto_STATIC_METHOD_VOID_(cSporeApp, Run);
35+
auto_STATIC_METHOD_(cSporeApp, bool, Shutdown);
36+
37+
38+
auto_METHOD(CommandLine, eastl::string16&, Get, Args(int i), Args(i));
39+
40+
auto_METHOD(CommandLine, int, FindSwitch,
41+
Args(const char16_t* a1, bool a2, eastl::string16* a3, int a4),
42+
Args(a1, a2, a3, a4));
43+
44+
CommandLine* GetAppCommandLine() {
45+
return *(CommandLine**)GetAddress(App, sAppCommandLine);
46+
}
47+
48+
auto_STATIC_METHOD_(Canvas, Canvas*, Get);
2749
}
2850
#endif

Spore ModAPI/SourceCode/DLL/AddressesApp.cpp

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@
2626
#include <Spore\App\cLocaleManager.h>
2727
#include <Spore\App\AppData.h>
2828
#include <Spore\App\IDGenerator.h>
29+
#include <Spore\App\cSporeApp.h>
30+
#include <Spore\App\Canvas.h>
2931

3032
namespace Addresses(App)
3133
{
34+
DefineAddress(sAppCommandLine, SelectAddress(0x1601BA8, 0x15FD920));
3235
#ifndef SDK_TO_GHIDRA
3336
DefineAddress(AppProperties_ptr, SelectAddress(0x1601BA0, 0x15FD918));
3437
#else
@@ -480,6 +483,102 @@ namespace App
480483
DefineAddress(HandleMessage, SelectAddress(0x7DA180, 0x7D9D00));
481484
DefineAddress(CalculateViewTransform, SelectAddress(0x7DAB30, 0x7DA6B0));
482485
}
486+
487+
namespace Addresses(IAppSystem)
488+
{
489+
DefineAddress(Get, SelectAddress(0x67DE20, 0x67DCC0));
490+
}
491+
492+
namespace Addresses(cAppSystem)
493+
{
494+
DefineAddress(Create, SelectAddress(0x7E8E10, 0x7E8A00));
495+
DefineAddress(SetUserDirNames, SelectAddress(0x7E98B0, 0x7E94A0));
496+
DefineAddress(PreInit, SelectAddress(0x7E9050, 0x7E8C40));
497+
DefineAddress(Init, SelectAddress(0x7E6C60, 0x7E6850));
498+
DefineAddress(InitPlugins, SelectAddress(0x7E97E0, 0x7E93D0));
499+
DefineAddress(Configure, SelectAddress(0x7E7840, 0x7E7430));
500+
DefineAddress(InitGraphics, SelectAddress(0x7EAF50, 0x7EAAE0));
501+
DefineAddress(PreShutdown, SelectAddress(0x7E6940, 0x7E6520));
502+
DefineAddress(Shutdown, SelectAddress(0x7E9930, 0x7E9520));
503+
DefineAddress(Pause, SelectAddress(0x7E6340, 0x7E5F20));
504+
DefineAddress(Unpause, SelectAddress(0x7E6350, 0x7E5F30));
505+
DefineAddress(IsPaused, SelectAddress(0x7E6360, 0x7E5F40));
506+
DefineAddress(SetTimeScale, SelectAddress(0x7E6370, 0x7E5F50));
507+
DefineAddress(SetFixedStepping, SelectAddress(0x7E6390, 0x7E5F70));
508+
DefineAddress(BoostBackgroundJobs, SelectAddress(0x7E6AA0, 0x7E6680));
509+
DefineAddress(IsBoostEnabled, SelectAddress(0x7E6B00, 0x7E66E0));
510+
DefineAddress(Demo, SelectAddress(0xB2FA20, 0x7E6120));
511+
DefineAddress(OpenURL, SelectAddress(0x7EA1E0, 0x7E9DD0));
512+
DefineAddress(func60h, SelectAddress(0x7E63A0, 0x7E5F80));
513+
DefineAddress(func64h, SelectAddress(0x7E63D0, 0x7E5FB0));
514+
DefineAddress(func68h, SelectAddress(0x7E6400, 0x7E5FE0));
515+
DefineAddress(HookWindows, SelectAddress(0x7E64A0, 0x7E6080));
516+
DefineAddress(UnhookWindows, SelectAddress(0x7E64F0, 0x7E60D0));
517+
DefineAddress(SetEffectCollectionIDs, SelectAddress(0x7E6520, 0x7E6100));
518+
DefineAddress(Update, SelectAddress(0x7EA290, 0x7E9E80));
519+
DefineAddress(func7Ch, SelectAddress(0x7E6540, 0x7E6130));
520+
DefineAddress(PostUpdate, SelectAddress(0x7E6550, 0x7E6140));
521+
DefineAddress(func84h, SelectAddress(0x7E6B20, 0x7E6700));
522+
DefineAddress(func88h, SelectAddress(0xA6C9F0, 0xA6C940));
523+
}
524+
525+
namespace Addresses(cSporeApp)
526+
{
527+
DefineAddress(EAMain, SelectAddress(0xF48C10, 0xF48810));
528+
DefineAddress(Init, SelectAddress(0xF48230, 0xF47E90));
529+
DefineAddress(Run, SelectAddress(0xF47810, 0xF47420));
530+
DefineAddress(Shutdown, SelectAddress(0xF47950, 0xF475A0));
531+
}
532+
533+
namespace Addresses(CommandLine)
534+
{
535+
DefineAddress(FindSwitch, SelectAddress(0x92B6C0, 0x92B570));
536+
DefineAddress(Get, SelectAddress(0x92B570, 0x92B420));
537+
}
538+
539+
namespace Addresses(Canvas)
540+
{
541+
DefineAddress(Get, SelectAddress(0x67DE10, 0x67DCB0));
542+
DefineAddress(Init, SelectAddress(0x84A3F0, 0x849BF0));
543+
DefineAddress(Shutdown, SelectAddress(0x848900, 0x848100));
544+
DefineAddress(func0Ch, SelectAddress(0xA134D0, 0xA13540));
545+
DefineAddress(func10h, SelectAddress(0x848240, 0x847A40));
546+
DefineAddress(Update, SelectAddress(0x848290, 0x847A90));
547+
DefineAddress(Clear, SelectAddress(0x8482C0, 0x847AC0));
548+
DefineAddress(GetStyle, SelectAddress(0x985FB0, 0xFCC1D0));
549+
DefineAddress(SetStyle, SelectAddress(0x84A600, 0x849E00));
550+
DefineAddress(GetOptions, SelectAddress(0x923C40, 0x93B630));
551+
DefineAddress(SetOptions, SelectAddress(0x848310, 0x847B10));
552+
DefineAddress(GetCaption, SelectAddress(0x804E30, 0xFF3480));
553+
DefineAddress(SetCaption, SelectAddress(0x84A710, 0x849ED0));
554+
DefineAddress(GetPosition, SelectAddress(0x8489E0, 0x8481E0));
555+
DefineAddress(SetPosition, SelectAddress(0x848A00, 0x848200));
556+
DefineAddress(GetClientArea, SelectAddress(0x848A70, 0x848270));
557+
DefineAddress(SetClientArea, SelectAddress(0x8497B0, 0x848FB0));
558+
DefineAddress(IsActive, SelectAddress(0x848340, 0x847B40));
559+
DefineAddress(SetActive, SelectAddress(0x848360, 0x847B60));
560+
DefineAddress(IsVisible, SelectAddress(0x848380, 0x847B80));
561+
DefineAddress(SetVisible, SelectAddress(0x8483A0, 0x847BA0));
562+
DefineAddress(IsFullscreen, SelectAddress(0x69D4C0, 0xAB2FF0));
563+
DefineAddress(SetFullscreen, SelectAddress(0x8498C0, 0x8490C0));
564+
DefineAddress(IsMinimized, SelectAddress(0x8483C0, 0x847BC0));
565+
DefineAddress(IsMaximized, SelectAddress(0x8483E0, 0x847BE0));
566+
DefineAddress(GetMessageServer, SelectAddress(0xA36470, 0xC871D0));
567+
DefineAddress(SetMessageServer, SelectAddress(0xA168B0, 0xA169B0));
568+
DefineAddress(func6Ch, SelectAddress(0x8487A0, 0xB18CB0));
569+
DefineAddress(func70h, SelectAddress(0x8487B0, 0x847FA0));
570+
DefineAddress(HasSystemCursor, SelectAddress(0xA37650, 0xB1FB30));
571+
DefineAddress(SetSystemCursorVisible, SelectAddress(0x8487D0, 0x847FC0));
572+
DefineAddress(func7Ch, SelectAddress(0x8487F0, 0x847FF0));
573+
DefineAddress(func80h, SelectAddress(0x848820, 0x848020));
574+
DefineAddress(Tick, SelectAddress(0x848AF0, 0x8482F0));
575+
DefineAddress(func88h, SelectAddress(0x84A890, 0x84A050));
576+
DefineAddress(func8Ch, SelectAddress(0x848400, 0x847C00));
577+
DefineAddress(func90h, SelectAddress(0x95FE80, 0x1030E20));
578+
DefineAddress(GetWindow, SelectAddress(0xF681A0, 0xF67D40));
579+
DefineAddress(GetCanvasClass, SelectAddress(0x848410, 0x847C10));
580+
DefineAddress(GetMonitor, SelectAddress(0x848420, 0x847C20));
581+
}
483582
}
484583

485584
#ifdef SDK_TO_GHIDRA

Spore ModAPI/SourceCode/DLL/AddressesResource.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ namespace Resource
266266
DefineAddress(GetSaveArea, SelectAddress(0x6B22C0, 0x6B1F20));
267267
DefineAddress(RegisterSaveArea, SelectAddress(0x6B3A90, 0x6B36F0));
268268
DefineAddress(CreateTempFile, SelectAddress(0x932AC0, 0x932550));
269+
DefineAddress(CreateSaveAreaDirectoryDatabase, SelectAddress(0x6B2950, 0x6B25B0));
269270
};
270271

271272
namespace Addresses(DatabaseDirectoryFiles)

Spore ModAPI/SourceCode/IO/IODefinitions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,10 @@ namespace Resource
513513
Args(char16_t* a1, char16_t* a2, char16_t* a3, char16_t* a4),
514514
Args(a1, a2, a3, a4));
515515

516+
auto_STATIC_METHOD(Paths, bool, CreateSaveAreaDirectoryDatabase,
517+
Args(PathID basePath, const char16_t* folderName, DatabaseDirectoryFilesPtr& dst, SaveAreaID saveArea),
518+
Args(basePath, folderName, dst, saveArea));
519+
516520
const char16_t* Paths::GetDataDir() {
517521
return GetDirFromID(PathID::Data);
518522
}

Spore ModAPI/Spore ModAPI.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,15 @@
304304
<ClInclude Include="Spore\Anim\IAnimWorld.h" />
305305
<ClInclude Include="Spore\Anim\TLSA.h" />
306306
<ClInclude Include="Spore\App\AppData.h" />
307+
<ClInclude Include="Spore\App\Canvas.h" />
308+
<ClInclude Include="Spore\App\cAppSystem.h" />
307309
<ClInclude Include="Spore\App\cArithmeticaResource.h" />
308310
<ClInclude Include="Spore\App\cCellModeStrategy.h" />
309311
<ClInclude Include="Spore\App\cJob.h" />
310312
<ClInclude Include="Spore\App\cLocaleManager.h" />
311313
<ClInclude Include="Spore\App\cMouseCamera.h" />
314+
<ClInclude Include="Spore\App\CommandLine.h" />
315+
<ClInclude Include="Spore\App\cSporeApp.h" />
312316
<ClInclude Include="Spore\App\cStringDetokenizer.h" />
313317
<ClInclude Include="Spore\App\FileDrop.h" />
314318
<ClInclude Include="Spore\App\cCreatureModeStrategy.h" />

Spore ModAPI/Spore ModAPI.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,18 @@
20852085
<ClInclude Include="Spore\Simulator\Cell\CellAnimations.h">
20862086
<Filter>Header Files</Filter>
20872087
</ClInclude>
2088+
<ClInclude Include="Spore\App\cAppSystem.h">
2089+
<Filter>Header Files</Filter>
2090+
</ClInclude>
2091+
<ClInclude Include="Spore\App\CommandLine.h">
2092+
<Filter>Header Files</Filter>
2093+
</ClInclude>
2094+
<ClInclude Include="Spore\App\cSporeApp.h">
2095+
<Filter>Header Files</Filter>
2096+
</ClInclude>
2097+
<ClInclude Include="Spore\App\Canvas.h">
2098+
<Filter>Header Files</Filter>
2099+
</ClInclude>
20882100
</ItemGroup>
20892101
<ItemGroup>
20902102
<ClCompile Include="SourceCode\Allocator.cpp">

Spore ModAPI/Spore/App/Canvas.h

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#pragma once
2+
3+
#include <Spore\App\IMessageManager.h>
4+
#include <Spore\Internal.h>
5+
#include <EASTL\string.h>
6+
7+
namespace App
8+
{
9+
class Canvas
10+
{
11+
public:
12+
static Canvas* Get();
13+
14+
/* 00h */ virtual ~Canvas();
15+
/* 04h */ virtual bool Init();
16+
/* 08h */ virtual bool Shutdown();
17+
/* 0Ch */ virtual bool func0Ch();
18+
/* 10h */ virtual void func10h(bool);
19+
/* 14h */ virtual void Update();
20+
/* 18h */ virtual void Clear();
21+
/* 1Ch */ virtual int GetStyle();
22+
/* 20h */ virtual void SetStyle(int style);
23+
/* 24h */ virtual int GetOptions();
24+
/* 28h */ virtual void SetOptions(int options);
25+
/* 2Ch */ virtual const char16_t* GetCaption();
26+
/* 30h */ virtual void SetCaption(const char16_t* caption);
27+
/* 34h */ virtual void GetPosition(int& x, int& y);
28+
/* 38h */ virtual void SetPosition(int x, int y);
29+
/* 3Ch */ virtual void GetClientArea(tagRECT& dstRect);
30+
/* 40h */ virtual void SetClientArea(struct tagRECT rect);
31+
/* 44h */ virtual bool IsActive();
32+
/* 48h */ virtual void SetActive(bool active);
33+
/* 4Ch */ virtual bool IsVisible();
34+
/* 50h */ virtual void SetVisible(bool visible);
35+
/* 54h */ virtual bool IsFullscreen();
36+
/* 58h */ virtual void SetFullscreen(bool fullscreen, int width, int height);
37+
/* 5Ch */ virtual bool IsMinimized();
38+
/* 60h */ virtual bool IsMaximized();
39+
/* 64h */ virtual IMessageManager* GetMessageServer();
40+
/* 68h */ virtual void SetMessageServer(IMessageManager*);
41+
/* 6Ch */ virtual void func6Ch(int);
42+
/* 70h */ virtual void func70h(int, int);
43+
/* 74h */ virtual bool HasSystemCursor();
44+
/* 78h */ virtual void SetSystemCursorVisible(bool visible);
45+
/* 7Ch */ virtual void func7Ch(int, int);
46+
/* 80h */ virtual void func80h(int);
47+
/// Called every frame by cAppSystem::Run()
48+
/* 84h */ virtual bool Tick();
49+
/* 88h */ virtual int func88h();
50+
/* 8Ch */ virtual void func8Ch(int);
51+
/* 90h */ virtual int func90h();
52+
/* 94h */ virtual HWND GetWindow();
53+
/* 98h */ virtual ATOM GetCanvasClass();
54+
/* 9Ch */ virtual HMONITOR GetMonitor();
55+
56+
public:
57+
/* 04h */ int field_4; // 0xF
58+
/* 08h */ int mOptions; // 0x2A
59+
/* 0Ch */ bool mIsFullscreen;
60+
/* 0Dh */ bool field_D;
61+
/* 0Eh */ bool field_E;
62+
/* 0Fh */ bool field_F;
63+
/* 10h */ bool field_10;
64+
/* 11h */ bool field_11;
65+
/* 14h */ int field_14;
66+
/* 18h */ int field_18;
67+
/* 1Ch */ bool field_1C;
68+
/* 20h */ int field_20;
69+
/* 24h */ eastl::string16 mCaption;
70+
/* 34h */ int field_34;
71+
/* 38h */ int field_38;
72+
/* 3Ch */ tagRECT field_3C;
73+
/* 4Ch */ bool field_4C; // true
74+
/* 4Dh */ bool field_4D;
75+
/* 4Eh */ bool field_4E;
76+
/* 4Fh */ bool field_4F;
77+
/* 50h */ int field_50; // 2000
78+
/* 54h */ HKL mKeyboardLayout;
79+
/* 58h */ int mDefaultAnsiCodeForLocale;
80+
/* 5Ch */ IMessageManager* mpMessageServer;
81+
/* 60h */ int field_60;
82+
/* 64h */ int field_64;
83+
/* 68h */ int field_68;
84+
/* 6Ch */ bool field_6C;
85+
/* 6Dh */ bool field_6D;
86+
/* 6Eh */ bool field_6E;
87+
/* 70h */ ATOM mCanvasClass;
88+
/* 74h */ HWND mWindow;
89+
/* 78h */ int field_78;
90+
/* 7Ch */ HCURSOR mCursor;
91+
/* 80h */ HBRUSH mBrush;
92+
/* 84h */ int field_84; // 0xC80000
93+
/* 88h */ int field_88;
94+
/* 8Ch */ int field_8C;
95+
/* 90h */ int field_90;
96+
/* 94h */ int field_94;
97+
};
98+
ASSERT_SIZE(Canvas, 0x98);
99+
100+
namespace Addresses(Canvas)
101+
{
102+
DeclareAddress(Get); // 0x67DE10 0x67DCB0
103+
DeclareAddress(Init); // 0x84A3F0 0x849BF0
104+
DeclareAddress(Shutdown); // 0x848900 0x848100
105+
DeclareAddress(func0Ch); // 0xA134D0 0xA13540
106+
DeclareAddress(func10h); // 0x848240 0x847A40
107+
DeclareAddress(Update); // 0x848290 0x847A90
108+
DeclareAddress(Clear); // 0x8482C0 0x847AC0
109+
DeclareAddress(GetStyle); // 0x985FB0 0xFCC1D0
110+
DeclareAddress(SetStyle); // 0x84A600 0x849E00
111+
DeclareAddress(GetOptions); // 0x923C40 0x93B630
112+
DeclareAddress(SetOptions); // 0x848310 0x847B10
113+
DeclareAddress(GetCaption); // 0x804E30 0xFF3480
114+
DeclareAddress(SetCaption); // 0x84A710 0x849ED0
115+
DeclareAddress(GetPosition); // 0x8489E0 0x8481E0
116+
DeclareAddress(SetPosition); // 0x848A00 0x848200
117+
DeclareAddress(GetClientArea); // 0x848A70 0x848270
118+
DeclareAddress(SetClientArea); // 0x8497B0 0x848FB0
119+
DeclareAddress(IsActive); // 0x848340 0x847B40
120+
DeclareAddress(SetActive); // 0x848360 0x847B60
121+
DeclareAddress(IsVisible); // 0x848380 0x847B80
122+
DeclareAddress(SetVisible); // 0x8483A0 0x847BA0
123+
DeclareAddress(IsFullscreen); // 0x69D4C0 0xAB2FF0
124+
DeclareAddress(SetFullscreen); // 0x8498C0 0x8490C0
125+
DeclareAddress(IsMinimized); // 0x8483C0 0x847BC0
126+
DeclareAddress(IsMaximized); // 0x8483E0 0x847BE0
127+
DeclareAddress(GetMessageServer); // 0xA36470 0xC871D0
128+
DeclareAddress(SetMessageServer); // 0xA168B0 0xA169B0
129+
DeclareAddress(func6Ch); // 0x8487A0 0xB18CB0
130+
DeclareAddress(func70h); // 0x8487B0 0x847FA0
131+
DeclareAddress(HasSystemCursor); // 0xA37650 0xB1FB30
132+
DeclareAddress(SetSystemCursorVisible); // 0x8487D0 0x847FC0
133+
DeclareAddress(func7Ch); // 0x8487F0 0x847FF0
134+
DeclareAddress(func80h); // 0x848820 0x848020
135+
DeclareAddress(Tick); // 0x848AF0 0x8482F0
136+
DeclareAddress(func88h); // 0x84A890 0x84A050
137+
DeclareAddress(func8Ch); // 0x848400 0x847C00
138+
DeclareAddress(func90h); // 0x95FE80 0x1030E20
139+
DeclareAddress(GetWindow); // 0xF681A0 0xF67D40
140+
DeclareAddress(GetCanvasClass); // 0x848410 0x847C10
141+
DeclareAddress(GetMonitor); // 0x848420 0x847C20
142+
}
143+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#pragma once
2+
3+
#include <Spore\Internal.h>
4+
#include <EASTL\vector.h>
5+
#include <EASTL\string.h>
6+
7+
namespace App
8+
{
9+
class CommandLine
10+
{
11+
public:
12+
virtual ~CommandLine();
13+
14+
eastl::string16& Get(int index);
15+
16+
int FindSwitch(const char16_t* name, bool caseSensitive = false, eastl::string16* dst = nullptr, int firstIndex = 0);
17+
18+
/// All the separated arguments of the command line, including the program name
19+
/* 04h */ eastl::vector<eastl::string16> mSplits;
20+
/* 18h */ eastl::string16 field_18;
21+
/* 28h */ eastl::string16 field_28;
22+
};
23+
ASSERT_SIZE(CommandLine, 0x38);
24+
25+
namespace Addresses(CommandLine)
26+
{
27+
DeclareAddress(FindSwitch); // 0x92B6C0 0x92B570
28+
DeclareAddress(Get); // 0x92B570 0x92B420
29+
}
30+
31+
/// Returns the command line that was used to execute this app.
32+
/// Only available after the start of cAppSystem::PreInit().
33+
/// @returns
34+
CommandLine* GetAppCommandLine();
35+
}
36+
37+
namespace Addresses(App)
38+
{
39+
DeclareAddress(sAppCommandLine); // 0x1601BA8 0x15FD920
40+
}

0 commit comments

Comments
 (0)