mirror of
https://git.suyu.dev/suyu/Yucom.git
synced 2025-12-24 00:04:34 +01:00
vrclient: Generate call_flat_method() functions.
In order to remove hardcoded limit for parameter count in C API functions.
This commit is contained in:
parent
23ffdc5ec8
commit
d687b83fcb
4 changed files with 220 additions and 66 deletions
139
vrclient_x64/flatapi.c
Normal file
139
vrclient_x64/flatapi.c
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/* This file is auto-generated, do not edit. */
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
||||
#include "cxx.h"
|
||||
#include "flatapi.h"
|
||||
|
||||
#ifdef __i386__
|
||||
__ASM_GLOBAL_FUNC(call_flat_method,
|
||||
"popl %eax\n\t"
|
||||
"pushl %ecx\n\t"
|
||||
"pushl %eax\n\t"
|
||||
"jmp *%edx");
|
||||
#else
|
||||
// handles "this" and up to 3 parameters
|
||||
__ASM_GLOBAL_FUNC(call_flat_method,
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"jmp *%r11");
|
||||
extern void call_flat_method(void);
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method4,
|
||||
"subq $0x28, %rsp\n\t"
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x28, %rsp\n\t"
|
||||
"ret");
|
||||
extern void call_flat_method4(void);
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method5,
|
||||
"subq $0x38, %rsp\n\t"
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq 0x60(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x28(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x38, %rsp\n\t"
|
||||
"ret");
|
||||
extern void call_flat_method5(void);
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method6,
|
||||
"subq $0x38, %rsp\n\t"
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq 0x60(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x28(%rsp)\n\t"
|
||||
"movq 0x68(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x30(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x38, %rsp\n\t"
|
||||
"ret");
|
||||
extern void call_flat_method6(void);
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method7,
|
||||
"subq $0x48, %rsp\n\t"
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq 0x70(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x28(%rsp)\n\t"
|
||||
"movq 0x78(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x30(%rsp)\n\t"
|
||||
"movq 0x80(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x38(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x48, %rsp\n\t"
|
||||
"ret");
|
||||
extern void call_flat_method7(void);
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method8,
|
||||
"subq $0x48, %rsp\n\t"
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq 0x70(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x28(%rsp)\n\t"
|
||||
"movq 0x78(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x30(%rsp)\n\t"
|
||||
"movq 0x80(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x38(%rsp)\n\t"
|
||||
"movq 0x88(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x40(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x48, %rsp\n\t"
|
||||
"ret");
|
||||
extern void call_flat_method8(void);
|
||||
|
||||
__ASM_GLOBAL_FUNC(call_flat_method9,
|
||||
"subq $0x58, %rsp\n\t"
|
||||
"movq %r9, 0x20(%rsp)\n\t"
|
||||
"movq 0x80(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x28(%rsp)\n\t"
|
||||
"movq 0x88(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x30(%rsp)\n\t"
|
||||
"movq 0x90(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x38(%rsp)\n\t"
|
||||
"movq 0x98(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x40(%rsp)\n\t"
|
||||
"movq 0xa0(%rsp), %rax\n\t" // copy parameter
|
||||
"movq %rax, 0x48(%rsp)\n\t"
|
||||
"movq %r8, %r9\n\t" // shift over arguments
|
||||
"movq %rdx, %r8\n\t"
|
||||
"movq %rcx, %rdx\n\t"
|
||||
"movq %r10, %rcx\n\t" // add This pointer
|
||||
"call *%r11\n\t"
|
||||
"addq $0x58, %rsp\n\t"
|
||||
"ret");
|
||||
extern void call_flat_method9(void);
|
||||
|
||||
pfn_call_flat_method get_call_flat_method_pfn( int param_count )
|
||||
{
|
||||
if (param_count <= 3) return call_flat_method;
|
||||
if (param_count == 4) return call_flat_method4;
|
||||
if (param_count == 5) return call_flat_method5;
|
||||
if (param_count == 6) return call_flat_method6;
|
||||
if (param_count == 7) return call_flat_method7;
|
||||
if (param_count == 8) return call_flat_method8;
|
||||
return call_flat_method9;
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue