Skip to content

Commit

Permalink
show resource type, tags, database for assetMetadata cheat, other cle…
Browse files Browse the repository at this point in the history
…anup
  • Loading branch information
Kade-N committed Jul 3, 2024
1 parent e3d1acb commit 3f3be63
Show file tree
Hide file tree
Showing 21 changed files with 81 additions and 35 deletions.
46 changes: 45 additions & 1 deletion AssetMetadataCheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,35 @@ void AssetMetadataCheat::PrintMetadata(uint32_t instanceId, uint32_t groupId)
cAssetMetadataPtr metadata;
if (!Pollinator::GetMetadata(instanceId, groupId, metadata)) {
App::ConsolePrintF("Asset metadata not found for %X!%X", groupId, instanceId);

// This was probably some testing code, don't think it's needed but I don't quite remember why this was here
//list<Resource::IResourceFactory*> factories;
//ResourceManager.GetFactoryList(factories);
//for each (auto factory in factories)
//{
// App::ConsolePrintF("%X:", factory->GetFactoryType());

// uint32_t types[10];
// factory->GetSupportedTypes(types, 10);
// string typesString = "";
// for each (auto type in types)
// {
// if (auto typeName = ResourceManager.GetTypenameFromType(type))
// {
// App::ConsolePrintF(" %ls", typeName);
// }
// else
// {
// //App::ConsolePrintF(" %X", type);
// }
// }
//}
}
else {
App::ConsolePrintF("Asset metadata for %X!%X:", groupId, instanceId);
string16 fileName;
ResourceManager.GetNameFromKey(metadata->GetAssetKey(), fileName);

App::ConsolePrintF("Asset metadata for %ls:", fileName);
App::ConsolePrintF("- Name: %ls", metadata->GetName().c_str());
App::ConsolePrintF("- Server ID: %I64d", metadata->GetAssetID());
App::ConsolePrintF("- Author: %ls (%I64d)", metadata->GetAuthor().c_str(), metadata->GetAuthorID());
Expand All @@ -52,5 +78,23 @@ void AssetMetadataCheat::PrintMetadata(uint32_t instanceId, uint32_t groupId)
App::ConsolePrintF("- Created at %I64d, Downloaded at %I64d", metadata->GetTimeCreated(), metadata->GetTimeDownloaded());
App::ConsolePrintF("- Shareable: %s", metadata->IsShareable() ? "true" : "false");
App::ConsolePrintF("- Localized: %s", metadata->IsLocalized() ? "true" : "false");

string16 tagsString = u"";
for each (auto tag in metadata->GetTags())
{
tagsString += tag + u", ";
}
App::ConsolePrintF("- Tags: %ls", tagsString);

string dataString = "";
for each (auto item in metadata->GetAuthors())
{
dataString += item + ", ";
}
App::ConsolePrintF("- Data: %s", dataString);

string16 databasePath = u"unknown";
if (auto database = ResourceManager.FindDatabase(metadata->GetAssetKey())) databasePath = database->GetLocation();
App::ConsolePrintF("- Database: %ls", databasePath);
}
}
2 changes: 1 addition & 1 deletion Creation-Metadata.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Creation-Metadata", "Creati
{F057451A-1413-4D68-AF56-1BF529933420} = {F057451A-1413-4D68-AF56-1BF529933420}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Spore ModAPI", "..\Spore-ModAPI\Spore ModAPI\Spore ModAPI.vcxproj", "{F057451A-1413-4D68-AF56-1BF529933420}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Spore ModAPI", "..\..\Spore-ModAPI\Spore ModAPI\Spore ModAPI.vcxproj", "{F057451A-1413-4D68-AF56-1BF529933420}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion Creation-Metadata.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<IncludePath>$(SporeSdkPath)Spore ModAPI;$(SporeSdkPath)EASTL-3.02.01\test\packages\EABase\include\Common;$(SporeSdkPath)EASTL-3.02.01\test\packages\EAAssert\include;$(SporeSdkPath)EASTL-3.02.01\test\packages\EAStdC\include;$(SporeSdkPath)EASTL-3.02.01\include;$(SporeSdkPath)Detours\include\;$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86;$(SporeLauncherPath)coreLibs;$(SporeSdkPath)Detours\lib.X86;$(SporeSdkPath)lib\Debug;$(LibraryPath)</LibraryPath>
<TargetName>$(ProjectName)</TargetName>
<OutDir>$(SporeLauncherPath)mLibs</OutDir>
<OutDir>$(SporeLauncherPath)mLibs\</OutDir>
<LocalDebuggerCommand>$(SporeLauncherPath)Spore ModAPI Launcher.exe</LocalDebuggerCommand>
<LocalDebuggerWorkingDirectory>$(SporeLauncherPath)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
Expand Down
11 changes: 0 additions & 11 deletions Debug/Creation-Metadata.dll.recipe

This file was deleted.

Binary file removed Debug/Creation-Metadata.ilk
Binary file not shown.
7 changes: 0 additions & 7 deletions Debug/Creation-Metadata.log

This file was deleted.

Binary file removed Debug/Creation.07FC5B61.tlog/CL.command.1.tlog
Binary file not shown.
Binary file removed Debug/Creation.07FC5B61.tlog/CL.read.1.tlog
Binary file not shown.
Binary file removed Debug/Creation.07FC5B61.tlog/CL.write.1.tlog
Binary file not shown.
4 changes: 0 additions & 4 deletions Debug/Creation.07FC5B61.tlog/Cl.items.tlog

This file was deleted.

2 changes: 0 additions & 2 deletions Debug/Creation.07FC5B61.tlog/Creation-Metadata.lastbuildstate

This file was deleted.

Binary file removed Debug/Creation.07FC5B61.tlog/link.command.1.tlog
Binary file not shown.
Binary file removed Debug/Creation.07FC5B61.tlog/link.read.1.tlog
Binary file not shown.
Binary file removed Debug/Creation.07FC5B61.tlog/link.write.1.tlog
Binary file not shown.
Binary file removed Debug/assetmetadatacheat.obj.enc
Binary file not shown.
Binary file removed Debug/vc143.idb
Binary file not shown.
Binary file removed Debug/vc143.pdb
Binary file not shown.
Binary file removed Debug/viewonlinecheat.obj.enc
Binary file not shown.
2 changes: 1 addition & 1 deletion ModInfo.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mod displayName="Creation Metadata" unique="Kade.CreationMetadata" description="View and edit metadata for any creation, and easily open creations on Spore.com (even modded creations!)" installerSystemVersion="1.0.1.2" dllsBuild="2.5.301"><prerequisite>CreationMetadata.dll</prerequisite></mod>
<mod displayName="Creation Metadata" unique="Kade.CreationMetadata" description="View and edit metadata for any creation, and easily open creations on Spore.com (even modded creations!)" installerSystemVersion="1.0.1.2" dllsBuild="2.5.313"><prerequisite>CreationMetadata.dll</prerequisite></mod>
6 changes: 3 additions & 3 deletions ViewOnlineCheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ void ViewOnlineCheat::OpenAssetWebpage(uint32_t instanceId, uint32_t groupId, As
switch (website)
{
case Sporepedia:
url = u"http://www.spore.com/sporepedia#qry=ast-" + assetId + u":sast-" + assetId;
url = u"https://www.spore.com/sporepedia#qry=ast-" + assetId + u":sast-" + assetId;
break;
case Pollinator:
url = u"http://pollinator.spore.com/pollinator/admin/asset/" + assetId;
url = u"https://pollinator.spore.com/pollinator/admin/asset/" + assetId;
break;
case Model:
url = u"http://static.spore.com/static/model/" + splitId + u"/" + assetId + u".xml";
url = u"https://static.spore.com/static/model/" + splitId + u"/" + assetId + u".xml";
break;
case CommunitySporepedia:
url = u"https://sporecommunity.com/assets/" + assetId;
Expand Down
34 changes: 30 additions & 4 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
#include "AssetMetadataCheat.h"
#include "ViewOnlineCheat.h"


static void RegisterCommonResourceTypes()
{
// Creations
ResourceManager.SetTypename(TypeIDs::cll, u"cll");
ResourceManager.SetTypename(TypeIDs::crt, u"crt");
ResourceManager.SetTypename(TypeIDs::vcl, u"vcl");
ResourceManager.SetTypename(TypeIDs::bld, u"bld");
ResourceManager.SetTypename(TypeIDs::ufo, u"ufo");
ResourceManager.SetTypename(TypeIDs::flr, u"flr");
ResourceManager.SetTypename(TypeIDs::cmp, u"cmp");
ResourceManager.SetTypename(TypeIDs::adventure, u"adventure");

// Other associated files
ResourceManager.SetTypename(TypeIDs::pollen_metadata, u"pollen_metadata");
ResourceManager.SetTypename(TypeIDs::png, u"png");
ResourceManager.SetTypename(TypeIDs::bem, u"bem");
ResourceManager.SetTypename(0x02D5C9AF, u"summary");
ResourceManager.SetTypename(id("creaturedata"), u"creaturedata");
}


void Initialize()
{
// This method is executed when the game starts, before the user interface is shown
Expand All @@ -12,6 +34,10 @@ void Initialize()
// - Add new game modes
// - Add new space tools
// - Change materials

// Add common types to resource manager
RegisterCommonResourceTypes();

CheatManager.AddCheat("assetMetadata", new AssetMetadataCheat());
CheatManager.AddCheat("viewOnline", new ViewOnlineCheat());
}
Expand All @@ -29,10 +55,10 @@ void AttachDetours()


// Generally, you don't need to touch any code here
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
Expand Down

0 comments on commit 3f3be63

Please sign in to comment.