forked from PretendoNetwork/Inkay
chore: Introduce common directory to deduplicate shared code
This commit is contained in:
parent
68bc066c7b
commit
ea71879bb1
22 changed files with 110 additions and 278 deletions
|
|
@ -15,30 +15,13 @@
|
|||
#include <coreinit/dynload.h>
|
||||
#include "game_peertopeer.h"
|
||||
|
||||
#include "utils/sysconfig.h"
|
||||
#include "sysconfig.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/rpl_info.h"
|
||||
#include "utils/replace_mem.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
static inline int digit(char a) {
|
||||
if (a < '0' || a > '9') return 0;
|
||||
return a - '0';
|
||||
}
|
||||
|
||||
unsigned short peertopeer_port() {
|
||||
const char * serial = get_console_serial();
|
||||
|
||||
unsigned short port = 50000 +
|
||||
(digit(serial[4]) * 1000) +
|
||||
(digit(serial[5]) * 100 ) +
|
||||
(digit(serial[6]) * 10 ) +
|
||||
(digit(serial[7]) * 1 );
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
static void minecraft_peertopeer_patch() {
|
||||
std::optional<OSDynLoad_NotifyData> minecraft = search_for_rpl("Minecraft.Client.rpx");
|
||||
if (!minecraft) {
|
||||
|
|
@ -46,7 +29,7 @@ static void minecraft_peertopeer_patch() {
|
|||
return;
|
||||
}
|
||||
|
||||
auto port = peertopeer_port();
|
||||
auto port = get_console_peertopeer_port();
|
||||
DEBUG_FUNCTION_LINE_VERBOSE("Will use port %d. %08x", port, minecraft->textAddr);
|
||||
|
||||
uint32_t *target_func = rpl_addr(*minecraft, 0x03579530);
|
||||
|
|
|
|||
Loading…
Reference in a new issue