mirror of https://github.com/x64dbg/TitanEngine
UNICODE!!! + bugfixes
This commit is contained in:
parent
3f824021eb
commit
7d3ebc9405
|
|
@ -19,6 +19,7 @@ typedef bool (*tScripterAutoDebugA)(const char*);
|
||||||
typedef bool (*tScripterAutoDebugW)(const wchar_t*);
|
typedef bool (*tScripterAutoDebugW)(const wchar_t*);
|
||||||
typedef void (*tScripterSetLogCallback)(fLogCallback Callback);
|
typedef void (*tScripterSetLogCallback)(fLogCallback Callback);
|
||||||
typedef bool (*tScripterExecuteWithTitanMistA)(const char*, const char*);
|
typedef bool (*tScripterExecuteWithTitanMistA)(const char*, const char*);
|
||||||
|
typedef bool (*tScripterExecuteWithTitanMistW)(const wchar_t*, const wchar_t*);
|
||||||
|
|
||||||
// use like this: tScripterResume foo = GetTSFunctionPointer(Resume);
|
// use like this: tScripterResume foo = GetTSFunctionPointer(Resume);
|
||||||
#define GetTSFunctionPointer(x) ((tScripter ## x)GetProcAddress(GetModuleHandleA("TitanScript"), "Scripter" #x))
|
#define GetTSFunctionPointer(x) ((tScripter ## x)GetProcAddress(GetModuleHandleA("TitanScript"), "Scripter" #x))
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ static void CreateDummyUnicodeFile(const TCHAR* szFileName);
|
||||||
static DWORD WINAPI TitanScriptExecThread(LPVOID lpParam);
|
static DWORD WINAPI TitanScriptExecThread(LPVOID lpParam);
|
||||||
|
|
||||||
//TitanScript functions
|
//TitanScript functions
|
||||||
static tScripterLoadFileA load_file = NULL;
|
static tScripterLoadFileW load_file = NULL;
|
||||||
static tScripterExecuteWithTitanMistA exec = NULL;
|
static tScripterExecuteWithTitanMistW exec = NULL;
|
||||||
static tScripterSetLogCallback set_log_callback = NULL;
|
static tScripterSetLogCallback set_log_callback = NULL;
|
||||||
|
|
||||||
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
||||||
|
|
@ -91,8 +91,8 @@ INT_PTR CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
load_file = GetTSFunctionPointer( LoadFileA );
|
load_file = GetTSFunctionPointer( LoadFileW );
|
||||||
exec = GetTSFunctionPointer( ExecuteWithTitanMistA );
|
exec = GetTSFunctionPointer( ExecuteWithTitanMistW );
|
||||||
set_log_callback = GetTSFunctionPointer( SetLogCallback );
|
set_log_callback = GetTSFunctionPointer( SetLogCallback );
|
||||||
set_log_callback(&AddLogMessage);
|
set_log_callback(&AddLogMessage);
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +214,7 @@ static bool GetFileDialog(TCHAR Buffer[MAX_PATH])
|
||||||
static void AddLogMessage(const char* szLogMessage, eLogType Type)
|
static void AddLogMessage(const char* szLogMessage, eLogType Type)
|
||||||
{
|
{
|
||||||
TCHAR buf[MAX_LOG_LINE_LENGTH] = {0};
|
TCHAR buf[MAX_LOG_LINE_LENGTH] = {0};
|
||||||
mbstowcs(buf, szLogMessage, sizeof(buf));
|
mbstowcs(buf, szLogMessage, _countof(buf));
|
||||||
LRESULT cSelect = SendMessage(hLogBox, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)buf);
|
LRESULT cSelect = SendMessage(hLogBox, LB_INSERTSTRING, (WPARAM)-1, (LPARAM)buf);
|
||||||
SendMessage(hLogBox, LB_SETCURSEL, cSelect, NULL);
|
SendMessage(hLogBox, LB_SETCURSEL, cSelect, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -251,17 +251,14 @@ static void CreateDummyUnicodeFile(const TCHAR* szFileName)
|
||||||
|
|
||||||
static DWORD WINAPI TitanScriptExecThread(LPVOID lpParam)
|
static DWORD WINAPI TitanScriptExecThread(LPVOID lpParam)
|
||||||
{
|
{
|
||||||
char buf[MAX_PATH] = {0};
|
if(!load_file(FileNameScript))
|
||||||
wcstombs(buf, FileNameScript, sizeof(buf));
|
|
||||||
if(!load_file(buf))
|
|
||||||
{
|
{
|
||||||
AddLogMessage("Script failed to load", TS_LOG_ERROR);
|
AddLogMessage("Script failed to load", TS_LOG_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
SetWindowText(hRunBtn, _T("Stop"));
|
SetWindowText(hRunBtn, _T("Stop"));
|
||||||
bRunning = true;
|
bRunning = true;
|
||||||
wcstombs(buf, FileNameTarget, sizeof(buf));
|
if(!exec(FileNameTarget, L"")) //TitanScript will generate the output filename
|
||||||
if(!exec(buf, "")) //TitanScript will generate the output filename
|
|
||||||
{
|
{
|
||||||
AddLogMessage("Failed to execute", TS_LOG_ERROR);
|
AddLogMessage("Failed to execute", TS_LOG_ERROR);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#include "targetver.h"
|
#include "targetver.h"
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue