1
0
mirror of https://github.com/pumpitupdev/pumptools.git synced 2024-11-27 16:10:55 +01:00

Fix HD mode on Prime 1

This commit is contained in:
Luciano Ciccariello 2024-03-04 20:41:38 +00:00 committed by voidderef
parent 6eb1307cce
commit b809d86749
4 changed files with 49 additions and 0 deletions

View File

@ -26,6 +26,7 @@ set(SOURCE_FILES
${SRC}/redir.c
${SRC}/sigsegv.c
${SRC}/sound.c
${SRC}/sysinfo.c
${SRC}/usb-emu.c
${SRC}/usb-init-fix.c
${SRC}/usb-mnt.c

View File

@ -0,0 +1,31 @@
#define LOG_MODULE "patch-sysinfo"
#include <sys/sysinfo.h>
#include <stdbool.h>
#include "capnhook/hook/lib.h"
#include "util/log.h"
typedef int (*sysinfo_t)(struct sysinfo *info);
static bool patch_sysinfo_initialized;
static sysinfo_t patch_sysinfo_real_sysinfo;
int sysinfo(struct sysinfo *info) {
if (!patch_sysinfo_real_sysinfo) {
patch_sysinfo_real_sysinfo = (sysinfo_t)cnh_lib_get_func_addr("sysinfo");
}
// Prime will not run in HD if totalram / (mem_unit * 1024) is less than 999999
int ret = patch_sysinfo_real_sysinfo(info);
info->totalram = info->totalram * info->mem_unit;
info->mem_unit = 1;
return ret;
}
void patch_sysinfo_init()
{
patch_sysinfo_initialized = true;
log_info("Initialized");
}

View File

@ -0,0 +1,8 @@
#pragma once
/**
* Initialize the patch module
*
* This takes care of overriding system specs
*/
void patch_sysinfo_init();

View File

@ -26,6 +26,7 @@
#include "hook/patch/redir.h"
#include "hook/patch/sigsegv.h"
#include "hook/patch/sound.h"
#include "hook/patch/sysinfo.h"
#include "hook/patch/usb-emu.h"
#include "hook/patch/usb-init-fix.h"
#include "hook/patch/usb-mnt.h"
@ -151,6 +152,13 @@ static void prihook_patch_gfx_init(struct prihook_options *options)
}
}
static void prihook_patch_sysinfo_init(struct prihook_options *options)
{
log_assert(options);
patch_sysinfo_init();
}
static void prihook_patch_main_loop_init(struct prihook_options *options)
{
log_assert(options);
@ -283,6 +291,7 @@ void prihook_trap_before_main(int argc, char **argv)
prihook_fs_redirs_init(&options, game_data_path);
prihook_patch_fs_mounting_init();
prihook_patch_gfx_init(&options);
prihook_patch_sysinfo_init(&options);
prihook_patch_main_loop_init(&options);
prihook_patch_sound_init(&options);
prihook_patch_sigsegv_init(&options);