Skip to content

Commit

Permalink
Fix displaying current value, and getting list file.
Browse files Browse the repository at this point in the history
  • Loading branch information
sceawung committed Apr 6, 2017
1 parent c4a247f commit 6e8211c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
3 changes: 2 additions & 1 deletion SpoilerAL-winmm.dll/FixMainForm/Attach_FixMainForm.c
Expand Up @@ -133,7 +133,8 @@ EXTERN_C void Attach_FixMainForm()
// TMainForm::DrawTreeCell
*(LPDWORD)(0x004453E5 + 2) = (DWORD)TMainForm_DrawTreeCell_ModifyNowValue - (0x004453E5 + 2 + sizeof(DWORD));
*(LPDWORD)0x004453F2 = (DWORD)TMainForm_DrawTreeCell_ModifyNowValue;
*(LPDWORD)0x0044540E = (DWORD)TMainForm_DrawTreeCell_ModifyNowValue;
*(LPDWORD)0x00445406 = (DWORD)TMainForm_DrawTreeCell_ModifyNowValue;
*(LPDWORD)0x0044540E =*(LPDWORD)(0x004453F2 + 4 * 8);

// TMainForm::DrawTreeCell
*(LPDWORD)(0x00445452 + 1) = (DWORD)TMainForm_DrawTreeCell_ModifyNowValueCalc - (0x00445452 + 1 + sizeof(DWORD));
Expand Down
Expand Up @@ -2,7 +2,7 @@
#include "TMainForm.h"
#include "TSSArg.h"

static void __fastcall ModifyNowValueCalc(LPCSTR nowValHeadStr);
static LPCSTR __fastcall ModifyNowValueCalc(LPCSTR nowValHeadStr, LPCSTR last);
static void __fastcall ModifyNowValueDefault(bcb6_std_string *DrawStr, TSSArg *Arg);

__declspec(naked) void __cdecl TMainForm_DrawTreeCell_ModifyNowValueCalc()
Expand All @@ -12,8 +12,14 @@ __declspec(naked) void __cdecl TMainForm_DrawTreeCell_ModifyNowValueCalc()
#define SSC edi
#define offsetof_TSSCalc_nowValHeadStr 160

mov edx, dword ptr [SSC + offsetof_TSSCalc_nowValHeadStr + 4]
mov ecx, dword ptr [SSC + offsetof_TSSCalc_nowValHeadStr]
jmp ModifyNowValueCalc
call ModifyNowValueCalc
test eax, eax
jz L1
mov dword ptr[esp + 12], eax
L1:
jmp [TStringDivision_ToString]

#undef SSC
#undef offsetof_TSSCalc_nowValHeadStr
Expand All @@ -27,24 +33,34 @@ __declspec(naked) void __cdecl TMainForm_DrawTreeCell_ModifyNowValueFloatCalc()
#define SSFC edi
#define offsetof_TSSFloatCalc_nowValHeadStr 176

mov edx, dword ptr [SSFC + offsetof_TSSFloatCalc_nowValHeadStr + 4]
mov ecx, dword ptr [SSFC + offsetof_TSSFloatCalc_nowValHeadStr]
jmp ModifyNowValueCalc
call ModifyNowValueCalc
test eax, eax
jz L1
mov dword ptr[esp + 16], eax
L1:
jmp [TStringDivision_ToStringDouble]

#undef SSFC
#undef offsetof_TSSFloatCalc_nowValHeadStr
}
}

static __declspec(naked) void __fastcall ModifyNowValueCalc(LPCSTR nowValHeadStr)
static __declspec(naked) LPCSTR __fastcall ModifyNowValueCalc(LPCSTR nowValHeadStr, LPCSTR last)
{
__asm
{
xor eax, eax
sub edx, ecx
cmp edx, 1
jbe L1
cmp byte ptr [ecx], '_'
jne L1
inc ecx
mov dword ptr [esp + 12], ecx
lea eax, [ecx + 1]; inc ecx
; mov dword ptr [esp + 12], ecx
L1:
jmp dword ptr [TStringDivision_ToString]
ret; jmp dword ptr [TStringDivision_ToString]
}
}

Expand Down Expand Up @@ -75,11 +91,12 @@ static void __fastcall ModifyNowValueDefault(bcb6_std_string *DrawStr, TSSArg *A
TSSArg_ToString(&s, Arg);
length = bcb6_std_string_length(&s);
n = length + 2;
if (n >= (size_t)(DrawStr->_M_end_of_storage - DrawStr->_M_start))
bcb6_std_string_allocate(DrawStr, n);
*DrawStr->_M_start = '[';
DrawStr->_M_finish = DrawStr->_M_start + n;
*(LPWORD)(DrawStr->_M_finish - 1) = BSWAP16(']\0');
__movsb(DrawStr->_M_start + 1, s._M_start, length);
//if (n >= (size_t)(DrawStr->_M_end_of_storage - DrawStr->_M_start))
bcb6_std_string_allocate(&s, n);
memmove(s._M_start + 1, s._M_start, length);
*s._M_start = '[';
s._M_finish = s._M_start + n;
*(LPWORD)(s._M_finish - 1) = BSWAP16(']\0');
bcb6_std_string_append_range(DrawStr, s._M_start, s._M_finish);
bcb6_std_string_dtor(&s);
}
Expand Up @@ -164,7 +164,7 @@ L1:
push -1
push 0
sub esp, 24
lea eax, [esp + 4H]
mov eax, esp
push ecx
push eax
call dword ptr [_bcb6_std_string_ctor_assign]
Expand Down

0 comments on commit 6e8211c

Please sign in to comment.