vitor251093 / KHMelonMix

Kingdom Hearts 358/2 Days - Melon Mix (DS Emulator)
GNU General Public License v3.0
223 stars 11 forks source link

Integration with the 1.5+2.5 collection #135

Open vitor251093 opened 4 months ago

vitor251093 commented 4 months ago

If the Melon Mix app could replace "KINGDOM HEARTS Theater.exe", we could launch both Days and ReCoded from the collection launcher.

vitor251093 commented 3 months ago

We need someone with the collection to retrieve the flags sent to "KINGDOM HEARTS Theater.exe", by replacing it with the following code compiled as an EXE:

#include <iostream>
#include <fstream>

int main(int argc, char *argv[]) {
    // Hardcoded output file name
    const char* outputFileName = "output.txt";

    // Open the output file
    std::ofstream outFile(outputFileName);
    if (!outFile.is_open()) {
        std::cerr << "Error opening file " << outputFileName << std::endl;
        return 1;
    }

    // Write arguments to the file
    for (int i = 1; i < argc; ++i) {
        outFile << argv[i] << std::endl;
    }

    // Close the file
    outFile.close();

    return 0;
}
amconners commented 3 months ago

I have 1.5+2.5 installed (via EGS, if that matters) and I went ahead and compiled that program from your most recent comment. It gives no output in the text file when opening either the Days or Re:coded cutscene movies. Just to be on the safe side, I let the first cutscene of each movie play out for a few seconds. Still nothing.

Looked around at running processes and noticed that in both cases, KINGDOM HEARTS HD 1.5+2.5 Launcher.exe was still open and KINGDOM HEARTS Theater.exe was nowhere to be seen. Seems like the launcher itself has video playback functionality, and that's what's used for Days and Re:Coded

That brings up the question of what the Theater EXE is actually used for. But then I remembered KH1's Theater Mode was added in a free update after the collection had been released. And if I start 1FM and pick Theater Mode from the main menu then, yes, I finally get a full readout of the launch parameters. I don't know which parameters are which, what is and isn't safe to give out (some look like they could be related to EGS login data or at least account data) and I also don't know if any of the parameters are still even the slightest bit interesting or relevant to this project now that we know the HD Movies aren't starting an external EXE at all

vitor251093 commented 3 months ago

Oh, crap. Well, yeah, your assumptions are correct. The arguments are irrelevant if the Theater isn't used to play Days/ReCoded.

We would need to modify the launcher instead, which is way more complicated.

vitor251093 commented 3 months ago

Thanks to Willow from the OpenKH Discord, we figured out that the launcher is built using .NET C# Windows Forms, which can be decompiled using ILSpy.

If we can produce a functional build after decompiling it, then we may be able to produce a patch for the launcher that changes the functionality of both Days and ReCoded menu entries.