-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "patch_change_disp_scene.hpp" | ||
|
||
#ifdef PATCH_SWITCH_CHANGE_DISP_SCENE | ||
namespace patch { | ||
|
||
void update_title() { | ||
char title[64]; | ||
int frame = *(int*)(GLOBAL::exedit_base + OFS::ExEdit::frame_cursor); | ||
int frame_n = *(int*)(GLOBAL::exedit_base + OFS::ExEdit::frame_n); | ||
frame = std::clamp(frame, 0, frame_n - 1); | ||
|
||
double framerate = *(double*)(GLOBAL::exedit_base + OFS::ExEdit::double_framerate); | ||
double framerate_scale = *(double*)(GLOBAL::exedit_base + OFS::ExEdit::double_framerate_scale); | ||
int centisecond = (int)(100.0 / framerate * (double)frame * framerate_scale); | ||
char* tl_title = (char*)(GLOBAL::exedit_base + OFS::ExEdit::tl_title); | ||
wsprintfA(title, tl_title, centisecond / 360000, (centisecond % 360000) / 6000, (centisecond % 6000) / 100, centisecond % 100, frame + 1, frame_n); | ||
|
||
SetWindowTextA(*(HWND*)(GLOBAL::exedit_base + OFS::ExEdit::exedit_hwnd), title); | ||
} | ||
|
||
int __cdecl change_disp_scene_t::set_frame_wrap(AviUtl::EditHandle* editp, int frame) { | ||
|
||
int* ini_shiftselect = (int*)(GLOBAL::aviutl_base + OFS::AviUtl::ini_shiftselect); | ||
int tmp_shiftselect = *ini_shiftselect; | ||
*ini_shiftselect = 0; | ||
|
||
auto a_exfunc = (AviUtl::ExFunc*)(GLOBAL::aviutl_base + OFS::AviUtl::exfunc); | ||
int ret = a_exfunc->set_frame(editp, frame); | ||
|
||
update_title(); | ||
|
||
*ini_shiftselect = tmp_shiftselect; | ||
|
||
return ret; | ||
} | ||
} // namespace patch | ||
#endif // ifdef PATCH_SWITCH_CHANGE_DISP_SCENE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
#include "macro.h" | ||
|
||
#ifdef PATCH_SWITCH_CHANGE_DISP_SCENE | ||
|
||
#include <exedit.hpp> | ||
|
||
#include "global.hpp" | ||
#include "offset_address.hpp" | ||
#include "restorable_patch.hpp" | ||
|
||
#include "config_rw.hpp" | ||
|
||
namespace patch { | ||
// init at exedit load | ||
/* シーン切り替え時のバグを修正 | ||
・Shiftを押しながらシーン切り替えをすると範囲選択がされる(システムの設定>フレーム移動時にSHIFTキーを押している時は範囲選択移動にする の影響) | ||
・拡張編集のウィンドウキャプションが変わらない | ||
*/ | ||
inline class change_disp_scene_t { | ||
static int __cdecl set_frame_wrap(AviUtl::EditHandle* editp, int frame); | ||
|
||
bool enabled = true; | ||
bool enabled_i; | ||
|
||
inline static const char key[] = "change_disp_scene"; | ||
|
||
inline static int last_id = -1; | ||
|
||
public: | ||
|
||
void init() { | ||
enabled_i = enabled; | ||
|
||
if (!enabled_i)return; | ||
{ | ||
/* | ||
1002be69 8b4e60 mov ecx,dword ptr [esi+60] | ||
1002be6c 52 push edx | ||
1002be6d 57 push edi | ||
1002be6e ff5124 call dword ptr [ecx+24] | ||
1002be71 | ||
↓ | ||
1002be69 52 push edx | ||
1002be6a 57 push edi | ||
1002be6b 90 nop | ||
1002be6c e8XxXxXxXx call new_func | ||
1002be71 | ||
*/ | ||
|
||
OverWriteOnProtectHelper h(GLOBAL::exedit_base + 0x02be69, 8); | ||
h.store_i32(0, '\x52\x57\x90\xe8'); | ||
h.replaceNearJmp(4, &set_frame_wrap); | ||
|
||
} | ||
|
||
|
||
} | ||
void switching(bool flag) { | ||
enabled = flag; | ||
} | ||
|
||
bool is_enabled() { return enabled; } | ||
bool is_enabled_i() { return enabled_i; } | ||
|
||
void switch_load(ConfigReader& cr) { | ||
cr.regist(key, [this](json_value_s* value) { | ||
ConfigReader::load_variable(value, enabled); | ||
}); | ||
} | ||
|
||
void switch_store(ConfigWriter& cw) { | ||
cw.append(key, enabled); | ||
} | ||
|
||
} change_disp_scene; | ||
} // namespace patch | ||
#endif // ifdef PATCH_SWITCH_CHANGE_DISP_SCENE |