mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed incorrect "\r\r\n" being printed in sfall-log.txt.
Simplified Jet Antidote fix. Unified the wording of some log entries. Changed sprintf to _snprintf_s for SimplePatch.
This commit is contained in:
+1
-1
@@ -111,6 +111,6 @@ void BooksInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MakeCall(0x49B9FB, &obj_use_book_hook, true);
|
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
@@ -590,13 +590,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() {
|
static void __declspec(naked) op_wield_obj_critter_adjust_ac_hook() {
|
||||||
__asm {
|
__asm {
|
||||||
call adjust_ac_
|
call adjust_ac_
|
||||||
@@ -1176,7 +1169,7 @@ void BugsInit()
|
|||||||
//if (GetPrivateProfileIntA("Misc", "JetAntidoteFix", 1, ini)) {
|
//if (GetPrivateProfileIntA("Misc", "JetAntidoteFix", 1, ini)) {
|
||||||
dlog("Applying Jet Antidote fix.", DL_INIT);
|
dlog("Applying Jet Antidote fix.", DL_INIT);
|
||||||
// the original jet antidote fix
|
// the original jet antidote fix
|
||||||
MakeCall(0x47A013, &item_d_take_drug_hack1, true);
|
MakeCall(0x47A013, (void*)0x47A168, true);
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -133,7 +133,7 @@ void CritLoad() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dlogr("Completed critical hit table", DL_CRITICALS);
|
dlogr("Completed critical hit table.", DL_CRITICALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SetEntry(a,b,c,d,e) defaultTable[a*9*6 + b*6 + c].values[d]=e;
|
#define SetEntry(a,b,c,d,e) defaultTable[a*9*6 + b*6 + c].values[d]=e;
|
||||||
@@ -143,12 +143,11 @@ void CritInit() {
|
|||||||
|
|
||||||
if(!mode) return;
|
if(!mode) return;
|
||||||
|
|
||||||
dlog("Initilizing critical table override.", DL_INIT);
|
dlog("Initializing critical table override.", DL_INIT);
|
||||||
critTable=new CritStruct[CritTableSize];
|
critTable=new CritStruct[CritTableSize];
|
||||||
playerCrit=&critTable[6*9*38];
|
playerCrit=&critTable[6*9*38];
|
||||||
SafeWrite32(0x423F96, (DWORD)playerCrit);
|
SafeWrite32(0x423F96, (DWORD)playerCrit);
|
||||||
SafeWrite32(0x423FB3, (DWORD)critTable);
|
SafeWrite32(0x423FB3, (DWORD)critTable);
|
||||||
dlog(". ", DL_INIT);
|
|
||||||
|
|
||||||
if(mode==2 || mode==3) {
|
if(mode==2 || mode==3) {
|
||||||
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
|
CritStruct* defaultTable=(CritStruct*)_crit_succ_eff;
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ void ExplosionLightingInit() {
|
|||||||
MakeCall(0x411AB4, &explosion_effect_hook, true); // required for explosions_metarule
|
MakeCall(0x411AB4, &explosion_effect_hook, true); // required for explosions_metarule
|
||||||
|
|
||||||
if (GetPrivateProfileIntA("Misc", "ExplosionsEmitLight", 0, ini)) {
|
if (GetPrivateProfileIntA("Misc", "ExplosionsEmitLight", 0, ini)) {
|
||||||
dlog("Initing Explosion changes.", DL_INIT);
|
dlog("Applying Explosion changes.", DL_INIT);
|
||||||
lightingEnabled = true;
|
lightingEnabled = true;
|
||||||
MakeCall(0x4118E1, &ranged_attack_lighting_fix, true);
|
MakeCall(0x4118E1, &ranged_attack_lighting_fix, true);
|
||||||
MakeCall(0x410A4A, &fire_dance_lighting_fix1, true);
|
MakeCall(0x410A4A, &fire_dance_lighting_fix1, true);
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ static void _stdcall RunSpecificHookScript(sHookScript *hook) {
|
|||||||
|
|
||||||
static void _stdcall RunHookScript(DWORD hook) {
|
static void _stdcall RunHookScript(DWORD hook) {
|
||||||
if (hooks[hook].size()) {
|
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;
|
cRet=0;
|
||||||
for(int i=hooks[hook].size()-1;i>=0;i--) RunSpecificHookScript(&hooks[hook][i]);
|
for(int i=hooks[hook].size()-1;i>=0;i--) RunSpecificHookScript(&hooks[hook][i]);
|
||||||
} else {
|
} else {
|
||||||
@@ -1106,7 +1106,7 @@ void _stdcall RegisterHook( DWORD script, DWORD id, DWORD procNum )
|
|||||||
}
|
}
|
||||||
sScriptProgram *prog = GetGlobalScriptProgram(script);
|
sScriptProgram *prog = GetGlobalScriptProgram(script);
|
||||||
if (prog) {
|
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);
|
||||||
sHookScript hook;
|
sHookScript hook;
|
||||||
hook.prog = *prog;
|
hook.prog = *prog;
|
||||||
hook.callback = procNum;
|
hook.callback = procNum;
|
||||||
@@ -1308,7 +1308,7 @@ static void HookScriptInit2() {
|
|||||||
call db_free_file_list_
|
call db_free_file_list_
|
||||||
}
|
}
|
||||||
|
|
||||||
dlogr("Finished loading hook scripts", DL_HOOK|DL_INIT);
|
dlogr("Finished loading hook scripts.", DL_HOOK|DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HookScriptClear() {
|
void HookScriptClear() {
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ static void _stdcall SaveGame2() {
|
|||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
GetSavePath(buf, "gv");
|
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;
|
DWORD size, unused = 0;
|
||||||
HANDLE h = CreateFileA(buf, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
|
HANDLE h = CreateFileA(buf, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
|
||||||
@@ -177,7 +177,7 @@ static void _stdcall LoadGame2_Before() {
|
|||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
GetSavePath(buf, "gv");
|
GetSavePath(buf, "gv");
|
||||||
|
|
||||||
dlog_f("Loading save game: %s\r\n", DL_MAIN, buf);
|
dlog_f("Loading save game: %s\n", DL_MAIN, buf);
|
||||||
|
|
||||||
ClearGlobals();
|
ClearGlobals();
|
||||||
HANDLE h = CreateFileA(buf, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
HANDLE h = CreateFileA(buf, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ void dlog(const char* a, int type) {
|
|||||||
}
|
}
|
||||||
void dlogr(const char* a, int type) {
|
void dlogr(const char* a, int type) {
|
||||||
if (IsDebug && (type == DL_MAIN || (type & DebugTypes))) {
|
if (IsDebug && (type == DL_MAIN || (type & DebugTypes))) {
|
||||||
Log << a << "\r\n";
|
Log << a << "\n";
|
||||||
Log.flush();
|
Log.flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ void PartyControlInit() {
|
|||||||
if (strlen(ptr) > 0)
|
if (strlen(ptr) > 0)
|
||||||
Chars.push_back((WORD)strtoul(ptr, 0, 0));
|
Chars.push_back((WORD)strtoul(ptr, 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);
|
HookCall(0x46EBEE, &FidChangeHook);
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ void PartyControlInit() {
|
|||||||
HookCall(0x4124F1, &pc_flag_toggle_hook);
|
HookCall(0x4124F1, &pc_flag_toggle_hook);
|
||||||
HookCall(0x41279A, &pc_flag_toggle_hook);
|
HookCall(0x41279A, &pc_flag_toggle_hook);
|
||||||
} else
|
} else
|
||||||
dlog(" Disabled.", DL_INIT);
|
dlogr(" Disabled.", DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall PartyControlReset() {
|
void __stdcall PartyControlReset() {
|
||||||
|
|||||||
@@ -1011,7 +1011,7 @@ static DWORD __stdcall GetGlobalExportedVarPtr(const char* name) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static DWORD __stdcall CreateGlobalExportedVar(DWORD scr, 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);
|
std::string str(name);
|
||||||
globalExportedVars[str] = sExportedVar(); // add new
|
globalExportedVars[str] = sExportedVar(); // add new
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1203,8 +1203,8 @@ void ScriptExtenderSetup() {
|
|||||||
modifiedIni = GetPrivateProfileIntA("Main", "ModifiedIni", 0, ini);
|
modifiedIni = GetPrivateProfileIntA("Main", "ModifiedIni", 0, ini);
|
||||||
|
|
||||||
dlogr("Adding additional opcodes", DL_SCRIPT);
|
dlogr("Adding additional opcodes", DL_SCRIPT);
|
||||||
if(AllowUnsafeScripting) dlogr(" Unsafe opcodes enabled", DL_SCRIPT);
|
if(AllowUnsafeScripting) dlogr(" Unsafe opcodes enabled.", DL_SCRIPT);
|
||||||
else dlogr(" Unsafe opcodes disabled", DL_SCRIPT);
|
else dlogr(" Unsafe opcodes disabled.", DL_SCRIPT);
|
||||||
|
|
||||||
arraysBehavior = GetPrivateProfileIntA("Misc", "arraysBehavior", 1, ini);
|
arraysBehavior = GetPrivateProfileIntA("Misc", "arraysBehavior", 1, ini);
|
||||||
if (arraysBehavior > 0) {
|
if (arraysBehavior > 0) {
|
||||||
@@ -1643,7 +1643,7 @@ void LoadGlobalScripts() {
|
|||||||
lea eax, filenames
|
lea eax, filenames
|
||||||
call db_free_file_list_
|
call db_free_file_list_
|
||||||
}
|
}
|
||||||
dlogr("Finished loading global scripts", DL_SCRIPT|DL_INIT);
|
dlogr("Finished loading global scripts.", DL_SCRIPT|DL_INIT);
|
||||||
//ButtonsReload();
|
//ButtonsReload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+13
-15
@@ -800,9 +800,8 @@ static void DllMain2() {
|
|||||||
DWORD tmp;
|
DWORD tmp;
|
||||||
dlogr("In DllMain2", DL_MAIN);
|
dlogr("In DllMain2", DL_MAIN);
|
||||||
|
|
||||||
dlogr("Running BugsInit.", DL_INIT);
|
dlogr("Running BugsInit().", DL_INIT);
|
||||||
BugsInit();
|
BugsInit();
|
||||||
dlogr(" Done", DL_INIT);
|
|
||||||
|
|
||||||
if (GetPrivateProfileIntA("Speed", "Enable", 0, ini)) {
|
if (GetPrivateProfileIntA("Speed", "Enable", 0, ini)) {
|
||||||
dlog("Applying speed patch.", DL_INIT);
|
dlog("Applying speed patch.", DL_INIT);
|
||||||
@@ -1047,8 +1046,10 @@ static void DllMain2() {
|
|||||||
dlog(".", DL_INIT);
|
dlog(".", DL_INIT);
|
||||||
SkillsInit();
|
SkillsInit();
|
||||||
dlog(".", DL_INIT);
|
dlog(".", DL_INIT);
|
||||||
|
dlogr(" Done", DL_INIT);
|
||||||
|
|
||||||
//Ray's combat_p_proc fix
|
//Ray's combat_p_proc fix
|
||||||
|
dlog("Applying combat_p_proc fix.", DL_INIT);
|
||||||
SafeWrite32(0x0425253, ((DWORD)&Combat_p_procFix) - 0x0425257);
|
SafeWrite32(0x0425253, ((DWORD)&Combat_p_procFix) - 0x0425257);
|
||||||
SafeWrite8(0x0424dbc, 0xE9);
|
SafeWrite8(0x0424dbc, 0xE9);
|
||||||
SafeWrite32(0x0424dbd, 0x00000034);
|
SafeWrite32(0x0424dbd, 0x00000034);
|
||||||
@@ -1057,7 +1058,6 @@ static void DllMain2() {
|
|||||||
|
|
||||||
//if (GetPrivateProfileIntA("Misc", "WorldMapCitiesListFix", 0, ini)) {
|
//if (GetPrivateProfileIntA("Misc", "WorldMapCitiesListFix", 0, ini)) {
|
||||||
dlog("Applying world map cities list patch.", DL_INIT);
|
dlog("Applying world map cities list patch.", DL_INIT);
|
||||||
|
|
||||||
SafeWrite32(0x004C04BA, ((DWORD)&ScrollCityListHook) - 0x004C04BE);
|
SafeWrite32(0x004C04BA, ((DWORD)&ScrollCityListHook) - 0x004C04BE);
|
||||||
SafeWrite32(0x004C04C9, ((DWORD)&ScrollCityListHook) - 0x004C04CD);
|
SafeWrite32(0x004C04C9, ((DWORD)&ScrollCityListHook) - 0x004C04CD);
|
||||||
SafeWrite32(0x004C4A35, ((DWORD)&ScrollCityListHook) - 0x004C4A39);
|
SafeWrite32(0x004C4A35, ((DWORD)&ScrollCityListHook) - 0x004C4A39);
|
||||||
@@ -1146,7 +1146,7 @@ static void DllMain2() {
|
|||||||
|
|
||||||
npcautolevel = GetPrivateProfileIntA("Misc", "NPCAutoLevel", 0, ini) != 0;
|
npcautolevel = GetPrivateProfileIntA("Misc", "NPCAutoLevel", 0, ini) != 0;
|
||||||
if (npcautolevel) {
|
if (npcautolevel) {
|
||||||
dlog("Applying npc autolevel patch.", DL_INIT);
|
dlog("Applying NPC autolevel patch.", DL_INIT);
|
||||||
SafeWrite8(0x495CFB, 0xEB); // jmps 0x495D28 (skip random check)
|
SafeWrite8(0x495CFB, 0xEB); // jmps 0x495D28 (skip random check)
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
}
|
||||||
@@ -1288,17 +1288,18 @@ static void DllMain2() {
|
|||||||
dlogr("Running TilesInit().", DL_INIT);
|
dlogr("Running TilesInit().", DL_INIT);
|
||||||
TilesInit();
|
TilesInit();
|
||||||
|
|
||||||
dlogr("Applying main menu text patch", DL_INIT);
|
dlogr("Running CreditsInit().", DL_INIT);
|
||||||
CreditsInit();
|
CreditsInit();
|
||||||
|
|
||||||
if (GetPrivateProfileIntA("Misc", "UseScrollingQuestsList", 0, ini)) {
|
if (GetPrivateProfileIntA("Misc", "UseScrollingQuestsList", 0, ini)) {
|
||||||
dlog("Applying quests list patch ", DL_INIT);
|
dlog("Applying quests list patch.", DL_INIT);
|
||||||
QuestListInit();
|
QuestListInit();
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
dlog("Applying premade characters patch", DL_INIT);
|
dlog("Applying premade characters patch.", DL_INIT);
|
||||||
PremadeInit();
|
PremadeInit();
|
||||||
|
dlogr(" Done", DL_INIT);
|
||||||
|
|
||||||
dlogr("Running SoundInit().", DL_INIT);
|
dlogr("Running SoundInit().", DL_INIT);
|
||||||
SoundInit();
|
SoundInit();
|
||||||
@@ -1310,9 +1311,8 @@ static void DllMain2() {
|
|||||||
ConsoleInit();
|
ConsoleInit();
|
||||||
|
|
||||||
if (GetPrivateProfileIntA("Misc", "ExtraSaveSlots", 0, ini)) {
|
if (GetPrivateProfileIntA("Misc", "ExtraSaveSlots", 0, ini)) {
|
||||||
dlog("Running EnableSuperSaving()", DL_INIT);
|
dlogr("Running EnableSuperSaving().", DL_INIT);
|
||||||
EnableSuperSaving();
|
EnableSuperSaving();
|
||||||
dlogr(" Done", DL_INIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (GetPrivateProfileIntA("Misc", "SpeedInterfaceCounterAnims", 0, ini)) {
|
switch (GetPrivateProfileIntA("Misc", "SpeedInterfaceCounterAnims", 0, ini)) {
|
||||||
@@ -1440,9 +1440,8 @@ static void DllMain2() {
|
|||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
dlog("Running InventoryInit.", DL_INIT);
|
dlogr("Running InventoryInit().", DL_INIT);
|
||||||
InventoryInit();
|
InventoryInit();
|
||||||
dlogr(" Done", DL_INIT);
|
|
||||||
|
|
||||||
if (tmp = GetPrivateProfileIntA("Misc", "MotionScannerFlags", 1, ini)) {
|
if (tmp = GetPrivateProfileIntA("Misc", "MotionScannerFlags", 1, ini)) {
|
||||||
dlog("Applying MotionScannerFlags patch.", DL_INIT);
|
dlog("Applying MotionScannerFlags patch.", DL_INIT);
|
||||||
@@ -1468,7 +1467,7 @@ static void DllMain2() {
|
|||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
dlog("Initing main menu patches.", DL_INIT);
|
dlog("Applying main menu patches.", DL_INIT);
|
||||||
MainMenuInit();
|
MainMenuInit();
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
|
|
||||||
@@ -1476,13 +1475,12 @@ static void DllMain2() {
|
|||||||
SafeWrite8(0x499518, 0xc3);
|
SafeWrite8(0x499518, 0xc3);
|
||||||
}
|
}
|
||||||
|
|
||||||
dlog("Initing AI patches.", DL_INIT);
|
dlog("Applying AI patches.", DL_INIT);
|
||||||
AIInit();
|
AIInit();
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
|
|
||||||
dlog("Initing AI control.", DL_INIT);
|
dlogr("Initializing AI control.", DL_INIT);
|
||||||
PartyControlInit();
|
PartyControlInit();
|
||||||
dlogr(" Done", DL_INIT);
|
|
||||||
|
|
||||||
//HookCall(0x413105, explosion_crash_fix_hook);//test for explosives
|
//HookCall(0x413105, explosion_crash_fix_hook);//test for explosives
|
||||||
//SafeWrite32(0x413034, (DWORD)&explosion_crash_fix_hook);
|
//SafeWrite32(0x413034, (DWORD)&explosion_crash_fix_hook);
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ T SimplePatch(DWORD *addrs, int numAddrs, const char* iniSection, const char* in
|
|||||||
value = minValue;
|
value = minValue;
|
||||||
else if (value > maxValue)
|
else if (value > maxValue)
|
||||||
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);
|
dlog((const char *)msg, DL_INIT);
|
||||||
for (int i=0; i<numAddrs; i++)
|
for (int i=0; i<numAddrs; i++)
|
||||||
SafeWrite<T>(addrs[i], (T)value);
|
SafeWrite<T>(addrs[i], (T)value);
|
||||||
|
|||||||
Reference in New Issue
Block a user