hook/other classic piu: Add gfx scaling feature

Support every game except for mk3 ports and pro series. Pro series
can do scaling etc by game configuration and mk3 has a different
gfx backend setup
This commit is contained in:
icex2
2021-03-20 11:35:31 +01:00
parent e86742b03c
commit 083505abd9
36 changed files with 187 additions and 0 deletions
+4
View File
@@ -141,6 +141,10 @@ static void x2hook_patch_gfx_init(struct x2hook_options *options)
log_assert(options);
patch_gfx_init();
if (options->patch.gfx.scaling_mode != PATCH_GFX_SCALE_MODE_INVALID) {
patch_gfx_scale(options->patch.gfx.scaling_mode);
}
}
static void x2hook_patch_game_init(struct x2hook_options *options)
+10
View File
@@ -4,6 +4,7 @@
#define X2HOOK_OPTIONS_STR_GAME_FORCE_UNLOCK "game.force_unlock"
#define X2HOOK_OPTIONS_STR_GAME_SETTINGS "game.settings"
#define X2HOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE "gfx.scaling_mode"
#define X2HOOK_OPTIONS_STR_PATCH_HOOK_MON_FILE "patch.hook_mon.file"
#define X2HOOK_OPTIONS_STR_PATCH_HOOK_MON_FS "patch.hook_mon.fs"
#define X2HOOK_OPTIONS_STR_PATCH_HOOK_MON_IO "patch.hook_mon.io"
@@ -38,6 +39,13 @@ static const struct util_options_def x2hook_options_def[] = {
.type = UTIL_OPTIONS_TYPE_STR,
.default_value.str = "./save",
},
{
.name = X2HOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.default_value.i = 0,
},
{
.name = X2HOOK_OPTIONS_STR_PATCH_HOOK_MON_FILE,
.description = "Enable file call monitoring",
@@ -159,6 +167,8 @@ bool x2hook_options_init(int argc, char **argv, struct x2hook_options *options)
options->game.force_unlock =
util_options_get_bool(options_opt, X2HOOK_OPTIONS_STR_GAME_FORCE_UNLOCK);
options->patch.gfx.scaling_mode = util_options_get_int(
options_opt, X2HOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE);
options->game.settings =
util_options_get_str(options_opt, X2HOOK_OPTIONS_STR_GAME_SETTINGS);
options->patch.hook_mon.file = util_options_get_bool(
+4
View File
@@ -13,6 +13,10 @@ struct x2hook_options {
} game;
struct patch {
struct gfx {
uint8_t scaling_mode;
} gfx;
struct hook_mon {
bool file;
bool fs;