Giter Club home page Giter Club logo

spore-modapi's Introduction

Spore ModAPI SDK

This GitHub page hosts the Spore ModAPI development kit, used to create Spore mods with C++. To use those mods, you need the ModAPI Launcher and Installers.

The Spore ModAPI SDK allows you to create C++ mods for Spore. These mods are compiled into .dll files, that can then be used by the ModAPI Launcher Kit to inject them into Spore.

The documentation of the SDK is available here: https://emd4600.github.io/Spore-ModAPI/

Instructions about download, installation and updating can be found in this tutorial.

The source code can be found in this GitHub repository. If you want to see the SDK in action, check the list of open source mods. This project also includes the source code of some example mods made with the ModAPI SDK:

To compile the core DLLs (unless you want to develop the SDK itself, you don't need to do this):

  1. Open the Visual Studio Command Prompt
  2. Navigate to the SDK root directory.
  3. Execute msbuild "Spore ModAPI" -t:BuildDlls -p:BuildVer=177 -p:Config=Release (changing the version and config accordingly)

Working with Ghidra

If you want to extend the SDK, or just want to investigate Spore's source code, you can use the free program Ghidra to do so. The SDK includes a plugin and some files, that can be used to add all the known data from the SDK into Ghidra. These are prepared to work with Ghidra's function decompiler, making reverse engineering much easier:

To use them:

  1. Open your project in Ghidra.
  2. If you hadn't done it yet, analyze the executable (this finds all functions).
  3. Open Windows > Script Manager.
  4. On the top bar of the new window, click on the Manage Script Directories
  5. On the popup window, click on the + button and search the Spore ModAPI SDK/SDKtoGhidra/GhidraScript folder in your SDK installation.
  6. Close that popup and go back to the script manager, find the ImportSporeSDK.java script (it's in the Data category).
  7. Execute it: it will ask for a file, select the Spore ModAPI SDK/SDKtoGhidra/SporeGhidra_march2017.xml (or SporeGhidra_disk.xml if you use a disk Spore installation).
  8. Wait for it to complete; in the console, you can see all the functions and data types that have been added.

Keep in mind that Ghidra's decompiler is only an approximation, and it will not produce code that is directly executable on the SDK. There are several differences to keep in mind, among others:

  • Ghidra data types have no inheritance, so the decompiler isn't aware of superclass/subclass relationships.
  • Ghidra does not understand virtual functions. When calling a virtual function, Ghidra first grabs the function pointer from the virtual function table, and then executes it.
  • Ghidra does not understand intrusive_ptrs, which means the code it generates makes calls to AddRef() and Release() (which you never see in the SDK).

Generating Ghidra files (only for SDK maintainers)

If you are extending the SDK and need to update the Ghidra files, you need to install Python 3.9 (at least) and the library libclang, then run extract.py.

spore-modapi's People

Contributors

0keponline avatar emd4600 avatar kade-n avatar plencka avatar rosalie241 avatar tenderi4 avatar vanillacold avatar zarklord avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spore-modapi's Issues

[Request] Define addresses for IAnimWorld and AnimatedCreature classes.

As it currently stands, the only addresses so far defined for these two classes (or at least for those related to it in the same namespace) are for the Get() function in the IAnimManager class. For animation and other creature-related detours, it would be nice to have reference to those addresses when making mods related to animations among other things.

[Request] Get adventure's Spore points

My request is simple. Find a method that returns an active adventure's Spore point amount, and a method that tallies them and adds them to the player captain's Spore points.

Spore GOG v.5.0.2

Loking for help with the spore ModApi Launcher, i have been installing mods and until now it was working, but now it says i have a Steam version, which is not true, it was working perfectly. Can anybody help???

[Request] Find creature's target

I'm trying to implement custom abilities through animation messages, but I can't find the target of the creature that triggers the message. For some reason, cCombatant::GetTarget() doesn't work for creatures.

[Request] CombatManager class

AFAIK, the CombatManager is what handles combat, and it'd be pretty useful for custom space tools. (and also custom creature abilities, though that requires a bunch of loopholes to get working)

Unable to compile code accessing players space stage inventory

This line, taken straight from the tutorial pages:

auto inventory = SimulatorSpaceGame.GetPlayerInventory();

Causes a linker error:
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "__declspec(dllimport) unsigned int const Simulator::cSimPlanetHighLOD_addresses::DestroyCity" (__imp_?DestroyCity@cSimPlanetHighLOD_addresses@Simulator@@3IB) referenced in function "public: void __thiscall Simulator::cSimPlanetHighLOD::DestroyCity(class Simulator::cCity *,unsigned int)" (?DestroyCity@cSimPlanetHighLOD@Simulator@@QAEXPAVcCity@2@I@Z) SpaceToolCheat C:\PaccasStuff\SporeCMods\Projects\SpaceToolCheat\SpaceToolCheat\SpaceToolCheat\SporeModAPIBase.lib(SimulatorSpaceGame.obj) 1

This line is the sole cause. Commenting it out fixes the issue, placing it in a blank mod brings it back. Mod compiles just fine without this one line.

[Bug] Space Tool Overrider Icon Social Palette Precedence

It seems Social Inventory loads icons faster than Overrider injects windows into the UI.
It's possible it's executed during UI::SpaceGameUI::Load(), so injecting after that function is called results in that behavior.

One solution might be injecting icons directly after SPUI with these icons gets loaded.

Auto updater & Lightweight installers

So there's a few things I think would be nice for the .sporemod format in general, one being the ability to auto update mods (or at the least a notification that your mods are out of date), the other is lightweight installers, aka allow mods that are in parts to download only the parts they need when installing (so that dark injection doesn't have to be a 1.1 gb download every time you want to update it even if you only use less then half of it)

Unsupported game version.

spore crash mod

I've done the tutorial step by step and i did not work.
It gave me this error. It is (Gog). I tried to update it with the tutorial but is says that i need to have the spore installed to update it which i have. :(

[Request] Add function with memory address 0xa138b0 (disc) / 0xa3b50 (March 2017) and related functions to the SDK

Said function(s) interacts with 0x40C0C100!base.soundProp and together seem to be factoring in what kind of voice a creature has depending on their mouth/model type (and based on conditions within the function itself).

For tribal creatures and NPCs in the adventure editor, their voice is determined by a string key mouthType that can be found as a value in their mouth parts.

For civilization, space creatures and captains, their voice is determined by default through the property 0x0B65639D, which while looking through the function in disassembly seemed to be fixed. By default, the property 0x0B65639D has the string value "MamA", which corresponds to the mammal sentient creature voice.

EDIT: As an added detail, the function is called whenever a creature needs to load a voice file, so it is possibly related to the Audio namespace and the AudioSystem class.

[Request] Core DLL Integration - Custom Space Tool Images for mods.

I made a mod awhile ago which enables custom icons for space stage:
https://github.com/plencka/Spore-ToolImageEnforcer

By default, game handles them like this:

  • On Space Stage entry, load 0x46fed9c8.spui with all icons and hide it. Each window has controlID, used in spaceToolImageID space tool property, it corresponds to image .png name.
  • When tool is shown in inventory, find window from above cache using spaceToolImageID as controlID. Use default window if not found.
  • ??? copy the window, copy properties of window?

What this mod does:

  • Loads hashes of all new .png files within ufotools~ folder and stores them in new manager. Ignores images that are in the base game to not make duplicates.
  • When Space Game Starts, create new window that stores custom icons in similar way to 0x46fed9c8.spui. It creates everything in dynamic way, so no .spui is used.
  • Whenever game attempts to find window id from window of 0x46fed9c8.spui, use custom window instead. When no window is found, it executes original function behavior.

The mod developer only has to add .png file and use that image in space tool. It also works in older mods which attempted to add new icons.

I'd like this mod to be integrated into Core ModAPI DLLs, because a lot of people don't install dependencies and then are surprised that the mod doesn't work.

What could be done to improve it:
Maybe detect when 0x46fed9c8.spui gets loaded, and load all custom windows directly into it? This way you don't have to have detours of functions FindWindowByID and SetActiveModeByName. And window destruction is also handled by base game.
I tried doing that with UILayout::Load, but I was told to.. not do this. Maybe it was lack of context and this might be the correct solution?
I'll make Pull Request with these changes in my mod repository and if you think it's better solution, inform me.

[Request] Full support for part rigblocks

Various different variables seem to be missing from Spore\Editors\EditorRigblock.h, including the variable for a part's current parent.

I'm currently trying to stop parts that aren't the spine from becoming parentless, but I can't because the variable is missing.

Version of Spore

Sorry if i disapointed you but my version of Spore didn't work

If you can fix this bug please, i will be graceful

Have a nice day.

[Request] Add support for modifying SPUI behavior through the SDK.

Many of the SPUIs in-game can be easily modified through props and other files in SporeModder FX, however some of the SPUIs functions seem to be hard-coded. The best example for this would be the file named SPGMissionCard.spui, for which strings and look can be easily modifed, but ex. modifying how many instances of this SPUI can appear on the screen is impossible at the moment. Also, the same .spui is used for tracking space stage badges, but functionality for those seems to be completely hard-coded.
In image below I simply swapped the textures to confirm the same .spui is used for both missions and badges, but that's as far as I could go in SporeModderFX besides moving pieces around and what-not.
image_2021-05-29_194903

SporeLauncher not supported on GOG spore?

Hello.

I happen to have the GOG version of Spore. I have recently installed the new update and it told me that the Spore version is not supported with SporeLauncher anymore.

Linking error

unresolved external symbol "__declspec(dllimport) unsigned int const Clock_addresses::Pause" (__imp_?Pause@Clock_addresses@@3IB)  

Contacting the developer. About the work of ModAPI Launcher without the Internet and the inability to start the game. Spore with ModAPI Launcher without an Internet connection.

I appeal to you as a competent person who is well versed with the mods and the technical part of the Spore game, could you make it so that the ModAPI Launcher no longer requires an Internet connection to run the game with it, so that it works offline mode?

Many creators with mods in Spore from various countries are interested in this issue, who could at least try to figure it out.

It just turns out such a problem that without the Internet, the game with ModAPI requires a connection to read the mods and does not start, and you can only start it through the emergency mod testing mode in Sporemodder FX.

And even then, half of the mods that work with ModAPI will stop being read and work, and creations will be distorted to the level of those that could be created with mods that can work without ModAPI - for example, parts of Pandora Toolbox and of Drone Parts, enlarged with UPE, and distort creations, are compressed and creatures made with Drone parts turn into a bunch of cubes scattered across fantastic planes

This is corrected by reupload PNG, if you go into a regular game with ModAPI, but if you upload it to a game launched in this way bypassing ModAPI, then again the creations are displayed as distorted

And when the Internet comes off for technical reasons or there is no way to use it, I want to be able to continue playing Spore as with mods that did not require ModAPI, which asks for an Internet connection to start the game.

This is a very serious shortcoming of the ModAPI launcher and the .sporemod system files, because before it was just a .package that I threw into a folder and it will always work

Went offline - The whole game will be impossible to start.

So, I don't want to launch everything in an emergency way through testing mods in Sporemodder FX, and then align and redo all the creations distorted by the fact that UPE stopped working.

I still hope that in the next versions of ModAPI they will wean off the Internet connection to run the game (not to update the client, the Internet is required to update the client)

Best regards, JimReinor, one of the mod creators from the Russian language mod creator site Spore.cr

Cannot Re-open Spore after running ModAPI Launcher

Apparently, When I open Spore at all via the ModAPI Launcher and then close it, it always says this, even after time has passed and Spore has fully closed:
image
The only remedy so far is to restart my computer.

[Bug] Custom space tools crashing on hit

I've been messing with space tools in the SDK recently and have noticed a few issues.

  1. Overriding the OnHit() function always leads to a game crash when the projectile hits something.
  2. Inheriting cPlaceColonyToolStrategy leads to Spore crashing when the projectile hits the planet.

[Request] T0 Colonies + Archetype Superweapons

I need to detour both the function for the hardcoded Mini-U and the function that destroys colonies when there are too many on a planet to be sustainable for a mod, but I don't think either are in the Spore ModAPI Development Kit yet.

[Request] Function to kill creature

When a creature's health reaches 0, it doesn't properly die - it triggers the death animation and stops moving, but hovering over it with the mouse still shows its name and Spore doesn't class it as "dead" - it doesn't contribute to the Kill goal in adventures.

[Request] More ability to modify ``Clock`` class objects

Currently the Clock class in the SDK doesn't seem to be able to support adding or removing time from its instances, since the related members (mStartTime and mAccumulatedTime) are protected and thus only modifiable by the class methods themselves. Either making them public or adding methods to add/reduce time would be ideal.

[Request] Tribal Stage functions

I'm working on a hut editor mod for Spore and there just doesn't seem to be a way to change the player's hut.

It's done already by Spore whenever your hut levels up, but it always switches to specific models in the editor_rigblocks~ folder and there doesn't seem to be a way to do this manually yet with mods.

[Request] More space stage functions

  • The ability to give the player a mission.
  • A way of finding a planet through the Sporepedia in the Space Stage.
  • Some kind of method of switching the empire which owns a system, like the Fanatical Frenzy tool.
  • A function to load inventory items such as creatures and spice, to add them to the player's space inventory. (like when collecting space items)
  • a function to spawn tool projectiles

[Request] Function to stun creature

Creatures get stunned after they get hit by the Charge ability - and if I recall correctly, they use animation ID 0x02481E14 (in 0x142CBA20.tlsa).
Simply just playing this animation doesn't stun the creature, there must be something else needed as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.