feat: Crude SDVX 5 support
> disable lobby video (cause for crashes in lobby), see #9 > suppress dmoeffector log messages, see #9
This commit is contained in:
+71
-5
@@ -3,6 +3,7 @@
|
||||
#include "util/detour.h"
|
||||
#include "util/libutils.h"
|
||||
#include "util/utils.h"
|
||||
#include "util/sigscan.h"
|
||||
#include "avs/core.h"
|
||||
#include "avs/game.h"
|
||||
#include "hooks/wmischook.h"
|
||||
@@ -23,7 +24,7 @@ public:
|
||||
log_warning("hooks::devel::thumbnail", "Forcing thumbnail patch..");
|
||||
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "thumbnail");
|
||||
}
|
||||
} thumbnail_("thum_test");
|
||||
} thumbnail_("wmisc_thum");
|
||||
|
||||
static class Msacm : public Routine
|
||||
{
|
||||
@@ -34,7 +35,18 @@ public:
|
||||
log_warning("hooks::devel::msacm", "Forcing msacm patch..");
|
||||
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "msacm");
|
||||
}
|
||||
} msacm_("acm_test");
|
||||
} msacm_("wmisc_acm");
|
||||
|
||||
static class DmoEffector : public Routine
|
||||
{
|
||||
public:
|
||||
using Routine::Routine;
|
||||
void entry_main() override
|
||||
{
|
||||
log_warning("hooks::devel::msacm", "Forcing msacm patch..");
|
||||
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "dmoeffector");
|
||||
}
|
||||
} dmoeffector_("wmisc_dmoeffector");
|
||||
|
||||
static class Wmisc : public Routine
|
||||
{
|
||||
@@ -45,7 +57,12 @@ public:
|
||||
log_warning("hooks::devel::wmisc", "Disabling auto-patching..");
|
||||
hooks::wmisc::skip_patching_by_model(true);
|
||||
}
|
||||
} wmisc_("wmisc_test");
|
||||
void entry_main() override
|
||||
{
|
||||
// Reenable logging
|
||||
hooks::wmisc::apply_performance_hacks(avs::game::DLL_INSTANCE, "FORCE", "bmsound");
|
||||
}
|
||||
} wmisc_("disable_auto_wmisc");
|
||||
|
||||
static class Avs_fs : public Routine
|
||||
{
|
||||
@@ -90,6 +107,53 @@ public:
|
||||
}
|
||||
} avs_fs_("avs_fs_detour");
|
||||
|
||||
static class CMoviePlayer : public Routine
|
||||
{
|
||||
private:
|
||||
typedef void (*GetWmvChunk_t)(uint8_t *param_1);
|
||||
inline static GetWmvChunk_t GetWmvChunk_;
|
||||
|
||||
|
||||
static void on_get_wmv_chunk_(uint8_t *param_1)
|
||||
{
|
||||
static FILE *fp = nullptr;
|
||||
if (!fp)
|
||||
{
|
||||
fp = fopen("data/movie/testbg2_fhd.wmv", "rb");
|
||||
if (!fp)
|
||||
log_warning("hooks::devel::CMoviePlayer", "Missing wmv file");
|
||||
}
|
||||
|
||||
// Read from file (skip AVS)
|
||||
if (fp)
|
||||
{
|
||||
int chunksz = *(uint32_t *) (param_1 + 0x10);
|
||||
log_misc("hooks::devel::CMoviePlayer", "Reading {} bytes", chunksz);
|
||||
int readsz = fread((void *) *(intptr_t *) (param_1 + 0x08), chunksz, 1, fp);
|
||||
*(int *) (param_1 + 0x14) = readsz;
|
||||
if(readsz < chunksz)
|
||||
{
|
||||
fclose(fp);
|
||||
fp = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public:
|
||||
using Routine::Routine;
|
||||
void entry_main() override
|
||||
{
|
||||
log_warning("hooks::devel", "Test code for SDVX5::CMoviePlayer only");
|
||||
|
||||
intptr_t TX_ThumExists = find_pattern_from(avs::game::DLL_INSTANCE, "40534883ec20448b4110488bd9488b51088b09ff150000000089431485c0791d448bc0488d1500000000488d0d000000004883c4205b48ff25000000004883c4205bc3", "XXXXXXXXXXXXXXXXXXXXX????XXXXXXXXXXXXX????XXX????XXXXXXXX????XXXXXX", 0, 0, 0);
|
||||
if (!detour::trampoline_try(reinterpret_cast<void *>(TX_ThumExists), reinterpret_cast<void *>(on_get_wmv_chunk_), reinterpret_cast<void **>(&GetWmvChunk_)))
|
||||
{
|
||||
log_fatal("hooks::devel", "Hook failed");
|
||||
}
|
||||
}
|
||||
} cmovieplayer_("wmisc_cmovieplayer");
|
||||
|
||||
std::vector<std::string> from_env(const char *str)
|
||||
{
|
||||
std::vector<std::string> r;
|
||||
@@ -103,9 +167,9 @@ std::vector<std::string> from_env(const char *str)
|
||||
|
||||
return r;
|
||||
}
|
||||
static std::vector<Routine*> &routines()
|
||||
static std::vector<Routine *> &routines()
|
||||
{
|
||||
static std::vector<Routine*> routines_;
|
||||
static std::vector<Routine *> routines_;
|
||||
if (routines_.empty())
|
||||
{
|
||||
//Default routines
|
||||
@@ -113,6 +177,8 @@ static std::vector<Routine*> &routines()
|
||||
routines_.push_back(&thumbnail_);
|
||||
routines_.push_back(&msacm_);
|
||||
routines_.push_back(&wmisc_);
|
||||
routines_.push_back(&cmovieplayer_);
|
||||
routines_.push_back(&dmoeffector_);
|
||||
}
|
||||
return routines_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user