diff --git a/libmupen64plus/mupen64plus-video-jabo/main.cpp b/libmupen64plus/mupen64plus-video-jabo/main.cpp index bb0bd5bbea..f126c7224e 100644 --- a/libmupen64plus/mupen64plus-video-jabo/main.cpp +++ b/libmupen64plus/mupen64plus-video-jabo/main.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #define M64P_PLUGIN_PROTOTYPES 1 #include "m64p_types.h" @@ -170,6 +171,30 @@ BOOL writeOptionsInitflags(DWORD options_val, DWORD initflags_val) return(TRUE); } +void createRDBFile(unsigned char * header, int resolution_width, int resolution_height, int clear_mode) +{ + std::ofstream rdbFile; + rdbFile.open("Project64.rdb", std::ios::trunc | std::ios::out); + + // File can't seem to have data on the first line. It has to be a comment or blank + rdbFile << "\n"; + + rdbFile << "["; + + rdbFile << std::hex << std::setfill('0') << std::setw(2) << std::uppercase; + rdbFile << (int)header[16] << (int)header[17] << (int)header[18] << (int)header[19]; + rdbFile << "-"; + rdbFile << (int)header[20] << (int)header[21] << (int)header[22] << (int)header[23]; + rdbFile << "-C:"; + rdbFile << (int)header[62] << "]\n"; + + rdbFile << std::dec << std::nouppercase; + rdbFile << "Clear Frame=" << clear_mode << "\n"; + rdbFile << "Resolution Width=" << resolution_width << "\n"; + rdbFile << "Resolution Height=" << resolution_height << "\n"; + rdbFile.close(); +} + /* Global functions */ static void DebugMessage(int level, const char *message, ...) { @@ -270,6 +295,8 @@ EXPORT int CALL RomOpen(void) LOG("API WRAPPER:\t RomOpen") OldAPI::RomOpen(); + remove("Project64.rdb"); + if (!l_PluginInit) return 0; @@ -384,6 +411,8 @@ EXPORT int CALL InitiateGFX(GFX_INFO Gfx_Info) writeOptionsInitflags(new_options_val,new_initflags_val); + createRDBFile(Gfx_Info.HEADER, settings.resolution_height, settings.resolution_width, settings.clear_mode); + OldAPI::GFX_INFO blah; blah.hWnd = hWnd_jabo;