Merge branch 'develop' of https://github.com/phobos2077/sfall into develop

This commit is contained in:
phobos2077
2017-03-18 20:26:11 +07:00
12 changed files with 22 additions and 29 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ void dlog(const std::string& a, int type) {
}
void dlogr(const std::string& a, int type) {
if (isDebug && (type == DL_MAIN || (type & DebugTypes))) {
Log << a << "\r\n";
Log << a << "\n";
Log.flush();
}
}
@@ -49,7 +49,7 @@ void dlog_f(const char *fmt, int type, ...) {
va_list args;
va_start(args, type);
char buf[4096];
vsnprintf_s(buf, sizeof buf, _TRUNCATE, fmt, args);
vsnprintf_s(buf, sizeof(buf), _TRUNCATE, fmt, args);
Log << buf;
Log.flush();
va_end(args);
+1 -1
View File
@@ -18,7 +18,7 @@ ModuleManager::~ModuleManager() {
void ModuleManager::initAll() {
for (auto it = _modules.cbegin(); it != _modules.cend(); it++) {
dlog_f("Initializing module %s...\r\n", DL_INIT, (*it)->name());
dlog_f("Initializing module %s...\n", DL_INIT, (*it)->name());
(*it)->init();
}
}
+1 -1
View File
@@ -114,7 +114,7 @@ void Books::init() {
}
MakeCall(0x49B9FB, &obj_use_book_hook, true);
dlog_f(" (%d/%d books) Done\r\n", DL_INIT, n, count);
dlog_f(" (%d/%d books) Done\n", DL_INIT, n, count);
}
}
+1 -8
View File
@@ -592,13 +592,6 @@ end:
}
}
static void __declspec(naked) item_d_take_drug_hack1() {
__asm {
push 0x47A168
retn
}
}
static void __declspec(naked) op_wield_obj_critter_adjust_ac_hook() {
__asm {
call fo::funcoffs::adjust_ac_
@@ -1155,7 +1148,7 @@ void BugFixes::init()
//if (GetConfigInt("Misc", "JetAntidoteFix", 1)) {
dlog("Applying Jet Antidote fix.", DL_INIT);
// the original jet antidote fix
MakeCall(0x47A013, &item_d_take_drug_hack1, true);
MakeCall(0x47A013, (void*)0x47A168, true);
dlogr(" Done", DL_INIT);
//}
+2 -2
View File
@@ -128,11 +128,11 @@ void CritLoad() {
}
#define SetEntry(a,b,c,d,e) fo::var::crit_succ_eff[a][b][c].values[d] = e;
void CriticalTableOverride() {dlog("Initilizing critical table override.", DL_INIT);
void CriticalTableOverride() {
dlog("Initializing critical table override.", DL_INIT);
playerCrit = &critTable[38];
SafeWrite32(0x423F96, (DWORD)playerCrit);
SafeWrite32(0x423FB3, (DWORD)critTable);
dlog(". ", DL_INIT);
if (mode == 2 || mode == 3) {
SetEntry(2, 4, 1, 4, 0);
+2 -2
View File
@@ -98,7 +98,7 @@ static void _stdcall RunSpecificHookScript(HookScript *hook) {
static void _stdcall RunHookScript(DWORD hook) {
if (hooks[hook].size()) {
dlog_f("Running hook %d, which has %0d entries attached\r\n", DL_HOOK, hook, hooks[hook].size());
dlog_f("Running hook %d, which has %0d entries attached\n", DL_HOOK, hook, hooks[hook].size());
cRet = 0;
for (int i = hooks[hook].size() - 1; i >= 0; i--) {
RunSpecificHookScript(&hooks[hook][i]);
@@ -1130,7 +1130,7 @@ void _stdcall RegisterHook(fo::Program* script, int id, int procNum) {
}
ScriptProgram *prog = GetGlobalScriptProgram(script);
if (prog) {
dlog_f("Global script %08x registered as hook id %d\r\n", DL_HOOK, script, id);
dlog_f("Global script %08x registered as hook id %d\n", DL_HOOK, script, id);
HookScript hook;
hook.prog = *prog;
hook.callback = procNum;
+2 -2
View File
@@ -80,7 +80,7 @@ static void _stdcall SaveGame2() {
char buf[MAX_PATH];
GetSavePath(buf, "gv");
dlog_f("Saving game: %s\r\n", DL_MAIN, buf);
dlog_f("Saving game: %s\n", DL_MAIN, buf);
DWORD size, unused = 0;
HANDLE h = CreateFileA(buf, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
@@ -157,7 +157,7 @@ static void _stdcall LoadGame_Before() {
char buf[MAX_PATH];
GetSavePath(buf, "gv");
dlog_f("Loading save game: %s\r\n", DL_MAIN, buf);
dlog_f("Loading save game: %s\n", DL_MAIN, buf);
HANDLE h = CreateFileA(buf, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (h != INVALID_HANDLE_VALUE) {
+6 -6
View File
@@ -397,7 +397,7 @@ void DebugModePatch() {
void NpcAutoLevelPatch() {
npcAutoLevelEnabled = GetConfigInt("Misc", "NPCAutoLevel", 0) != 0;
if (npcAutoLevelEnabled) {
dlog("Applying npc autolevel patch.", DL_INIT);
dlog("Applying NPC autolevel patch.", DL_INIT);
SafeWrite16(0x00495D22, 0x9090);
SafeWrite32(0x00495D24, 0x90909090);
dlogr(" Done", DL_INIT);
@@ -555,11 +555,11 @@ void InstantWeaponEquipPatch() {
void CombatProcFix() {
//Ray's combat_p_proc fix
SafeWrite32(0x0425253, ((DWORD)&Combat_p_procFix) - 0x0425257);
SafeWrite8(0x0424dbc, 0xE9);
SafeWrite32(0x0424dbd, 0x00000034);
dlogr(" Done", DL_INIT);
//}
dlog("Applying combat_p_proc fix.", DL_INIT);
SafeWrite32(0x0425253, ((DWORD)&Combat_p_procFix) - 0x0425257);
SafeWrite8(0x0424dbc, 0xE9);
SafeWrite32(0x0424dbd, 0x00000034);
dlogr(" Done", DL_INIT);
}
void MultiPatchesPatch() {
+2 -2
View File
@@ -363,7 +363,7 @@ void PartyControl::init() {
Chars.push_back(static_cast<WORD>(strtoul(pid.c_str(), 0, 0)));
}
}
dlog_f(" Mode %d, Chars read: %d.", DL_INIT, Mode, Chars.size());
dlog_f(" Mode %d, Chars read: %d.\n", DL_INIT, Mode, Chars.size());
HookCall(0x46EBEE, &FidChangeHook);
@@ -377,7 +377,7 @@ void PartyControl::init() {
LoadGameHook::OnGameReset() += PartyControlReset;
} else {
dlog(" Disabled.", DL_INIT);
dlogr(" Disabled.", DL_INIT);
}
}
+1 -1
View File
@@ -193,7 +193,7 @@ static DWORD __stdcall GetGlobalExportedVarPtr(const char* name) {
}
static DWORD __stdcall CreateGlobalExportedVar(DWORD scr, const char* name) {
//dlog_f("\nTrying to export variable %s (%d)\r\n", DL_MAIN, name, isGlobalScriptLoading);
//dlog_f("\nTrying to export variable %s (%d)\n", DL_MAIN, name, isGlobalScriptLoading);
std::string str(name);
globalExportedVars[str] = ExportedVar(); // add new
return 1;
+1 -1
View File
@@ -86,7 +86,7 @@ void OpcodeContext::printOpcodeError(const char* fmt, ...) const {
va_list args;
va_start(args, fmt);
char msg[1024];
vsnprintf_s(msg, sizeof msg, _TRUNCATE, fmt, args);
vsnprintf_s(msg, sizeof(msg), _TRUNCATE, fmt, args);
va_end(args);
const char* procName = fo::func::findCurrentProc(_program);
+1 -1
View File
@@ -20,7 +20,7 @@ T SimplePatch(DWORD *addrs, int numAddrs, const char* iniSection, const char* in
value = minValue;
else if (value > maxValue)
value = maxValue;
sprintf(msg, "Applying patch: %s = %d.", iniKey, value);
_snprintf_s(msg, sizeof(msg), _TRUNCATE, "Applying patch: %s = %d.", iniKey, value);
dlog((const char *)msg, DL_INIT);
for (int i=0; i<numAddrs; i++)
SafeWrite<T>(addrs[i], (T)value);