forked from Popn_Tools/popnhax
high framerate fps
This commit is contained in:
parent
ddf377886e
commit
a86516dc2f
8
dist/popnhax/popnhax.xml
vendored
8
dist/popnhax/popnhax.xml
vendored
@ -124,8 +124,6 @@
|
||||
<keysound_offset __type="s8">0</keysound_offset>
|
||||
<!-- Adjust pop-kun and beam brightness (won't affect long popkuns) -->
|
||||
<beam_brightness __type="s8">0</beam_brightness>
|
||||
<!-- Disable the builtin frame limiter (faster/smoother animations at 120fps+) -->
|
||||
<fps_uncap __type="bool">0</fps_uncap>
|
||||
<!-- 1000Hz polling thread priority (for enhanced_polling only, might cause crashes on some systems if set too high)
|
||||
values THREAD_PRIORITY_LOWEST -2
|
||||
THREAD_PRIORITY_BELOW_NORMAL -1
|
||||
@ -135,6 +133,12 @@
|
||||
THREAD_PRIORITY_TIME_CRITICAL 15 -->
|
||||
<enhanced_polling_priority __type="s8">1</enhanced_polling_priority>
|
||||
|
||||
<!-- Framerate -->
|
||||
<!-- Disable the builtin frame limiter (faster/smoother animations at 120fps+) -->
|
||||
<fps_uncap __type="bool">0</fps_uncap>
|
||||
<!-- Reference fps value for high_framerate animation speed (0: auto) -->
|
||||
<high_framerate_fps __type="u16">0</high_framerate_fps>
|
||||
|
||||
<!-- Song db patches (requires patch_db) -->
|
||||
<!-- Auto select patch file from data_mods folder based on music limit, or datecode otherwise (will detect datecode from ea3-config or force_datecode option) -->
|
||||
<patch_xml_auto __type="bool">1</patch_xml_auto>
|
||||
|
@ -66,6 +66,7 @@ struct popnhax_config {
|
||||
bool exclude_omni;
|
||||
bool partial_entries;
|
||||
bool high_framerate;
|
||||
uint16_t high_framerate_fps;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -212,6 +212,8 @@ PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, ignore_music_l
|
||||
"/popnhax/ignore_music_limit")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_BOOL, struct popnhax_config, high_framerate,
|
||||
"/popnhax/high_framerate")
|
||||
PSMAP_MEMBER_REQ(PSMAP_PROPERTY_TYPE_U16, struct popnhax_config, high_framerate_fps,
|
||||
"/popnhax/high_framerate_fps")
|
||||
PSMAP_END
|
||||
|
||||
enum BufferIndexes {
|
||||
@ -7439,23 +7441,34 @@ static bool get_music_limit_from_file(const char *filepath, uint32_t *limit){
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool patch_afp_framerate()
|
||||
static bool patch_afp_framerate(uint16_t fps)
|
||||
{
|
||||
DWORD framerate = fps;
|
||||
|
||||
if ( framerate == 0 )
|
||||
{
|
||||
DEVMODE lpDevMode;
|
||||
memset(&lpDevMode, 0, sizeof(DEVMODE));
|
||||
lpDevMode.dmSize = sizeof(DEVMODE);
|
||||
lpDevMode.dmDriverExtra = 0;
|
||||
|
||||
if ( EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode) != 0 )
|
||||
if ( EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode) == 0 )
|
||||
{
|
||||
DWORD framerate = lpDevMode.dmDisplayFrequency;
|
||||
float new_value = 1./framerate;
|
||||
LOG("popnhax: high_framerate: could not retrieve display mode\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
framerate = lpDevMode.dmDisplayFrequency;
|
||||
} else {
|
||||
LOG("popnhax: high_framerate: force %ldHz\n", framerate);
|
||||
}
|
||||
|
||||
float new_value = 1./framerate;
|
||||
char *as_hex = (char*)&new_value;
|
||||
|
||||
if ( !find_and_patch_hex(g_game_dll_fn, "\x82\x9D\x88\x3C", 4, 0, as_hex, 4) )
|
||||
{
|
||||
LOG("popnhax: high_framerate: cannot patch animation speed\n");
|
||||
LOG("popnhax: high_framerate: cannot patch animation speed for %ldHz\n", framerate);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -7463,10 +7476,6 @@ static bool patch_afp_framerate()
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG("popnhax: high_framerate: could not retrieve display mode\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH: {
|
||||
@ -7848,7 +7857,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
||||
|
||||
if (config.high_framerate)
|
||||
{
|
||||
patch_afp_framerate();
|
||||
patch_afp_framerate(config.high_framerate_fps);
|
||||
config.fps_uncap = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user