This commit is contained in:
TheBrokenRail 2024-07-16 13:46:20 -04:00
parent 46c486e56a
commit 6f792dfb16
4 changed files with 8 additions and 8 deletions

View File

@ -3,9 +3,9 @@
// Thunks
template <typename Ret, typename... Args>
struct __Thunk<Ret(Args...)> {
template <__Function<Ret(Args...)> *func>
template <__Function<Ret(Args...)> *const *func>
static Ret call(Args... args) {
return func->get_thunk_target()(std::forward<Args>(args)...);
return (*func)->get_thunk_target()(std::forward<Args>(args)...);
}
};

View File

@ -27,8 +27,7 @@ class __VirtualFunctionInfo {
}
T *const addr;
void *const parent;
template <typename U>
friend class __Function;
friend class __Function<std::remove_pointer_t<T>>;
};
// Thunks
@ -171,6 +170,7 @@ T *dup_vtable(T *vtable) {
new_vtable += RTTI_SIZE;
return (T *) new_vtable;
}
#undef RTTI_SIZE
// Forward Declarations
{{ forwardDeclarations }}

View File

@ -31,7 +31,7 @@ export class Method {
return `${INDENT}${this.getWrapperType()}::ptr_type ${this.shortName};\n`;
}
getWrapperType() {
return `decltype(${this.getName()})`;
return `std::remove_pointer_t<decltype(${this.getName()})>`;
}
// Overwrite Helper
@ -45,9 +45,9 @@ export class Method {
}
const signature = this.returnType.trim() + this.args.trim();
const type = `${INTERNAL}Function<${signature}>`;
out += `${type} ${this.getName()}`;
out += `${type} *const ${this.getName()}`;
if (code) {
out += `(${JSON.stringify(this.getName('::'))}, `;
out += ` = new ${type}(${JSON.stringify(this.getName('::'))}, `;
if (isVirtual) {
const parentMethod = parentSelf ? `(void *) ${this.#getVirtualCall(parentSelf)}` : 'nullptr';
out += `&${this.#getVirtualCall()}, ${parentMethod}`;

View File

@ -144,7 +144,7 @@ export class Struct {
if (isVirtual) {
call += `this->vtable->${method.shortName}`;
} else {
call += `${method.getName()}.get()`;
call += `${method.getName()}->get()`;
}
call += '(';
if (!method.isStatic) {