Albeoris / Memoria

Final Fantasy IX tools
MIT License
393 stars 50 forks source link

a bit of data from Memoria #935

Open ftaru17 opened 1 month ago

ftaru17 commented 1 month ago

is there a way at the dummy level (or a couple of steps higher) to get various data of game objects Memoria from a third-party application in c#?

or maybe there is a way to write a mod that will publish the object data (at least FF9StateSystem) (or at least the address in memory where the object itself is located, I can read the memory of a third-party process), say to a file?

my goal in short: I am writing an application (for myself, actually) that reads the memory of PC versions of various games in the Final Fantasy series and displays various in-game data on the screen (for example, FFX - the number of monsters caught - so as not to run to the arena every time, the number of attr*4 nodes on the sphere grid, the number of lightning strikes, etc.). link in general, I read and slowly recognize data in the process memory - having fun, so to speak -) but... FF9 is not a port from PS, but a game rewritten in unity and the data in memory is not sequential arrays of numbers and ansi-strings, but managed objects... but this is half the trouble, it was also discovered that unity places objects at different offsets at each launch. so, I'm completely stumped-)))

I discovered that Cheat Engine can explore the internal structure of objects in unity applications and finds references to objects in the process memory. plus, it has open source code. but injecting your dll into someone else's process is still overskill-))

ftaru17 commented 1 month ago

as far as I understand, no one is going to answer such "stupid" questions-) ok, let's approach it from another angle: can someone show the source code of some mod, so that at least I can understand the general structure - sorry, I don't understand the documentation-)

Tirlititi commented 1 month ago

I have tried to think of some ways to do something ressembling that, but I don't find any. The main problem is that we mod the game's files and code, not the RAM. We don't care of the RAM's structure (at least concerning the level at which you or CheatEngine operate).

The only ways I can think of that would help you, they all revolve around installing the dev's version of Memoria on your machine so you can generate these outputs (either for a direct use or to pass it to your own application).

If you do that, you can add lines like these somewhere in the code, like at the end of HonoluluFieldMain.HonoUpdate:

String output = $"== Field log at the frame {Time.frameCount} ==\n";
output += $"Steal no: {FF9StateSystem.Common.FF9.steal_no}\n";
output += $"Escape no: {FF9StateSystem.Common.FF9.party.escape_no}\n";
output += $"Battle no: {FF9StateSystem.Common.FF9.party.battle_no}\n";
// Must change the attribute of these fields from "private" to "public" to log them
output += $"Encounter Timer: {PersistenSingleton<EventEngine>.Instance._encountTimer}\n";
output += $"Encounter Base: {PersistenSingleton<EventEngine>.Instance._encountBase}\n";
// Etc...
System.IO.File.WriteAllText("MyRegularlyUpdatedLog.txt", output);

But if you want to do that kind of things by relying only on an external RAM data peeking, I'm afraid Memoria doesn't help any more than CheatEngine.