Skip to content

Commit

Permalink
Merge branch 'patch_rendering_bigobj'
Browse files Browse the repository at this point in the history
  • Loading branch information
ePi5131 committed Jul 6, 2023
2 parents 2583d78 + 0e009b7 commit 073b4af
Show file tree
Hide file tree
Showing 10 changed files with 191 additions and 0 deletions.
3 changes: 3 additions & 0 deletions patch.aul.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ https://scrapbox.io/ePi5131/patch.aul
・スクリプト並び替え管理プラグインとの競合を解消
・ファイル名が同じプラグインファイルが複数フォルダに存在するときに警告を出す
・一部キャッシュは共有メモリ(システムの設定のキャッシュサイズの部分)を使用するように変更
・高さ4097以上の描画が正常に行えないことがあるのを修正

追加
・コンソールの表示
Expand Down Expand Up @@ -222,6 +223,7 @@ https://scrapbox.io/ePi5131/patch.aul
"r_click_menu_split" : boolean, ; 右クリック分割で設定ダイアログが更新されないのを修正 (既定値: true)
"r_click_menu_delete" : boolean, ; 右クリック削除でテキストの字間行間が変わることがあるのを修正 (既定値: true)
"blend" : boolean, ; アルファチャンネルのあるフレームバッファで合成モード「通常」以外を使用すると誤った結果になるのを修正 (既定値: true)
"rendering" : boolean, ; 高さ4097以上の描画が正常に行えないことがあるのを修正 (既定値: true)
"add_extension" : boolean, ; 動画、音声ファイル参照の時、exedit.iniにある拡張子を追加する (既定値: true)
"new_project_editbox" : boolean, ; 新規プロジェクト作成ダイアログの画像サイズ入力欄の幅を広げる (既定値: true)
"playback_speed" : boolean, ; 中間点で再生速度を変更した時、そこまでの中間点の数だけ速度変化が遅れて反映されるバグの修正 (既定値: true)
Expand Down Expand Up @@ -483,3 +485,4 @@ Lua追加要素詳細
ファイル名が同じプラグインファイルが複数フォルダに存在するときに警告を出す
一部キャッシュは共有メモリ(システムの設定のキャッシュサイズの部分)を使用するように変更
極座標変換の高速化設定のキーのtypoを修正
高さ4097以上の描画が正常に行えないことがあるのを修正
3 changes: 3 additions & 0 deletions patch/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ class Config2 {
#ifdef PATCH_SWITCH_BLEND
patch::blend.switch_store(switch_);
#endif
#ifdef PATCH_SWITCH_RENDERING
patch::Rendering.switch_store(switch_);
#endif
#ifdef PATCH_SWITCH_ADD_EXTENSION
patch::add_extension.switch_store(switch_);
#endif
Expand Down
3 changes: 3 additions & 0 deletions patch/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ void init_t::InitAtExeditLoad() {
#ifdef PATCH_SWITCH_BLEND
patch::blend.init();
#endif
#ifdef PATCH_SWITCH_RENDERING
patch::Rendering.init();
#endif
#ifdef PATCH_SWITCH_ADD_EXTENSION
patch::add_extension.init();
#endif
Expand Down
1 change: 1 addition & 0 deletions patch/macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
#define PATCH_SWITCH_RCLICKMENU_SPLIT rclickmenu_split
#define PATCH_SWITCH_RCLICKMENU_DELETE rclickmenu_delete
#define PATCH_SWITCH_BLEND blend
#define PATCH_SWITCH_RENDERING rendering
#define PATCH_SWITCH_ADD_EXTENSION add_extension
#define PATCH_SWITCH_DIALOG_NEW_FILE dlg_newfile
#define PATCH_SWITCH_PLAYBACK_SPEED pb_speed
Expand Down
8 changes: 8 additions & 0 deletions patch/offset_address.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ namespace OFS {
constexpr i32 blend_yca_normal_func = 0x007df0;
constexpr i32 blend_yc_normal_func = 0x007f20;

constexpr i32 rendering_mt_func = 0x078140;
constexpr i32 rendering_data = 0x1ec890;
constexpr i32 rendering_data_count = 0x1ec728;

constexpr i32 ConvertFilter2Exo_TrackScaleJudge_RangeBegin = 0x028a8d;
constexpr i32 ConvertFilter2Exo_TrackScaleJudge_Overwrite1 = 0x028a84;
constexpr i32 ConvertFilter2Exo_TrackScaleJudge_Overwrite2 = 0x0289cb;
Expand Down Expand Up @@ -74,6 +78,8 @@ namespace OFS {
constexpr i32 exedit_max_h = 0x1920e0;

constexpr i32 memory_ptr = 0x01a5328;

constexpr i32 fast_process = 0x2308a0;

constexpr i32 CreateFigure_var_ptr = 0x1e4798;
constexpr i32 CreateFigure_circle_func_call = 0x073882;
Expand Down Expand Up @@ -120,6 +126,8 @@ namespace OFS {
constexpr i32 GetOrCreateCache = 0x04d7d0;

constexpr i32 exedit_edit_open = 0x03ac30;

constexpr i32 do_multi_thread_func = 0x06c650;

constexpr i32 exfunc = 0x0a41e0;
constexpr i32 exfunc_10 = 0x04abe0;
Expand Down
1 change: 1 addition & 0 deletions patch/patch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@
#include "patch_script_sort.hpp"
#include "patch_warning_duplicate_plugins.hpp"
#include "patch_shared_cache.hpp"
#include "patch_rendering.hpp"
2 changes: 2 additions & 0 deletions patch/patch.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ClInclude Include="patch_console.hpp" />
<ClInclude Include="patch_copybuffer_smem.hpp" />
<ClInclude Include="patch_dialog_new_file.hpp" />
<ClInclude Include="patch_rendering.hpp" />
<ClInclude Include="patch_exception_history.hpp" />
<ClInclude Include="patch_exception_log.hpp" />
<ClInclude Include="patch_exception_log_dialog.hpp" />
Expand Down Expand Up @@ -132,6 +133,7 @@
<ClCompile Include="patch_add_extension.cpp" />
<ClCompile Include="patch_aviutl_wndproc_override.cpp" />
<ClCompile Include="patch_blend.cpp" />
<ClCompile Include="patch_rendering.cpp" />
<ClCompile Include="patch_exception_log.cpp" />
<ClCompile Include="patch_exception_log_dialog.cpp" />
<ClCompile Include="patch_exo_trackminusval.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions patch/patch.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@
<Filter>feature</Filter>
</ClInclude>
<ClInclude Include="scope_exit.hpp" />
<ClInclude Include="patch_rendering.hpp">
<Filter>feature</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="init.cpp" />
Expand Down Expand Up @@ -412,6 +415,9 @@
<ClCompile Include="patch_scene_cache.cpp">
<Filter>feature</Filter>
</ClCompile>
<ClCompile Include="patch_rendering.cpp">
<Filter>feature</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="patch.rc" />
Expand Down
40 changes: 40 additions & 0 deletions patch/patch_rendering.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
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_rendering.hpp"

#ifdef PATCH_SWITCH_RENDERING
namespace patch {


int __stdcall rendering_t::mid_render() {
int fast_process = *(int*)(GLOBAL::exedit_base + OFS::ExEdit::fast_process);
if (fast_process) {
int* rendering_data = (int*)(GLOBAL::exedit_base + OFS::ExEdit::rendering_data);
int j = 10;
for (int i = 0; i < 4096; i++) {
rendering_data[j] = 0;
rendering_data[j + 1] = 0;
j += 17;
}
}
int* rendering_data_count = (int*)(GLOBAL::exedit_base + OFS::ExEdit::rendering_data_count);
*rendering_data_count = 4096;
reinterpret_cast<void(__cdecl*)(int, BOOL)>(GLOBAL::exedit_base + OFS::ExEdit::do_multi_thread_func)(GLOBAL::exedit_base + OFS::ExEdit::rendering_mt_func, TRUE);
return 0; // rendering_data_countをいくつにするか
}

} // namespace patch
#endif // ifdef PATCH_SWITCH_RENDERING
124 changes: 124 additions & 0 deletions patch/patch_rendering.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
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_RENDERING
#include <exedit.hpp>
#include "global.hpp"
#include "util.hpp"
#include "restorable_patch.hpp"

#include "config_rw.hpp"

namespace patch {
// init at exedit load
/*
・高さ4097以上描画が正常に行えないことがあるのを修正
以下二つは調査中
・回転45、obj.w==obj.h、obj.y==-obj.screen、(他条件有り) の時の描画が正常ではない
 https://twitter.com/iAieXAjGneaJAZO/status/1583718820191272960
・オブジェクトを横から見た薄い状態の表示位置がずれる
 https://twitter.com/nazono22/status/1592798629332652032
*/
inline class rendering_t {

static int __stdcall mid_render();
bool enabled = true;
bool enabled_i;

inline static const char key[] = "rendering";

public:
void init() {
enabled_i = enabled;

if (!enabled_i)return;

{ // 高さ4097以上描画が正常に行えないことがあるのを修正
/*
1007caaf 3d00100000 cmp eax,00001000
1007cab4 5e pop esi
1007cab5 7d06 jnl 1007cabd
1007cab7 40 inc eax
1007cab8 a328c71e10 mov [101ec728],eax
1007cabd 5f pop edi
1007cabe 5d pop ebp
1007cabf 5b pop ebx
1007cac0 83c41c add esp,+1c
1007cac3 c3 ret
1007cac4 90 nop
1007cac5 90 nop
1007cac6 90 nop
1007cac7 90 nop
1007cac8 90 nop
1007cac9 90 nop
1007caca 90 nop
1007cacb 90 nop
1007caaf 3dff0f0000 cmp eax,00000fff ; rendering_data_count == 4095
1007cab4 5e pop esi
1007cab5 740d jz 1007cac4
1007cab7 40 inc eax
1007cab8 a328c71e10 mov [101ec728],eax ; rendering_data_count
1007cabd 5f pop edi
1007cabe 5d pop ebp
1007cabf 5b pop ebx
1007cac0 83c41c add esp,+1c
1007cac3 c3 ret
1007cac4 e8XxXxXxXx call ;__stdcall return 0;
1007cac9 ebed jmp 1007cab8
1007cacb 90 nop
描画の行データが4096に達する時、描画関数を実行しカウントを0にする
*/
OverWriteOnProtectHelper h(GLOBAL::exedit_base + 0x7cab0, 27);
h.store_i16(0, '\xff\x0f');
h.store_i16(5, '\x74\x0d');
h.store_i8(20, '\xe8');
h.replaceNearJmp(21, &mid_render);
h.store_i16(25, '\xeb\xed');

}


}
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);
}

} Rendering;
} // namespace patch
#endif // ifdef PATCH_SWITCH_RENDERING

0 comments on commit 073b4af

Please sign in to comment.