Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Commit

Permalink
Comply with the new CafeLoader version
Browse files Browse the repository at this point in the history
  • Loading branch information
aboood40091 committed Feb 20, 2020
1 parent bac9242 commit a0eff5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@ files/project.ld
files/project.gpj
files/Out/*
OutProj/*
*.elf
*.rpx
*.ti
2 changes: 1 addition & 1 deletion files/include/logger.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#ifndef Cemu
#define log_printf(FMT, ARGS...) ((void (*)(const char *format, ...))(*(unsigned int *)(DATA_ADDR + 0x20000)))(FMT, ## ARGS);
#define log_printf(FMT, ARGS...) ((void (*)(const char *format, ...))(*(unsigned int *)(DATA_ADDR - 4)))(FMT, ## ARGS);
#else
#define log_printf(x, ...)
#endif
20 changes: 9 additions & 11 deletions files/src/ctors.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
typedef void (*InitFunc)();
extern InitFunc _ctors[];

extern "C" {
void callCtors() {
unsigned int *ctors;

#ifdef Cemu
ctors = (unsigned int *)(*(unsigned int *)(DATA_ADDR - 4));
#else
ctors = (unsigned int *)(DATA_ADDR + 0x20004);
#endif
static bool initialized = false;
if (initialized)
return;

unsigned int count = ctors[0];
for (int i = 0; i < count; i++) {
((void (*)())(ctors[i + 1]))();
}
initialized = true;
for (int i = 0; _ctors[i]; i++)
(*_ctors[i])();
}
}

0 comments on commit a0eff5e

Please sign in to comment.