Mich hat gerade wer gefragt um eine Idee wie man Messageboxen custom zeichnen könnte.
Ich dachte irgendwie nicht dran, dass diese Person gar kein Plugin-Developer ist, drum brachte es letztenendes nichts. Aber vielleicht bringts ja hier wem was.
Hier ist Code (den ich allerdings nicht getestet habe), mit dem man in der Lage sein sollte, das zu erreichen:
Code:
bool onStartup(char *pluginName) {
// Set up hook
void *trampoline;
asm volatile("movl $_drawMessageBoxTrampoline, %%eax" : "=a" (trampoline));
*reinterpret_cast<void **>(0x4C60DC) = trampoline;
}
// This can be used to trigger the original drawing function
void originalDrawMessageBox(RPG::WindowMessage *box) {
asm volatile("call *%%esi" : : "S" (0x4C8488), "a" (box) : "edx", "ecx", "cc", "memory");
}
// Some more stuff for the hook
void drawMessageBox(RPG::WindowMessage* box);
extern "C" {
void __stdcall drawMessageBoxTrampoline2(RPG::WindowMessage *box) {
drawMessageBox(box);
}
}
asm volatile("_drawMessageBoxTrampoline:; pushl %eax; jmp *$_drawMessageBoxTrampoline2@4");
// Here is your drawing callback!
void drawMessageBox(RPG::WindowMessage* box) {
// Here you can draw the box yourself, based on the information available in the box object!
// Or, to call the original drawing function, use originalDrawMessageBox(box);
}
Braucht PepsiOtakus Version von DynRPG (0.32 oder so): http://www.rewking.com/dynrpg/
RPG::WindowMessage ist hier dokumentiert: http://www.rewking.com/dynrpg/class_...w_message.html