AllowDShowSound improvements from Mr.Stalin:

* Added volume control support for alternative sound files.
* Added mode 2 to play alternative music files even if original acm files are not present in the music folder.
* Added AllowDShowMovies option to separate avi files playback from enabling DX9 mode.
* Fixed initialization bug when DX9 mode is disabled.
* Small refactoring on ASM code.

Added missing FadeMultiplier option to ddraw.ini.
This commit is contained in:
NovaRain
2018-09-30 21:34:35 +08:00
parent f088c9bb70
commit 5874450f60
8 changed files with 391 additions and 118 deletions
+10 -1
View File
@@ -17,7 +17,8 @@ NumSoundBuffers=0
;Set to 1 to allow attaching sound files to combat float messages ;Set to 1 to allow attaching sound files to combat float messages
AllowSoundForFloats=1 AllowSoundForFloats=1
;Set to 1 to automatically search for alternative formats when Fallout tries to play an acm ;Set to 1 to automatically search for alternative formats (mp3/wma/wav) when Fallout tries to play an acm
;Set to 2 to play alternative music files even if original acm files are not present in the music folder
;This does not effect the play_sfall_sound and stop_sfall_sound script functions ;This does not effect the play_sfall_sound and stop_sfall_sound script functions
AllowDShowSound=0 AllowDShowSound=0
@@ -70,6 +71,14 @@ GPUBlt=0
;Requires graphics mode 4 or 5, and GPUBlt set to 1 ;Requires graphics mode 4 or 5, and GPUBlt set to 1
Use32BitHeadGraphics=0 Use32BitHeadGraphics=0
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
;Requires graphics mode 4 or 5
AllowDShowMovies=0
;Fade effect time length percentage modifier
;Default is 100. Larger values make it slower, smaller values make it faster
FadeMultiplier=100
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Input] [Input]
;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens ;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens
+6
View File
@@ -16,6 +16,7 @@
#define FO_VAR_aTextSCuts 0x501A8C #define FO_VAR_aTextSCuts 0x501A8C
#define FO_VAR_aTextSCutsS 0x503530 #define FO_VAR_aTextSCutsS 0x503530
#define FO_VAR_aTextSCutsSS 0x50B01C #define FO_VAR_aTextSCutsSS 0x50B01C
#define FO_VAR_background_volume 0x518E88
#define FO_VAR_bboxslot 0x5970E0 #define FO_VAR_bboxslot 0x5970E0
#define FO_VAR_bckgnd 0x5707A4 #define FO_VAR_bckgnd 0x5707A4
#define FO_VAR_black_palette 0x663FD0 #define FO_VAR_black_palette 0x663FD0
@@ -63,6 +64,7 @@
#define FO_VAR_game_user_wants_to_quit 0x5186CC #define FO_VAR_game_user_wants_to_quit 0x5186CC
#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_gdNumOptions 0x5186D8 #define FO_VAR_gdNumOptions 0x5186D8
#define FO_VAR_gIsSteal 0x51D430 #define FO_VAR_gIsSteal 0x51D430
#define FO_VAR_glblmode 0x5709D0 #define FO_VAR_glblmode 0x5709D0
@@ -112,6 +114,7 @@
#define FO_VAR_map_number 0x631D88 #define FO_VAR_map_number 0x631D88
#define FO_VAR_map_state 0x631D28 #define FO_VAR_map_state 0x631D28
#define FO_VAR_master_db_handle 0x58E948 #define FO_VAR_master_db_handle 0x58E948
#define FO_VAR_master_volume 0x518E84
#define FO_VAR_max 0x56FB50 #define FO_VAR_max 0x56FB50
#define FO_VAR_maxScriptNum 0x51C7CC #define FO_VAR_maxScriptNum 0x51C7CC
#define FO_VAR_Meet_Frank_Horrigan 0x672E04 #define FO_VAR_Meet_Frank_Horrigan 0x672E04
@@ -177,7 +180,10 @@
#define FO_VAR_scriptListInfo 0x51C7C8 #define FO_VAR_scriptListInfo 0x51C7C8
#define FO_VAR_skill_data 0x51D118 #define FO_VAR_skill_data 0x51D118
#define FO_VAR_slot_cursor 0x5193B8 #define FO_VAR_slot_cursor 0x5193B8
#define FO_VAR_sndfx_volume 0x518E90
#define FO_VAR_sneak_working 0x56D77C // DWORD var #define FO_VAR_sneak_working 0x56D77C // DWORD var
#define FO_VAR_sound_music_path1 0x518E78
#define FO_VAR_sound_music_path2 0x518E7C
#define FO_VAR_square 0x631E40 #define FO_VAR_square 0x631E40
#define FO_VAR_squares 0x66BE08 #define FO_VAR_squares 0x66BE08
#define FO_VAR_stack 0x59E86C #define FO_VAR_stack 0x59E86C
+2
View File
@@ -164,6 +164,8 @@ VAR_(scriptListInfo, ScriptListInfoItem*) // dynamic array
VARA(skill_data, SkillInfo, SKILL_count) VARA(skill_data, SkillInfo, SKILL_count)
VAR_(slot_cursor, DWORD) VAR_(slot_cursor, DWORD)
VAR_(sneak_working, DWORD) // DWORD var VAR_(sneak_working, DWORD) // DWORD var
VAR_(sound_music_path1, char*)
VAR_(sound_music_path2, char*)
VAR_(square, DWORD) VAR_(square, DWORD)
VAR_(squares, DWORD*) VAR_(squares, DWORD*)
VAR_(stack, DWORD) VAR_(stack, DWORD)
+8
View File
@@ -1,5 +1,6 @@
#include "..\main.h" #include "..\main.h"
#include "..\FalloutEngine\Fallout2.h" #include "..\FalloutEngine\Fallout2.h"
#include "LoadGameHook.h"
#include "ScriptExtender.h" #include "ScriptExtender.h"
#include "BugFixes.h" #include "BugFixes.h"
@@ -19,6 +20,10 @@ void ResetBodyState() {
_asm mov weightOnBody, 0; _asm mov weightOnBody, 0;
} }
void GameInitialization() {
*(DWORD*)FO_VAR_gDialogMusicVol = *(DWORD*)FO_VAR_background_volume; // fix dialog music
}
static void __declspec(naked) SharpShooterFix() { static void __declspec(naked) SharpShooterFix() {
__asm { __asm {
call fo::funcoffs::stat_level_ // Perception call fo::funcoffs::stat_level_ // Perception
@@ -1526,6 +1531,9 @@ void BugFixes::init()
if (isDebug && (GetConfigInt("Debugging", "BugFixes", 1) == 0)) return; if (isDebug && (GetConfigInt("Debugging", "BugFixes", 1) == 0)) return;
#endif #endif
// Missing game initialization
LoadGameHook::OnGameInit() = GameInitialization;
//if (GetConfigInt("Misc", "SharpshooterFix", 1)) { //if (GetConfigInt("Misc", "SharpshooterFix", 1)) {
dlog("Applying Sharpshooter patch.", DL_INIT); dlog("Applying Sharpshooter patch.", DL_INIT);
// http://www.nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/page-119#post-4050162 // http://www.nma-fallout.com/threads/fo2-engine-tweaks-sfall.178390/page-119#post-4050162
+22
View File
@@ -58,6 +58,7 @@ static Delegate<> onBeforeGameStart;
static Delegate<> onAfterGameStarted; static Delegate<> onAfterGameStarted;
static Delegate<> onAfterNewGame; static Delegate<> onAfterNewGame;
static Delegate<DWORD> onGameModeChange; static Delegate<DWORD> onGameModeChange;
static Delegate<> onBeforeGameClose;
static DWORD inLoop = 0; static DWORD inLoop = 0;
static DWORD saveInCombatFix; static DWORD saveInCombatFix;
@@ -316,6 +317,10 @@ static void __stdcall GameExit() {
onGameExit.invoke(); onGameExit.invoke();
} }
static void __stdcall GameClose() {
onBeforeGameClose.invoke();
}
static void __declspec(naked) main_init_system_hook() { static void __declspec(naked) main_init_system_hook() {
__asm { __asm {
pushad; pushad;
@@ -364,6 +369,15 @@ static void __declspec(naked) after_game_exit_hook() {
} }
} }
static void __declspec(naked) game_close_hook() {
__asm {
pushad;
call GameClose;
popad;
jmp fo::funcoffs::game_exit_;
}
}
static void __declspec(naked) WorldMapHook() { static void __declspec(naked) WorldMapHook() {
__asm { __asm {
_InLoop(1, WORLDMAP); _InLoop(1, WORLDMAP);
@@ -594,6 +608,10 @@ void LoadGameHook::init() {
}); });
HookCalls(before_game_exit_hook, {0x480ACE, 0x480BC7}); HookCalls(before_game_exit_hook, {0x480ACE, 0x480BC7});
HookCalls(after_game_exit_hook, {0x480AEB, 0x480BE4}); HookCalls(after_game_exit_hook, {0x480AEB, 0x480BE4});
HookCalls(game_close_hook, {
0x480CA7, // gnw_main_
//0x480D45 // main_exit_system_ (never called)
});
HookCalls(WorldMapHook, {0x483668, 0x4A4073}); HookCalls(WorldMapHook, {0x483668, 0x4A4073});
HookCalls(WorldMapHook2, {0x4C4855}); HookCalls(WorldMapHook2, {0x4C4855});
@@ -647,4 +665,8 @@ Delegate<DWORD>& LoadGameHook::OnGameModeChange() {
return onGameModeChange; return onGameModeChange;
} }
Delegate<>& LoadGameHook::OnBeforeGameClose() {
return onBeforeGameClose;
}
} }
+3
View File
@@ -49,6 +49,9 @@ public:
// Invoked when the game mode is changed. // Invoked when the game mode is changed.
static Delegate<DWORD>& OnGameModeChange(); static Delegate<DWORD>& OnGameModeChange();
// Invoked before the game exits to windows
static Delegate<>& OnBeforeGameClose();
}; };
// True if some map was loaded, false when on the main menu // True if some map was loaded, false when on the main menu
+333 -111
View File
File diff suppressed because it is too large Load Diff
+4 -3
View File
@@ -27,12 +27,13 @@ class Movies : public Module {
public: public:
const char* name() { return "Movies"; } const char* name() { return "Movies"; }
void init(); void init();
void exit() override;
}; };
static const int MaxMovies=32; static const int MaxMovies = 32;
extern char MoviePaths[MaxMovies*65]; extern char MoviePaths[MaxMovies * 65];
void* _stdcall PlaySfallSound(const char* path, int loop); void* _stdcall PlaySfallSound(const char* path, bool loop);
void _stdcall StopSfallSound(void* ptr); void _stdcall StopSfallSound(void* ptr);
} }