mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Replaced all direct references to ini and translationIni with GetConfig*()
This commit is contained in:
@@ -302,6 +302,12 @@ struct sPath {
|
||||
sPath* next;
|
||||
};
|
||||
|
||||
struct PremadeChar {
|
||||
char path[20];
|
||||
DWORD fid;
|
||||
char unknown[20];
|
||||
};
|
||||
|
||||
struct sProtoBase {
|
||||
long pid;
|
||||
long message_num;
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Wrappers.h"
|
||||
|
||||
//
|
||||
// Various utility functions, based on FO engine functions
|
||||
//
|
||||
@@ -24,6 +28,10 @@
|
||||
// returns weapon animation code
|
||||
char AnimCodeByWeapon(TGameObj* weapon);
|
||||
|
||||
inline void DisplayPrint(const std::string& str) {
|
||||
Wrapper::display_print(str.c_str());
|
||||
}
|
||||
|
||||
// returns message string from given file
|
||||
const char* _stdcall GetMessageStr(const MessageList* fileAddr, int messageId);
|
||||
|
||||
@@ -36,4 +44,4 @@ sProtoItem* GetItemProto(int pid);
|
||||
void SkillGetTags(int* result, long num);
|
||||
|
||||
// wrapper for skill_set_tags with bounds checking
|
||||
void SkillSetTags(int* tags, long num);
|
||||
void SkillSetTags(int* tags, long num);
|
||||
|
||||
@@ -29,6 +29,9 @@ typedef std::unordered_map<DWORD, DWORD> :: const_iterator iter;
|
||||
static std::unordered_map<DWORD,DWORD> targets;
|
||||
static std::unordered_map<DWORD,DWORD> sources;
|
||||
|
||||
static DWORD combatDisabled;
|
||||
static std::string combatBlockedMessage;
|
||||
|
||||
DWORD _stdcall AIGetLastAttacker(DWORD target) {
|
||||
iter itr=sources.find(target);
|
||||
if(itr==sources.end()) return 0;
|
||||
@@ -57,18 +60,15 @@ static void __declspec(naked) combat_attack_hook() {
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD CombatDisabled;
|
||||
static char CombatBlockedMessage[128];
|
||||
|
||||
static void _stdcall CombatBlocked() {
|
||||
Wrapper::display_print(CombatBlockedMessage);
|
||||
Wrapper::display_print(combatBlockedMessage.c_str());
|
||||
}
|
||||
|
||||
static const DWORD BlockCombatHook1Ret1=0x45F6B4;
|
||||
static const DWORD BlockCombatHook1Ret2=0x45F6D7;
|
||||
static void __declspec(naked) BlockCombatHook1() {
|
||||
__asm {
|
||||
mov eax, CombatDisabled;
|
||||
mov eax, combatDisabled;
|
||||
test eax, eax;
|
||||
jz end;
|
||||
call CombatBlocked;
|
||||
@@ -84,7 +84,7 @@ static void __declspec(naked) BlockCombatHook2() {
|
||||
mov eax, dword ptr ds:[VARPTR_intfaceEnabled];
|
||||
test eax, eax;
|
||||
jz end;
|
||||
mov eax, CombatDisabled;
|
||||
mov eax, combatDisabled;
|
||||
test eax, eax;
|
||||
jz succeed;
|
||||
pushad;
|
||||
@@ -100,8 +100,7 @@ end:
|
||||
}
|
||||
|
||||
void _stdcall AIBlockCombat(DWORD i) {
|
||||
if(i) CombatDisabled=1;
|
||||
else CombatDisabled=0;
|
||||
combatDisabled = i ? 1 : 0;
|
||||
}
|
||||
|
||||
void AI::init() {
|
||||
@@ -111,7 +110,7 @@ void AI::init() {
|
||||
HookCall(0x42A796, combat_attack_hook);
|
||||
MakeCall(0x45F6AF, BlockCombatHook1, true);
|
||||
HookCall(0x4432A6, BlockCombatHook2);
|
||||
GetPrivateProfileString("sfall", "BlockedCombat", "You cannot enter combat at this time.", CombatBlockedMessage, 128, translationIni);
|
||||
combatBlockedMessage = Translate("sfall", "BlockedCombat", "You cannot enter combat at this time.");
|
||||
}
|
||||
|
||||
void _stdcall AICombatStart() {
|
||||
|
||||
@@ -78,11 +78,10 @@ void BarBoxes::init() {
|
||||
SafeWrite8(0x461495, 0x78);
|
||||
|
||||
MakeCall(0x4615A3, &DisplayBoxesHook, true);
|
||||
char buf[6];
|
||||
GetPrivateProfileString("Misc", "BoxBarColours", "", buf, 6, ini);
|
||||
if (strlen(buf) == 5) {
|
||||
auto boxBarColors = GetConfigString("Misc", "BoxBarColours", "", 6);
|
||||
if (boxBarColors.size() == 5) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (buf[i] == '1') {
|
||||
if (boxBarColors[i] == '1') {
|
||||
boxes[i + 5].colour = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,10 +85,9 @@ void LoadVanillaBooks() {
|
||||
}
|
||||
|
||||
void Books::init() {
|
||||
char buf[MAX_PATH - 3];
|
||||
GetPrivateProfileString("Misc", "BooksFile", "", buf, MAX_PATH, ini);
|
||||
if (strlen(buf) > 0) {
|
||||
sprintf(iniBooks, ".\\%s", buf);
|
||||
auto booksFile = GetConfigString("Misc", "BooksFile", "", MAX_PATH);
|
||||
if (booksFile.size() > 0) {
|
||||
sprintf(iniBooks, ".\\%s", booksFile.c_str());
|
||||
dlog("Applying books patch... ", DL_INIT);
|
||||
memset(books, 0, sizeof(sBook)*BooksCount);
|
||||
|
||||
|
||||
+12
-9
@@ -16,12 +16,15 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "..\main.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\Version.h"
|
||||
#include "..\Logging.h"
|
||||
|
||||
#include "CRC.h"
|
||||
|
||||
static const DWORD ExpectedSize=0x00122800;
|
||||
static const DWORD ExpectedCRC[]= {0xe1680293, 0xef34f989};
|
||||
|
||||
@@ -91,13 +94,13 @@ void CRC(const char* filepath) {
|
||||
|
||||
bool matchedCRC = false;
|
||||
|
||||
if (isDebug && GetPrivateProfileStringA("Debugging", "ExtraCRC", "", buf, 512, ddrawIni) > 0) {
|
||||
char *TestCRC;
|
||||
TestCRC = strtok(buf, ",");
|
||||
while (TestCRC) {
|
||||
DWORD extraCRC = strtoul(TestCRC, 0, 16);
|
||||
if (crc == extraCRC) matchedCRC = true;
|
||||
TestCRC = strtok(0, ",");
|
||||
if (isDebug) {
|
||||
auto extraCrcList = GetIniList("Debugging", "ExtraCRC", "", 512, ',', ddrawIni);
|
||||
if (extraCrcList.size() > 0) {
|
||||
matchedCRC = std::any_of(extraCrcList.begin(), extraCrcList.end(), [crc](const std::string& testCrcStr) {
|
||||
auto testedCrc = strtoul(testCrcStr.c_str(), 0, 16);
|
||||
return testedCrc && crc == testedCrc;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ static void __declspec(naked) ConsoleHook() {
|
||||
}
|
||||
|
||||
void Console::init() {
|
||||
char path[MAX_PATH];
|
||||
GetPrivateProfileString("Misc", "ConsoleOutputPath", "", path, MAX_PATH, ini);
|
||||
if (strlen(path) > 0) {
|
||||
auto path = GetConfigString("Misc", "ConsoleOutputPath", "", MAX_PATH);
|
||||
if (path.size() > 0) {
|
||||
consolefile.open(path);
|
||||
if (consolefile.is_open()) {
|
||||
MakeCall(0x43186C, &ConsoleHook, true);
|
||||
|
||||
+21
-22
@@ -22,7 +22,7 @@
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
|
||||
static const int ElevatorCount = 50;
|
||||
static char File[MAX_PATH];
|
||||
static char elevFile[MAX_PATH];
|
||||
|
||||
|
||||
static sElevator Elevators[ElevatorCount];
|
||||
@@ -105,29 +105,29 @@ void ResetElevators() {
|
||||
for (int i = 0; i < 24; i++) Menus[i] = i;
|
||||
for (int i = 24; i < ElevatorCount; i++) Menus[i] = 0;
|
||||
char section[4];
|
||||
if (File) {
|
||||
if (elevFile) {
|
||||
for (int i = 0; i < ElevatorCount; i++) {
|
||||
_itoa_s(i, section, 10);
|
||||
Menus[i] = GetPrivateProfileIntA(section, "Image", Menus[i], File);
|
||||
Elevators[i].ID1 = GetPrivateProfileIntA(section, "ID1", Elevators[i].ID1, File);
|
||||
Elevators[i].ID2 = GetPrivateProfileIntA(section, "ID2", Elevators[i].ID2, File);
|
||||
Elevators[i].ID3 = GetPrivateProfileIntA(section, "ID3", Elevators[i].ID3, File);
|
||||
Elevators[i].ID4 = GetPrivateProfileIntA(section, "ID4", Elevators[i].ID4, File);
|
||||
Elevators[i].Elevation1 = GetPrivateProfileIntA(section, "Elevation1", Elevators[i].Elevation1, File);
|
||||
Elevators[i].Elevation2 = GetPrivateProfileIntA(section, "Elevation2", Elevators[i].Elevation2, File);
|
||||
Elevators[i].Elevation3 = GetPrivateProfileIntA(section, "Elevation3", Elevators[i].Elevation3, File);
|
||||
Elevators[i].Elevation4 = GetPrivateProfileIntA(section, "Elevation4", Elevators[i].Elevation4, File);
|
||||
Elevators[i].Tile1 = GetPrivateProfileIntA(section, "Tile1", Elevators[i].Tile1, File);
|
||||
Elevators[i].Tile2 = GetPrivateProfileIntA(section, "Tile2", Elevators[i].Tile2, File);
|
||||
Elevators[i].Tile3 = GetPrivateProfileIntA(section, "Tile3", Elevators[i].Tile3, File);
|
||||
Elevators[i].Tile4 = GetPrivateProfileIntA(section, "Tile4", Elevators[i].Tile4, File);
|
||||
Menus[i] = GetPrivateProfileIntA(section, "Image", Menus[i], elevFile);
|
||||
Elevators[i].ID1 = GetPrivateProfileIntA(section, "ID1", Elevators[i].ID1, elevFile);
|
||||
Elevators[i].ID2 = GetPrivateProfileIntA(section, "ID2", Elevators[i].ID2, elevFile);
|
||||
Elevators[i].ID3 = GetPrivateProfileIntA(section, "ID3", Elevators[i].ID3, elevFile);
|
||||
Elevators[i].ID4 = GetPrivateProfileIntA(section, "ID4", Elevators[i].ID4, elevFile);
|
||||
Elevators[i].Elevation1 = GetPrivateProfileIntA(section, "Elevation1", Elevators[i].Elevation1, elevFile);
|
||||
Elevators[i].Elevation2 = GetPrivateProfileIntA(section, "Elevation2", Elevators[i].Elevation2, elevFile);
|
||||
Elevators[i].Elevation3 = GetPrivateProfileIntA(section, "Elevation3", Elevators[i].Elevation3, elevFile);
|
||||
Elevators[i].Elevation4 = GetPrivateProfileIntA(section, "Elevation4", Elevators[i].Elevation4, elevFile);
|
||||
Elevators[i].Tile1 = GetPrivateProfileIntA(section, "Tile1", Elevators[i].Tile1, elevFile);
|
||||
Elevators[i].Tile2 = GetPrivateProfileIntA(section, "Tile2", Elevators[i].Tile2, elevFile);
|
||||
Elevators[i].Tile3 = GetPrivateProfileIntA(section, "Tile3", Elevators[i].Tile3, elevFile);
|
||||
Elevators[i].Tile4 = GetPrivateProfileIntA(section, "Tile4", Elevators[i].Tile4, elevFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ElevatorsInit(char* file) {
|
||||
strcpy_s(File, ".\\");
|
||||
strcat_s(File, file);
|
||||
void ElevatorsInit(const char* file) {
|
||||
strcpy_s(elevFile, ".\\");
|
||||
strcat_s(elevFile, file);
|
||||
HookCall(0x43EF83, GetMenuHook);
|
||||
HookCall(0x43F141, UnknownHook);
|
||||
HookCall(0x43F2D2, UnknownHook2);
|
||||
@@ -149,10 +149,9 @@ void ElevatorsInit(char* file) {
|
||||
}
|
||||
|
||||
void Elevators::init() {
|
||||
char elevPath[MAX_PATH];
|
||||
GetPrivateProfileString("Misc", "ElevatorsFile", "", elevPath, MAX_PATH, ini);
|
||||
if (strlen(elevPath) > 0) {
|
||||
auto elevPath = GetConfigString("Misc", "ElevatorsFile", "", MAX_PATH);
|
||||
if (elevPath.size() > 0) {
|
||||
dlogr("Applying elevator patch.", DL_INIT);
|
||||
ElevatorsInit(elevPath);
|
||||
ElevatorsInit(elevPath.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1603,11 +1603,14 @@ void _stdcall HeroSelectWindow(int RaceStyleFlag) {
|
||||
SetFont(0x67);
|
||||
BYTE textColour = *(BYTE*)0x6A82F3; //PeanutButter colour -palette offset stored in mem
|
||||
|
||||
char titleText[8];
|
||||
char titleText[16];
|
||||
DWORD titleTextWidth;
|
||||
//Get alternate text from ini if available
|
||||
if (isStyle) GetPrivateProfileString("AppearanceMod", "StyleText", "Style", titleText, 8, translationIni);
|
||||
else GetPrivateProfileString("AppearanceMod", "RaceText", "Race", titleText, 8, translationIni);
|
||||
if (isStyle) {
|
||||
Translate("AppearanceMod", "StyleText", "Style", titleText, 16);
|
||||
} else {
|
||||
Translate("AppearanceMod", "RaceText", "Race", titleText, 16);
|
||||
}
|
||||
|
||||
titleTextWidth = GetTextWidth(titleText);
|
||||
|
||||
@@ -2174,8 +2177,8 @@ static void __declspec(naked) FixCharScrnBack(void) {
|
||||
DWORD raceTextWidth, styleTextWidth;
|
||||
|
||||
//Get alternate text from ini if available
|
||||
GetPrivateProfileString("AppearanceMod", "RaceText", "Race", RaceText, 8, translationIni);
|
||||
GetPrivateProfileString("AppearanceMod", "StyleText", "Style", StyleText, 8, translationIni);
|
||||
Translate("AppearanceMod", "RaceText", "Race", RaceText, 8);
|
||||
Translate("AppearanceMod", "StyleText", "Style", StyleText, 8);
|
||||
|
||||
raceTextWidth=GetTextWidth(RaceText);
|
||||
styleTextWidth=GetTextWidth(StyleText);
|
||||
|
||||
@@ -391,7 +391,7 @@ static __declspec(naked) void InvenObjExamineFuncHook() {
|
||||
}
|
||||
}
|
||||
|
||||
static char SuperStimMsg[128];
|
||||
static std::string superStimMsg;
|
||||
static int _stdcall SuperStimFix2(DWORD* item, DWORD* target) {
|
||||
if (!item || !target) return 0;
|
||||
DWORD itm_pid = item[0x64 / 4], target_pid = target[0x64 / 4];
|
||||
@@ -410,7 +410,7 @@ static int _stdcall SuperStimFix2(DWORD* item, DWORD* target) {
|
||||
mov max_hp, eax;
|
||||
}
|
||||
if (curr_hp < max_hp) return 0;
|
||||
Wrapper::display_print(SuperStimMsg);
|
||||
Wrapper::display_print(superStimMsg.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ void Inventory::init() {
|
||||
}
|
||||
|
||||
if (GetConfigInt("Misc", "SuperStimExploitFix", 0)) {
|
||||
GetPrivateProfileString("sfall", "SuperStimExploitMsg", "You cannot use a super stim on someone who is not injured!", SuperStimMsg, 128, translationIni);
|
||||
superStimMsg = Translate("sfall", "SuperStimExploitMsg", "You cannot use a super stim on someone who is not injured!");
|
||||
MakeCall(0x49C3CC, SuperStimFix, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,7 @@ void GetSavePath(char* buf, char* ftype) {
|
||||
sprintf(buf, "%s\\savegame\\slot%.2d\\sfall%s.sav", VarPtr::patches, VarPtr::slot_cursor + 1 + LSPageOffset, ftype); //add SuperSave Page offset
|
||||
}
|
||||
|
||||
static char saveSfallDataFailMsg[128];
|
||||
|
||||
static std::string saveSfallDataFailMsg;
|
||||
static void _stdcall SaveGame2() {
|
||||
char buf[MAX_PATH];
|
||||
GetSavePath(buf, "gv");
|
||||
@@ -91,7 +90,7 @@ static void _stdcall SaveGame2() {
|
||||
CloseHandle(h);
|
||||
} else {
|
||||
dlogr("ERROR creating sfallgv!", DL_MAIN);
|
||||
Wrapper::display_print(saveSfallDataFailMsg);
|
||||
DisplayPrint(saveSfallDataFailMsg);
|
||||
Wrapper::gsound_play_sfx_file("IISXXXX1");
|
||||
}
|
||||
GetSavePath(buf, "fs");
|
||||
@@ -102,18 +101,18 @@ static void _stdcall SaveGame2() {
|
||||
CloseHandle(h);
|
||||
}
|
||||
|
||||
static char saveFailMsg[128];
|
||||
static std::string saveFailMsg;
|
||||
static DWORD _stdcall CombatSaveTest() {
|
||||
if (!saveInCombatFix && !IsNpcControlled()) return 1;
|
||||
if (inLoop & COMBAT) {
|
||||
if (saveInCombatFix == 2 || IsNpcControlled() || !(inLoop & PCOMBAT)) {
|
||||
Wrapper::display_print(saveFailMsg);
|
||||
DisplayPrint(saveFailMsg);
|
||||
return 0;
|
||||
}
|
||||
int ap = Wrapper::stat_level(VarPtr::obj_dude, STAT_max_move_points);
|
||||
int bonusmove = Wrapper::perk_level(VarPtr::obj_dude, PERK_bonus_move);
|
||||
if (VarPtr::obj_dude->critterAP_weaponAmmoPid != ap || bonusmove * 2 != VarPtr::combat_free_move) {
|
||||
Wrapper::display_print(saveFailMsg);
|
||||
DisplayPrint(saveFailMsg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -404,8 +403,9 @@ static void __declspec(naked) AutomapHook() {
|
||||
void LoadGameHook::init() {
|
||||
saveInCombatFix = GetConfigInt("Misc", "SaveInCombatFix", 1);
|
||||
if (saveInCombatFix > 2) saveInCombatFix = 0;
|
||||
GetPrivateProfileString("sfall", "SaveInCombat", "Cannot save at this time", saveFailMsg, 128, translationIni);
|
||||
GetPrivateProfileString("sfall", "SaveSfallDataFail", "ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again!", saveSfallDataFailMsg, 128, translationIni);
|
||||
saveFailMsg = Translate("sfall", "SaveInCombat", "Cannot save at this time");
|
||||
saveSfallDataFailMsg = Translate("sfall", "SaveSfallDataFail",
|
||||
"ERROR saving extended savegame information! Check if other programs interfere with savegame files/folders and try again!");
|
||||
|
||||
HookCall(0x480AAE, main_load_new_hook);
|
||||
|
||||
|
||||
@@ -743,21 +743,21 @@ void DisableHorriganPatch() {
|
||||
|
||||
void MiscPatches::init() {
|
||||
mapName[64] = 0;
|
||||
if (GetPrivateProfileString("Misc", "StartingMap", "", mapName, 64, ini)) {
|
||||
if (GetConfigString("Misc", "StartingMap", "", mapName, 64)) {
|
||||
dlog("Applying starting map patch.", DL_INIT);
|
||||
SafeWrite32(0x00480AAA, (DWORD)&mapName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
versionString[64] = 0;
|
||||
if (GetPrivateProfileString("Misc", "VersionString", "", versionString, 64, ini)) {
|
||||
if (GetConfigString("Misc", "VersionString", "", versionString, 64)) {
|
||||
dlog("Applying version string patch.", DL_INIT);
|
||||
SafeWrite32(0x004B4588, (DWORD)&versionString);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
configName[64] = 0;
|
||||
if (GetPrivateProfileString("Misc", "ConfigFile", "", configName, 64, ini)) {
|
||||
if (GetConfigString("Misc", "ConfigFile", "", configName, 64)) {
|
||||
dlog("Applying config file patch.", DL_INIT);
|
||||
SafeWrite32(0x00444BA5, (DWORD)&configName);
|
||||
SafeWrite32(0x00444BCA, (DWORD)&configName);
|
||||
@@ -765,7 +765,7 @@ void MiscPatches::init() {
|
||||
}
|
||||
|
||||
patchName[64] = 0;
|
||||
if (GetPrivateProfileString("Misc", "PatchFile", "", patchName, 64, ini)) {
|
||||
if (GetConfigString("Misc", "PatchFile", "", patchName, 64)) {
|
||||
dlog("Applying patch file patch.", DL_INIT);
|
||||
SafeWrite32(0x00444323, (DWORD)&patchName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
@@ -548,9 +548,9 @@ void Movies::init() {
|
||||
strcpy_s(ininame, "Movie");
|
||||
_itoa_s(i + 1, &ininame[5], 3, 10);
|
||||
if (i < 17) {
|
||||
GetPrivateProfileString("Misc", ininame, (char*)(0x518DA0 + i * 4), &MoviePaths[i * 65], 65, ini);
|
||||
GetConfigString("Misc", ininame, (char*)(0x518DA0 + i * 4), &MoviePaths[i * 65], 65);
|
||||
} else {
|
||||
GetPrivateProfileString("Misc", ininame, "", &MoviePaths[i * 65], 65, ini);
|
||||
GetConfigString("Misc", ininame, "", &MoviePaths[i * 65], 65);
|
||||
}
|
||||
}
|
||||
dlog(".", DL_INIT);
|
||||
|
||||
@@ -30,7 +30,7 @@ static char Name[64 * PERK_count];
|
||||
static char Desc[1024 * PERK_count];
|
||||
static char tName[64 * TRAIT_count];
|
||||
static char tDesc[1024 * TRAIT_count];
|
||||
static char perksFile[260];
|
||||
static char perksFile[MAX_PATH];
|
||||
static BYTE disableTraits[TRAIT_count];
|
||||
|
||||
#define check_trait(a) !disableTraits[a] && (VarPtr::pc_trait[0] == a || VarPtr::pc_trait[1] == a)
|
||||
@@ -671,7 +671,9 @@ static void PerkSetup() {
|
||||
char num[4];
|
||||
for (int i = 0; i < PERK_count; i++) {
|
||||
_itoa_s(i, num, 10);
|
||||
if (GetPrivateProfileString(num, "Name", "", &Name[i * 64], 63, perksFile)) Perks[i].Name = &Name[i * 64];
|
||||
if (GetPrivateProfileString(num, "Name", "", &Name[i * 64], 63, perksFile)) {
|
||||
Perks[i].Name = &Name[i * 64];
|
||||
}
|
||||
if (GetPrivateProfileString(num, "Desc", "", &Desc[i * 1024], 1023, perksFile)) {
|
||||
Perks[i].Desc = &Desc[i * 1024];
|
||||
}
|
||||
@@ -1109,7 +1111,7 @@ void Perks::init() {
|
||||
for (int i = STAT_st; i <= STAT_lu; i++) SafeWrite8(GainStatPerks[i][0], (BYTE)GainStatPerks[i][1]);
|
||||
|
||||
HookCall(0x442729, &PerkInitWrapper);
|
||||
if (GetPrivateProfileString("Misc", "PerksFile", "", &perksFile[2], 257, ini)) {
|
||||
if (GetConfigString("Misc", "PerksFile", "", &perksFile[2], MAX_PATH)) {
|
||||
perksFile[0] = '.';
|
||||
perksFile[1] = '\\';
|
||||
HookCall(0x44272E, &TraitInitWrapper);
|
||||
|
||||
@@ -23,35 +23,35 @@
|
||||
|
||||
#include "PlayerModel.h"
|
||||
|
||||
static char StartMaleModelName[65];
|
||||
char DefaultMaleModelName[65];
|
||||
static char StartFemaleModelName[65];
|
||||
char DefaultFemaleModelName[65];
|
||||
static char startMaleModelName[65];
|
||||
char defaultMaleModelName[65];
|
||||
static char startFemaleModelName[65];
|
||||
char defaultFemaleModelName[65];
|
||||
|
||||
void PlayerModel::init() {
|
||||
StartMaleModelName[64] = 0;
|
||||
if (GetPrivateProfileString("Misc", "MaleStartModel", "", StartMaleModelName, 64, ini)) {
|
||||
startMaleModelName[64] = 0;
|
||||
if (GetConfigString("Misc", "MaleStartModel", "", startMaleModelName, 64)) {
|
||||
dlog("Applying male start model patch.", DL_INIT);
|
||||
SafeWrite32(0x00418B88, (DWORD)&StartMaleModelName);
|
||||
SafeWrite32(0x00418B88, (DWORD)&startMaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
StartFemaleModelName[64] = 0;
|
||||
if (GetPrivateProfileString("Misc", "FemaleStartModel", "", StartFemaleModelName, 64, ini)) {
|
||||
startFemaleModelName[64] = 0;
|
||||
if (GetConfigString("Misc", "FemaleStartModel", "", startFemaleModelName, 64)) {
|
||||
dlog("Applying female start model patch.", DL_INIT);
|
||||
SafeWrite32(0x00418BAB, (DWORD)&StartFemaleModelName);
|
||||
SafeWrite32(0x00418BAB, (DWORD)&startFemaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
DefaultMaleModelName[64] = 0;
|
||||
GetPrivateProfileString("Misc", "MaleDefaultModel", "hmjmps", DefaultMaleModelName, 64, ini);
|
||||
defaultMaleModelName[64] = 0;
|
||||
GetConfigString("Misc", "MaleDefaultModel", "hmjmps", defaultMaleModelName, 64);
|
||||
dlog("Applying male model patch.", DL_INIT);
|
||||
SafeWrite32(0x00418B50, (DWORD)&DefaultMaleModelName);
|
||||
SafeWrite32(0x00418B50, (DWORD)&defaultMaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
|
||||
DefaultFemaleModelName[64] = 0;
|
||||
GetPrivateProfileString("Misc", "FemaleDefaultModel", "hfjmps", DefaultFemaleModelName, 64, ini);
|
||||
defaultFemaleModelName[64] = 0;
|
||||
GetConfigString("Misc", "FemaleDefaultModel", "hfjmps", defaultFemaleModelName, 64);
|
||||
dlog("Applying female model patch.", DL_INIT);
|
||||
SafeWrite32(0x00418B6D, (DWORD)&DefaultFemaleModelName);
|
||||
SafeWrite32(0x00418B6D, (DWORD)&defaultFemaleModelName);
|
||||
dlogr(" Done", DL_INIT);
|
||||
}
|
||||
|
||||
@@ -24,5 +24,5 @@ class PlayerModel : public Module {
|
||||
void init();
|
||||
};
|
||||
|
||||
extern char DefaultMaleModelName[65];
|
||||
extern char DefaultFemaleModelName[65];
|
||||
extern char defaultMaleModelName[65];
|
||||
extern char defaultFemaleModelName[65];
|
||||
|
||||
@@ -17,44 +17,22 @@
|
||||
*/
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\FalloutEngine\Structs.h"
|
||||
|
||||
#include "Premade.h"
|
||||
|
||||
struct PremadeChar {
|
||||
char path[20];
|
||||
DWORD fid;
|
||||
char unknown[20];
|
||||
};
|
||||
|
||||
PremadeChar* premade;
|
||||
|
||||
void Premade::init() {
|
||||
char buf[512];
|
||||
GetPrivateProfileString("misc", "PremadePaths", "", buf, 512, ini);
|
||||
if (buf[0]) {
|
||||
char buf2[512];
|
||||
GetPrivateProfileString("misc", "PremadeFIDs", "", buf2, 512, ini);
|
||||
|
||||
int count = 1;
|
||||
char* tmp = buf;
|
||||
while (tmp = strchr(tmp, ',')) {
|
||||
tmp++; count++;
|
||||
}
|
||||
auto premadePaths = GetConfigList("misc", "PremadePaths", "", 512);
|
||||
auto premadeFids = GetConfigList("misc", "PremadeFIDs", "", 512);
|
||||
if (premadePaths.size() > 0 && premadeFids.size() > 0) {
|
||||
int count = min(premadePaths.size(), premadeFids.size());
|
||||
premade = new PremadeChar[count];
|
||||
|
||||
tmp = buf;
|
||||
char* tmp2 = buf2;
|
||||
for (int i = 0; i < count; i++) {
|
||||
char* tmp3 = strchr(tmp, ',');
|
||||
if (tmp3) *tmp3 = 0;
|
||||
strcpy_s(premade[i].path, 20, "premade\\");
|
||||
strcat_s(premade[i].path, 20, tmp);
|
||||
tmp = tmp3 + 1;
|
||||
|
||||
tmp3 = strchr(tmp2, ',');
|
||||
if (tmp3) *tmp3 = 0;
|
||||
premade[i].fid = atoi(tmp2);
|
||||
tmp2 = tmp3 + 1;
|
||||
auto path = "premade\\" + premadePaths[i];
|
||||
strcpy_s(premade[i].path, 20, path.c_str());
|
||||
premade[i].fid = atoi(premadeFids[i].c_str());
|
||||
}
|
||||
|
||||
SafeWrite32(0x51C8D4, count);
|
||||
@@ -63,4 +41,4 @@ void Premade::init() {
|
||||
SafeWrite32(0x4A7E2C, (DWORD)premade + 20);
|
||||
strcpy_s((char*)0x50AF68, 20, premade[0].path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
#include "Misc.h"
|
||||
|
||||
static DWORD defaultMaleModelNamePtr = (DWORD)DefaultMaleModelName;
|
||||
static DWORD defaultFemaleModelNamePtr = (DWORD)DefaultFemaleModelName;
|
||||
static DWORD defaultMaleModelNamePtr = (DWORD)defaultMaleModelName;
|
||||
static DWORD defaultFemaleModelNamePtr = (DWORD)defaultFemaleModelName;
|
||||
static DWORD movieNamesPtr = (DWORD)MoviePaths;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ T SimplePatch(DWORD *addrs, int numAddrs, const char* iniSection, const char* in
|
||||
{
|
||||
T value;
|
||||
char msg[255];
|
||||
value = (T)GetPrivateProfileIntA(iniSection, iniKey, defaultValue, ini);
|
||||
value = (T)GetConfigInt(iniSection, iniKey, defaultValue);
|
||||
if (value != defaultValue) {
|
||||
if (value < minValue)
|
||||
value = minValue;
|
||||
|
||||
+12
-4
@@ -75,8 +75,8 @@
|
||||
bool isDebug = false;
|
||||
|
||||
const char ddrawIni[] = ".\\ddraw.ini";
|
||||
char ini[65];
|
||||
char translationIni[65];
|
||||
static char ini[65];
|
||||
static char translationIni[65];
|
||||
|
||||
unsigned int GetConfigInt(const char* section, const char* setting, int defaultValue) {
|
||||
return GetPrivateProfileIntA(section, setting, defaultValue, ::ini);
|
||||
@@ -91,7 +91,7 @@ std::string GetIniString(const char* section, const char* setting, const char* d
|
||||
}
|
||||
|
||||
std::vector<std::string> GetIniList(const char* section, const char* setting, const char* defaultValue, size_t bufSize, char delimiter, const char* iniFile) {
|
||||
auto list = split(GetConfigString(section, setting, defaultValue, bufSize), delimiter);
|
||||
auto list = split(GetIniString(section, setting, defaultValue, bufSize, iniFile), delimiter);
|
||||
std::transform(list.cbegin(), list.cend(), list.begin(), trim);
|
||||
return list;
|
||||
}
|
||||
@@ -100,6 +100,10 @@ std::string GetConfigString(const char* section, const char* setting, const char
|
||||
return GetIniString(section, setting, defaultValue, bufSize, ::ini);
|
||||
}
|
||||
|
||||
size_t GetConfigString(const char* section, const char* setting, const char* defaultValue, char* buf, size_t bufSize) {
|
||||
return GetPrivateProfileStringA(section, setting, defaultValue, buf, bufSize, ::ini);
|
||||
}
|
||||
|
||||
std::vector<std::string> GetConfigList(const char* section, const char* setting, const char* defaultValue, size_t bufSize) {
|
||||
return GetIniList(section, setting, defaultValue, bufSize, ',', ::ini);
|
||||
}
|
||||
@@ -108,6 +112,10 @@ std::string Translate(const char* section, const char* setting, const char* defa
|
||||
return GetIniString(section, setting, defaultValue, bufSize, ::translationIni);
|
||||
}
|
||||
|
||||
size_t Translate(const char* section, const char* setting, const char* defaultValue, char* buffer, size_t bufSize) {
|
||||
return GetPrivateProfileStringA(section, setting, defaultValue, buffer, bufSize, ::translationIni);
|
||||
}
|
||||
|
||||
|
||||
static void DllMain2() {
|
||||
dlogr("In DllMain2", DL_MAIN);
|
||||
@@ -250,7 +258,7 @@ bool _stdcall DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {
|
||||
strcpy_s(ini, ddrawIni);
|
||||
}
|
||||
|
||||
GetPrivateProfileStringA("Main", "TranslationsINI", "./Translations.ini", translationIni, 65, ini);
|
||||
GetConfigString("Main", "TranslationsINI", "./Translations.ini", translationIni, 65);
|
||||
|
||||
DllMain2();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user