Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.

Commit de17823

Browse files
committed
50.07 offsets & patching improvment
1 parent 89aa409 commit de17823

15 files changed

+137
-49
lines changed

config/dfint_config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ crash_report = true
99
crash_report_dir = "./dfint_data/crash_reports/"
1010
enable_search = true
1111
enable_translation = true
12+
enable_patches = false
1213
dictionary = "./dfint_data/dfint_dictionary.csv"
1314
watchdog = true

config/offsets/50.04_steam_win64.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ addst = 0x784C60
1515
addst_top = 0x784DB0
1616
addcoloredst = 0x784890
1717
addst_flag = 0x784970
18-
addst_template = 0x96E710
1918
# search
2019
standardstringentry = 0x87ED50
2120
simplify_string = 0x35C7A0
@@ -36,3 +35,5 @@ loading_world_new_game_loop = 0x9FD2E0
3635
loading_world_continuing_game_loop = 0x566F40
3736
loading_world_start_new_game_loop = 0x5652C0
3837
menu_interface_loop = 0x1678A0
38+
# keybinding shift
39+
keybinding = 357

config/offsets/50.05_itchio_win64.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ addst = 0x782190
1515
addst_top = 0x7822E0
1616
addcoloredst = 0x781DC0
1717
addst_flag = 0x781EA0
18-
addst_template = 0x96BB90
1918
# search
2019
standardstringentry = 0x87C1D0
2120
simplify_string = 0x359F70
@@ -36,3 +35,5 @@ loading_world_new_game_loop = 0x9F8A60
3635
loading_world_continuing_game_loop = 0x5645B0
3736
loading_world_start_new_game_loop = 0x562930
3837
menu_interface_loop = 0x167490
38+
# keybinding shift
39+
keybinding = 357

config/offsets/50.05_steam_win64.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ addst = 0x784C50
1515
addst_top = 0x784DA0
1616
addcoloredst = 0x784880
1717
addst_flag = 0x784960
18-
addst_template = 0x96E700
1918
# search
2019
standardstringentry = 0x87ED40
2120
simplify_string = 0x35C790
@@ -36,3 +35,5 @@ loading_world_new_game_loop = 0x9FD2D0
3635
loading_world_continuing_game_loop = 0x566F30
3736
loading_world_start_new_game_loop = 0x5652B0
3837
menu_interface_loop = 0x167890
38+
# keybinding shift
39+
keybinding = 357
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[metadata]
2+
name = "dfint localization hook offsets"
3+
version = "50.07 itch.io win64"
4+
checksum = 0x63e2a0d6
5+
6+
[offsets]
7+
# translation
8+
string_copy = 0xB7D0
9+
string_copy_n = 0xB7F0
10+
string_append = 0xB590
11+
string_append_0 = 0xB5B0
12+
string_append_n = 0xB930
13+
convert_ulong_to_string = 0x390740
14+
addst = 0x7C0E90
15+
addst_top = 0x7C0F70
16+
addcoloredst = 0x7C0B40
17+
addst_flag = 0x7C0C20
18+
# search
19+
standardstringentry = 0x8BBDA0
20+
simplify_string = 0x3910E0
21+
upper_case_string = 0x391420
22+
lower_case_string = 0x391280
23+
capitalize_string_words = 0x3915C0
24+
capitalize_string_first_word = 0x391840
25+
# ttf
26+
addchar = 0x56180
27+
addchar_top = 0xF3CD0
28+
add_texture = 0xECC540
29+
gps_allocate = 0x5FB800
30+
cleanup_arrays = 0x5FB620
31+
screen_to_texid = 0x5F3890
32+
screen_to_texid_top = 0x5F3A80
33+
# game state
34+
loading_world_new_game_loop = 0xA3DC10
35+
loading_world_continuing_game_loop = 0x59E520
36+
loading_world_start_new_game_loop = 0x59C170
37+
menu_interface_loop = 0x172D10
38+
# keybinding shift
39+
keybinding = 370
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[metadata]
2+
name = "dfint localization hook offsets"
3+
version = "50.07 steam win64"
4+
checksum = 0x63e29e0c
5+
6+
[offsets]
7+
# translation
8+
string_copy = 0xB850
9+
string_copy_n = 0xB870
10+
string_append = 0xB610
11+
string_append_0 = 0xB630
12+
string_append_n = 0xB9B0
13+
convert_ulong_to_string = 0x392C70
14+
addst = 0x7C3810
15+
addst_top = 0x7C38F0
16+
addcoloredst = 0x7C34C0
17+
addst_flag = 0x7C35A0
18+
# search
19+
standardstringentry = 0x8BE7D0
20+
simplify_string = 0x3937B0
21+
upper_case_string = 0x393AF0
22+
lower_case_string = 0x393950
23+
capitalize_string_words = 0x393C90
24+
capitalize_string_first_word = 0x393F10
25+
# ttf
26+
addchar = 0x56200
27+
addchar_top = 0xF3D60
28+
add_texture = 0xED0C70
29+
gps_allocate = 0x5FE030
30+
cleanup_arrays = 0x5FDE50
31+
screen_to_texid = 0x5F60C0
32+
screen_to_texid_top = 0x5F62B0
33+
# game state
34+
loading_world_new_game_loop = 0xA42340
35+
loading_world_continuing_game_loop = 0x5A0D50
36+
loading_world_start_new_game_loop = 0x59E9A0
37+
menu_interface_loop = 0x173150
38+
# keybinding shift
39+
keybinding = 370

src/hook/config.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ namespace Config {
4444

4545
inline std::vector<uintptr_t> GetStringsOffsetArray()
4646
{
47-
auto strings_patches_nodes = Config::offsets["offsets"]["strings_patches"]
48-
? Config::offsets["offsets"]["strings_patches"].as_array()
49-
: nullptr;
47+
auto strings_patches_nodes =
48+
Config::offsets["offsets"]["string_patches"] ? Config::offsets["offsets"]["string_patches"].as_array() : nullptr;
5049
std::vector<uintptr_t> strings_patches{};
5150
if (strings_patches_nodes) {
5251
for (toml::node& item : *strings_patches_nodes) {
@@ -75,7 +74,8 @@ namespace Config {
7574
inline auto log_file = Config::config["settings"]["log_file"].value_or<std::string>("./dfint_data/dfint_log.log");
7675
inline auto crash_report = Config::config["settings"]["crash_report"].value_or<bool>(true);
7776
inline auto enable_search = Config::config["settings"]["enable_search"].value_or<bool>(true);
78-
inline bool enable_translation = Config::config["settings"]["enable_translation"].value_or<bool>(true);
77+
inline auto enable_translation = Config::config["settings"]["enable_translation"].value_or<bool>(true);
78+
inline auto enable_patches = Config::config["settings"]["enable_patches"].value_or<bool>(true);
7979
inline auto dictionary =
8080
Config::config["settings"]["dictionary"].value_or<std::string>("./dfint_data/dfint_dictionary.csv");
8181
inline auto crash_report_dir =
@@ -84,6 +84,12 @@ namespace Config {
8484

8585
} // namespace Setting
8686

87+
namespace Keybinding {
88+
89+
inline auto shift = Config::offsets["offsets"]["keybinding"].value_or<uint32_t>(0);
90+
91+
} // namespace Keybinding
92+
8793
namespace Offset {
8894

8995
inline auto string_copy = Config::offsets["offsets"]["string_copy"].value_or<uintptr_t>(0);
@@ -122,9 +128,10 @@ namespace Config {
122128
Config::offsets["offsets"]["loading_world_start_new_game_loop"].value_or<uintptr_t>(0);
123129
inline auto menu_interface_loop = Config::offsets["offsets"]["menu_interface_loop"].value_or<uintptr_t>(0);
124130

125-
inline auto strings_patches = Config::GetStringsOffsetArray();
131+
inline auto string_patches = Config::GetStringsOffsetArray();
126132

127133
} // namespace Offset
134+
128135
} // namespace Config
129136

130137
#endif

src/hook/hooks.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,6 @@ namespace Hooks {
283283
ORIGINAL(addst_flag)(gps, str, a3, a4, some_flag);
284284
}
285285

286-
// // dynamic template string
287-
SETUP_ORIG_FUNC(addst_template);
288-
void __fastcall HOOK(addst_template)(renderer_2d_base_* renderer, std::string& str)
289-
{
290-
ORIGINAL(addst_template)(renderer, str);
291-
}
292-
293286
// loading_data_new_game_loop interface loop
294287
SETUP_ORIG_FUNC(loading_world_new_game_loop);
295288
void __fastcall HOOK(loading_world_new_game_loop)(void* a1)
@@ -388,51 +381,52 @@ namespace Hooks {
388381
std::set<InterfaceKey>& events)
389382
{
390383
char entry = char(1);
384+
const auto shift = Config::Keybinding::shift;
391385

392386
if (flag & STRINGENTRY_SYMBOLS) {
393-
for (short int item = INTERFACEKEY_STRING_A000; item <= INTERFACEKEY_STRING_A255; item++) {
387+
for (short int item = INTERFACEKEY_STRING_A000 + shift; item <= INTERFACEKEY_STRING_A255 + shift; item++) {
394388
if (events.count(item)) {
395-
entry = char(item - 357);
389+
entry = char(item - shift);
396390
break;
397391
}
398392
}
399393
}
400394
if (flag & STRINGENTRY_LETTERS) {
401395
// latin capitals
402-
for (short int item = INTERFACEKEY_STRING_A065; item <= INTERFACEKEY_STRING_A090; item++) {
396+
for (short int item = INTERFACEKEY_STRING_A065 + shift; item <= INTERFACEKEY_STRING_A090 + shift; item++) {
403397
if (events.count(item)) {
404-
entry = char(item - 357);
398+
entry = char(item - shift);
405399
break;
406400
}
407401
}
408402
// latin small
409-
for (short int item = INTERFACEKEY_STRING_A097; item <= INTERFACEKEY_STRING_A122; item++) {
403+
for (short int item = INTERFACEKEY_STRING_A097 + shift; item <= INTERFACEKEY_STRING_A122 + shift; item++) {
410404
if (events.count(item)) {
411-
entry = char(item - 357);
405+
entry = char(item - shift);
412406
break;
413407
}
414408
}
415409
// cyrillic
416-
for (short int item = INTERFACEKEY_STRING_A192; item <= INTERFACEKEY_STRING_A255; item++) {
410+
for (short int item = INTERFACEKEY_STRING_A192 + shift; item <= INTERFACEKEY_STRING_A255 + shift; item++) {
417411
if (events.count(item)) {
418-
entry = char(item - 356);
412+
entry = char(item - shift + 1);
419413
break;
420414
}
421415
}
422416
}
423417
if (flag & STRINGENTRY_SPACE) {
424-
if (events.count(INTERFACEKEY_STRING_A032)) {
418+
if (events.count(INTERFACEKEY_STRING_A032 + shift)) {
425419
entry = ' ';
426420
}
427421
}
428-
if (events.count(INTERFACEKEY_STRING_A000)) {
422+
if (events.count(INTERFACEKEY_STRING_A000 + shift)) {
429423
entry = char(0);
430424
}
431425
if (flag & STRINGENTRY_NUMBERS) {
432426
// numbers
433-
for (short int item = INTERFACEKEY_STRING_A048; item <= INTERFACEKEY_STRING_A057; item++) {
427+
for (short int item = INTERFACEKEY_STRING_A048 + shift; item <= INTERFACEKEY_STRING_A057 + shift; item++) {
434428
if (events.count(item)) {
435-
entry = char(item - 357);
429+
entry = char(item - shift);
436430
break;
437431
}
438432
}
@@ -770,7 +764,6 @@ namespace Hooks {
770764
ATTACH(addst_top);
771765
ATTACH(addst_flag);
772766
ATTACH(addcoloredst);
773-
// ATTACH(addst_template);
774767

775768
// search handling
776769
if (Config::Setting::enable_search) {
@@ -796,7 +789,6 @@ namespace Hooks {
796789
DETACH(addst_top);
797790
DETACH(addst_flag);
798791
DETACH(addcoloredst);
799-
// DETACH(addst_template);
800792

801793
// search handling
802794
if (Config::Setting::enable_search) {

src/hook/hooks.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ namespace Hooks {
166166
typedef void(__fastcall* addst_top)(graphicst_* gps, std::string& str, __int64 a3);
167167
typedef void(__fastcall* addcoloredst)(graphicst_* gps, const char* str, __int64 a3);
168168
typedef void(__fastcall* addst_flag)(graphicst_* a1, std::string& str, __int64 a3, __int64 a4, int a5);
169-
typedef void(__fastcall* addst_template)(renderer_2d_base_* renderer, std::string& str);
170169

171170
// search
172171
typedef int(__fastcall* standardstringentry)(std::string& str, int maxlen, unsigned int flag,

src/hook/keybindings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
typedef long InterfaceKey;
1010
enum InterfaceKeyType
1111
{
12-
INTERFACEKEY_STRING_A000 = 357,
12+
INTERFACEKEY_STRING_A000,
1313
INTERFACEKEY_STRING_A001,
1414
INTERFACEKEY_STRING_A002,
1515
INTERFACEKEY_STRING_A003,
@@ -136,6 +136,7 @@ enum InterfaceKeyType
136136
INTERFACEKEY_STRING_A124,
137137
INTERFACEKEY_STRING_A125,
138138
INTERFACEKEY_STRING_A126,
139+
INTERFACEKEY_STRING_A127,
139140
INTERFACEKEY_STRING_A128,
140141
INTERFACEKEY_STRING_A129,
141142
INTERFACEKEY_STRING_A130,

0 commit comments

Comments
 (0)