mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed the path to load global shaders in the previous commit
* when DataLoadOrderPatch is disabled, the path was set to "sfall.dat\shaders\".
This commit is contained in:
+1
-1
@@ -81,7 +81,7 @@ GraphicsWidth=0
|
|||||||
GraphicsHeight=0
|
GraphicsHeight=0
|
||||||
|
|
||||||
;Uncomment the option to use a hardware shader (requires DX9 graphics mode 4 or 5)
|
;Uncomment the option to use a hardware shader (requires DX9 graphics mode 4 or 5)
|
||||||
;The shader file <name>.fx must be placed in data\shaders\ and must contain one technique with one or more passes
|
;The shader file <name>.fx must be placed in <GameRoot>\<master_patches>\shaders\ and must contain one technique with one or more passes
|
||||||
;GlobalShaderFile=global.fx
|
;GlobalShaderFile=global.fx
|
||||||
|
|
||||||
;Set to 1 to do the palette conversion on the GPU
|
;Set to 1 to do the palette conversion on the GPU
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ The input functions are only available if the user has the input hook turned on
|
|||||||
|
|
||||||
The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can't. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.
|
The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can't. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.
|
||||||
|
|
||||||
load_shader takes a path relative to the data\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.
|
load_shader takes a path relative to the <GameRoot>\<master_patches>\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.
|
||||||
|
|
||||||
get_shader_version gives you the highest shader version supported by the player's graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.
|
get_shader_version gives you the highest shader version supported by the player's graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
#define FO_VAR_game_global_vars 0x5186C0
|
#define FO_VAR_game_global_vars 0x5186C0
|
||||||
#define FO_VAR_game_ui_disabled 0x5186B4
|
#define FO_VAR_game_ui_disabled 0x5186B4
|
||||||
#define FO_VAR_game_user_wants_to_quit 0x5186CC
|
#define FO_VAR_game_user_wants_to_quit 0x5186CC
|
||||||
|
#define FO_VAR_gconfig_file_name 0x58E978
|
||||||
#define FO_VAR_gcsd 0x51094C
|
#define FO_VAR_gcsd 0x51094C
|
||||||
#define FO_VAR_gdBarterMod 0x51873C
|
#define FO_VAR_gdBarterMod 0x51873C
|
||||||
#define FO_VAR_gDialogMusicVol 0x5187D8
|
#define FO_VAR_gDialogMusicVol 0x5187D8
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ VAR_(combat_state, DWORD)
|
|||||||
VAR_(combat_turn_running, DWORD)
|
VAR_(combat_turn_running, DWORD)
|
||||||
VAR_(combatNumTurns, DWORD)
|
VAR_(combatNumTurns, DWORD)
|
||||||
VAR3(crit_succ_eff, CritInfo, 20, 9, 6) // 20 critters with 9 body parts and 6 effects each
|
VAR3(crit_succ_eff, CritInfo, 20, 9, 6) // 20 critters with 9 body parts and 6 effects each
|
||||||
VAR_(critter_db_handle, DWORD)
|
VAR_(critter_db_handle, PathNode*)
|
||||||
VAR_(critterClearObj, DWORD)
|
VAR_(critterClearObj, DWORD)
|
||||||
VAR_(crnt_func, DWORD)
|
VAR_(crnt_func, DWORD)
|
||||||
VAR_(curr_font_num, DWORD)
|
VAR_(curr_font_num, DWORD)
|
||||||
@@ -108,7 +108,7 @@ VAR_(main_ctd, DWORD)
|
|||||||
VAR_(main_window, DWORD)
|
VAR_(main_window, DWORD)
|
||||||
VAR_(map_elevation, DWORD)
|
VAR_(map_elevation, DWORD)
|
||||||
VAR_(map_global_vars, long*) // array
|
VAR_(map_global_vars, long*) // array
|
||||||
VAR_(master_db_handle, DWORD)
|
VAR_(master_db_handle, PathNode*)
|
||||||
VAR_(max, DWORD)
|
VAR_(max, DWORD)
|
||||||
VAR_(maxScriptNum, long)
|
VAR_(maxScriptNum, long)
|
||||||
VAR_(Meet_Frank_Horrigan, bool)
|
VAR_(Meet_Frank_Horrigan, bool)
|
||||||
|
|||||||
@@ -1006,11 +1006,11 @@ void Graphics::init() {
|
|||||||
if (!h) {
|
if (!h) {
|
||||||
MessageBoxA(0, "You have selected graphics mode 4 or 5, but " _DLL_NAME " is missing.\n"
|
MessageBoxA(0, "You have selected graphics mode 4 or 5, but " _DLL_NAME " is missing.\n"
|
||||||
"Switch back to mode 0, or install an up to date version of DirectX.", "Error", MB_TASKMODAL | MB_ICONERROR);
|
"Switch back to mode 0, or install an up to date version of DirectX.", "Error", MB_TASKMODAL | MB_ICONERROR);
|
||||||
|
#undef _DLL_NAME
|
||||||
ExitProcess(-1);
|
ExitProcess(-1);
|
||||||
} else {
|
} else {
|
||||||
FreeLibrary(h);
|
FreeLibrary(h);
|
||||||
}
|
}
|
||||||
#undef _DLL_NAME
|
|
||||||
SafeWrite8(0x50FB6B, '2'); // Set call DirectDrawCreate2
|
SafeWrite8(0x50FB6B, '2'); // Set call DirectDrawCreate2
|
||||||
HookCall(0x44260C, game_init_hook);
|
HookCall(0x44260C, game_init_hook);
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ end:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __stdcall InitExtraPatches() {
|
static void InitExtraPatches() {
|
||||||
for (auto it = patchFiles.begin(); it != patchFiles.end(); it++) {
|
for (auto it = patchFiles.begin(); it != patchFiles.end(); it++) {
|
||||||
if (!it->empty()) fo::func::db_init(it->c_str(), 0);
|
if (!it->empty()) fo::func::db_init(it->c_str(), 0);
|
||||||
}
|
}
|
||||||
@@ -163,11 +163,11 @@ static void __stdcall InitExtraPatches() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void __fastcall game_init_databases_hook() { // eax = _master_db_handle
|
static void __fastcall game_init_databases_hook() { // eax = _master_db_handle
|
||||||
fo::PathNode* master_patches = (fo::PathNode*)fo::var::master_db_handle;
|
fo::PathNode* master_patches = fo::var::master_db_handle;
|
||||||
|
|
||||||
if (!patchFiles.empty()) InitExtraPatches();
|
/*if (!patchFiles.empty())*/ InitExtraPatches();
|
||||||
|
|
||||||
fo::PathNode* critter_patches = (fo::PathNode*)fo::var::critter_db_handle;
|
fo::PathNode* critter_patches = fo::var::critter_db_handle;
|
||||||
fo::PathNode* paths = fo::var::paths; // beginning of the chain of paths
|
fo::PathNode* paths = fo::var::paths; // beginning of the chain of paths
|
||||||
// insert master_patches/critter_patches at the beginning of the chain of paths
|
// insert master_patches/critter_patches at the beginning of the chain of paths
|
||||||
if (critter_patches) {
|
if (critter_patches) {
|
||||||
@@ -178,6 +178,20 @@ static void __fastcall game_init_databases_hook() { // eax = _master_db_handle
|
|||||||
fo::var::paths = master_patches; // set master_patches node at the beginning of the chain of paths
|
fo::var::paths = master_patches; // set master_patches node at the beginning of the chain of paths
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __fastcall game_init_databases_hook1() {
|
||||||
|
char masterPatch[MAX_PATH];
|
||||||
|
iniGetString("system", "master_patches", "", masterPatch, MAX_PATH - 1, (const char*)FO_VAR_gconfig_file_name);
|
||||||
|
|
||||||
|
fo::PathNode* node = fo::var::paths;
|
||||||
|
while (node->next) {
|
||||||
|
if (!_stricmp(node->path, masterPatch)) break;
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
fo::var::master_db_handle = node; // set pointer to master_patches node
|
||||||
|
|
||||||
|
InitExtraPatches();
|
||||||
|
}
|
||||||
|
|
||||||
static bool NormalizePath(std::string &path) {
|
static bool NormalizePath(std::string &path) {
|
||||||
if (path.find(':') != std::string::npos) return false;
|
if (path.find(':') != std::string::npos) return false;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@@ -388,8 +402,8 @@ void LoadOrder::init() {
|
|||||||
HookCall(0x44436D, game_init_databases_hook);
|
HookCall(0x44436D, game_init_databases_hook);
|
||||||
SafeWrite8(0x4DFAEC, 0x1D); // error correction (ecx > ebx)
|
SafeWrite8(0x4DFAEC, 0x1D); // error correction (ecx > ebx)
|
||||||
dlogr(" Done", DL_INIT);
|
dlogr(" Done", DL_INIT);
|
||||||
} else if (!patchFiles.empty()) {
|
} else /*if (!patchFiles.empty())*/ {
|
||||||
HookCall(0x44436D, InitExtraPatches);
|
HookCall(0x44436D, game_init_databases_hook1);
|
||||||
}
|
}
|
||||||
|
|
||||||
femaleMsgs = GetConfigInt("Misc", "FemaleDialogMsgs", 0);
|
femaleMsgs = GetConfigInt("Misc", "FemaleDialogMsgs", 0);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ void _stdcall SetShaderMode(DWORD d, DWORD mode) {
|
|||||||
int _stdcall LoadShader(const char* file) {
|
int _stdcall LoadShader(const char* file) {
|
||||||
if (!Graphics::mode || strstr(file, "..") || strstr(file, ":")) return -1;
|
if (!Graphics::mode || strstr(file, "..") || strstr(file, ":")) return -1;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
sprintf_s(buf, "%s\\shaders\\%s", fo::var::paths->path, file); // fo::var::patches
|
sprintf_s(buf, "%s\\shaders\\%s", fo::var::master_db_handle->path, file); // fo::var::patches
|
||||||
for (DWORD d = 0; d < shadersSize; d++) {
|
for (DWORD d = 0; d < shadersSize; d++) {
|
||||||
if (!shaders[d].Effect) {
|
if (!shaders[d].Effect) {
|
||||||
if (FAILED(D3DXCreateEffectFromFile(d3d9Device, buf, 0, 0, 0, 0, &shaders[d].Effect, 0))) {
|
if (FAILED(D3DXCreateEffectFromFile(d3d9Device, buf, 0, 0, 0, 0, &shaders[d].Effect, 0))) {
|
||||||
@@ -82,7 +82,7 @@ int _stdcall LoadShader(const char* file) {
|
|||||||
|
|
||||||
sprintf(buf, "texname%d", i);
|
sprintf(buf, "texname%d", i);
|
||||||
if (FAILED(shader.Effect->GetString(buf, &name))) break;
|
if (FAILED(shader.Effect->GetString(buf, &name))) break;
|
||||||
sprintf_s(buf, "%s\\art\\stex\\%s", fo::var::patches, name);
|
sprintf_s(buf, "%s\\art\\stex\\%s", fo::var::master_db_handle->path, name); // fo::var::patches
|
||||||
if (FAILED(D3DXCreateTextureFromFileA(d3d9Device, buf, &tex))) continue;
|
if (FAILED(D3DXCreateTextureFromFileA(d3d9Device, buf, &tex))) continue;
|
||||||
sprintf(buf, "tex%d", i);
|
sprintf(buf, "tex%d", i);
|
||||||
shader.Effect->SetTexture(buf, tex);
|
shader.Effect->SetTexture(buf, tex);
|
||||||
|
|||||||
Reference in New Issue
Block a user