FalloutTeamX / sfall-Extended

The official and extended modification of sfall for Fallout 2. sFall v5.0 released moved to repository on GitFlic.
https://gitflic.ru/project/fakelshub/sfall/release
17 stars 2 forks source link

HRP in Sfall #43

Open FakelsHub opened 4 years ago

FakelsHub commented 4 years ago

В связи с недоступностью исходных кодов HRP, и его частичного устаревания, необходимо полностью перенести функционал HRP (или его наиболее важные компоненты) в отдельный модуль в sfall, чтобы весь контроль над движком осуществлялся из одного контролируемого проекта.

При этом основная библиотека HRP может использоваться как доступ к некоторым особо большим функциям (как к экспортируемым).

FakelsHub commented 4 years ago

На сегодня 200 функций приобрели имена в дизассемблированном коде HRP, осталось разобрать 800.

Все же наверное это будет новый проект объеденный одном решении с sfall. На выходе будет получатся две библиотеки ddraw.dll и новая f2_res.dll

NovaRain commented 4 years ago

It will be like recreate a new HRP from the disassembled code, except the new one depends on sfall instead of working standalone?

FakelsHub commented 4 years ago

Not from disassembled code, I just study what is done and how to repeat it. Probably Yes, it will not work separately from sfall, simply because there will be no functions for creating a game window and other DirectX functions, only everything that is necessary to increase the map scale and other HRP capabilities. Why run a game without sfall? there are a lot of bugs.

burner1024 commented 3 years ago

Don't know if useful, but just in case - noticed some offsets in mapper's HRP: res_m2.ini.txt

FakelsHub commented 2 years ago

На данный момент осталось реализовать опции ALTERNATE_AMMO_METRE и NumPathNodes. На этом интеграция будет считаться законченной. Реализация HRP меню будет отложено (нужно будет подготовить новый интерфейс к нему).

At the moment, it remains to implement the 'ALTERNATE_AMMO_METRE' and `NumPathNodes' options. At this point, the integration will be considered completed. The implementation of the HRP menu will be postponed (will need to prepare a new art interface for it).

NovaRain commented 2 years ago

Currently the main menu button text seems misaligned with the background.

FakelsHub commented 2 years ago

show an example. There will be differences because the implementations are completely different.

NovaRain commented 2 years ago

show an example. There will be differences because the implementations are completely different.

Here's the comparison. I use graphics mode 5 and 1280x720 for GraphicsWidth/Height and SCR_WIDTH/HEIGHT, and all main menu related options are default in ddraw.ini/f2_res.ini.

With the external HRP: scr00000

With sfall built-in: scr00001

FakelsHub commented 2 years ago

I'm fine with this, there is no shift. what happened there? scr00001

NovaRain commented 2 years ago

I'm fine with this, there is no shift. what happened there?

Ah, I got it. In f2_res.ini HRP enables its USE_HIRES_IMAGES by default so MENU_BG_OFFSET_X/Y values have effect. Disabling USE_HIRES_IMAGES and the menu position is now normal with sfall built-in.

EDIT: Oh, SCALE_BUTTONS_AND_TEXT_MENU also affects this.

FakelsHub commented 2 years ago

here with the English version scr00000

FakelsHub commented 2 years ago

Ah, I got it. In f2_res.ini HRP enables its USE_HIRES_IMAGES by default so MENU_BG_OFFSET_X/Y values have effect. Disabling USE_HIRES_IMAGES and the menu position is now normal with sfall built-in.

Show the settings Everything should work the same without any disables.

NovaRain commented 2 years ago

Show the settings

Well, it's due to I enabled SCALE_BUTTONS_AND_TEXT_MENU.

[MAINMENU]
MAIN_MENU_SIZE=1

USE_HIRES_IMAGES=1

; With default 0 it's OK, enabling both USE_HIRES_IMAGES and this will cause the shift
SCALE_BUTTONS_AND_TEXT_MENU=1

MENU_BG_OFFSET_X=-14
MENU_BG_OFFSET_Y=-4
FakelsHub commented 2 years ago

Well, it's due to I enabled SCALE_BUTTONS_AND_TEXT_MENU.

the last time I rewrote the main menu code, this option worked correctly. apparently something broke.

FakelsHub commented 2 years ago

I think it's time to merge the HRP integration branch with the main one. Only I forgot how to do it correctly :)

NovaRain commented 2 years ago

Does the current DD7 mode still run slower than Mash's implementation? I didn't notice much difference on my Win7, but Lexx said the game run slow in DD7 with built-in HRP.

FakelsHub commented 2 years ago

On my W7 system, the built-in works faster in DX7/9 than mash modes since there is no some strange extra code/shit from mash. mash 400fps VS 600 sfall (dx9).

FakelsHub commented 2 years ago

Let him show screenshots of fps hrp and sfall from the dev version.

NovaRain commented 2 years ago

Isn't the FPS counter only available for DX9 mode?

FakelsHub commented 2 years ago

Oh, yeah.

The implementation of DX7 in the built-in sfall and mash is almost the same. except 8-bit mode. You can also change the code and give it to him for tests. remove all LOCK_WRITE_ONLY flags in DirectDraw.cpp

FakelsHub commented 2 years ago

also try https://github.com/FakelsHub/sFall-Extended/blob/73a3e3741f51b7fdf8aa5e3da85b471d76e3cdcb/sfall/Modules/SubModules/DirectDraw.cpp#L137 https://github.com/FakelsHub/sFall-Extended/blob/73a3e3741f51b7fdf8aa5e3da85b471d76e3cdcb/sfall/Modules/SubModules/DirectDraw.cpp#L281

DDSURFACEDESC replace to DDSURFACEDESC2

NovaRain commented 2 years ago

Lexx said the "slower" isn't about the game itself (fps) but the speed of how fast interface opens and fades, etc. For example, opening the inventory takes like a second with DD7 mode on his Win10 system.

NovaRain commented 2 years ago

Using both changes seems improving DD7 performance, at least the game only stutters on the first open for any game interfaces (inventory, pipboy, etc.) now.

NovaRain commented 2 years ago

Just a thought. Maybe we could implement BARTER_PC_INV_DROP_FIX as a default UI fix in sfall, like other tweaks/fixes in InterfaceWindowPatch(), if the drop zone size/position is indeed incorrect? Also the whole main menu is moved to the right side of the screen instead of on the center when MAIN_MENU_SIZE=0.

FakelsHub commented 2 years ago

MAIN_MENU_SIZE - fixed.

FakelsHub commented 2 years ago

BARTER_PC_INV_DROP_FIX in fact, it is required to expand the drop zone to 80 pixels instead of 64, and also for the NPC side.

burner1024 commented 2 years ago

anyone tested this on wine yet?

FakelsHub commented 2 years ago

Нет.

burner1024 commented 2 years ago

ok, let me know when there's a build available for testing

NovaRain commented 2 years ago

ok, let me know when there's a build available for testing

There are already auto builds in Git Actions. Check the artifacts in them.

burner1024 commented 2 years ago

dev branch https://github.com/phobos2077/sfall ?

NovaRain commented 2 years ago

dev branch https://github.com/phobos2077/sfall ?

Yes, both master and develop have auto builds. https://github.com/phobos2077/sfall/actions

burner1024 commented 2 years ago

Should I delete all HRP data for this?

NovaRain commented 2 years ago

Should I delete all HRP data for this?

No, by default sfall will offer to disable Mash's HRP in game exe for you. And the built-in HRP still requires f2_res.ini/dat files.

burner1024 commented 2 years ago

OK, I disabled per suggestion:

nhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x11038fb5).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:11038fb5 ESP:0031f4ac EBP:0031f6a8 EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00000000 EBX:00020001 ECX:01920ea8 EDX:ffffffff
 ESI:6ed6dbb0 EDI:110a4c11
Stack dump:
0x0031f4ac:  00000000 00000000 110a99d8 00000280
0x0031f4bc:  00000008 00020046 0000000c 00020046
0x0031f4cc:  00000001 00000500 00000320 0000003c
0x0031f4dc:  00000016 00000000 00000000 68500000
0x0031f4ec:  00000000 00000000 00000000 0031f520
0x0031f4fc:  68539000 00000000 00000000 0031f558
Backtrace:
=>0 0x11038fb5 EntryPoint+0xffffffff() in ddraw (0x0031f6a8)
  1 0x1103aa2b EntryPoint+0xffffffff() in ddraw (0x0031f6b4)
0x11038fb5 EntryPoint+0xffffffff in ddraw: movl 0x0(%eax),%ecx
Modules:
Module  Address         Debug info  Name (32 modules)
PE    400000-  6f0000   Export          fallout2
PE    6f0000-  b74000   Deferred        ole32
PE   16d0000- 1917000   Deferred        msvcrt
PE  10000000-101ff000   Deferred        d3dx9_43
PE  11000000-110fe000   Export          ddraw
PE  61740000-61829000   Deferred        advapi32
PE  62b80000-62b8c000   Deferred        api-ms-win-core-localization-l1-2-1
PE  62fc0000-631f2000   Deferred        rpcrt4
PE  63480000-6349c000   Deferred        version
PE  63bc0000-63c02000   Deferred        shcore
PE  64a40000-64b5e000   Deferred        shlwapi
PE  67840000-6784e000   Deferred        psapi
PE  67c80000-67de9000   Deferred        d3d9
PE  682c0000-6844c000   Deferred        dsound
PE  68500000-6864b000   Deferred        combase
PE  6a040000-6a0a3000   Deferred        msacm32
FakelsHub commented 2 years ago

Проверяй на моей отладочной версии с PDB файлом.

NovaRain commented 2 years ago

Does the crash still happen if you set HiResMode=0 in [Main]? Just want to make sure it's related to built-in HRP.

burner1024 commented 2 years ago

It doesn't.

Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x1107b60b).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:1107b60b ESP:0031f494 EBP:0031f6a8 EFLAGS:00010246(  R- --  I  Z- -P- )
 EAX:00000000 EBX:00020001 ECX:01a60e30 EDX:ffffffff
 ESI:6ed6dbb0 EDI:110c2e11
Stack dump:
0x0031f494:  00000000 00000000 110c9750 00000400
0x0031f4a4:  00000008 0002004a 68503c1e 00000500
0x0031f4b4:  00000320 0000003c 00000016 0031f4d8
0x0031f4c4:  0000000c 00000400 00000300 00000016
0x0031f4d4:  00000001 00000000 00000000 00000001
0x0031f4e4:  0002004a 00000000 00000000 00000000
Backtrace:
=>0 0x1107b60b sfall::ResetDevice+0x23b() [d:\a\sfall-extended\sfall-extended\sfall\modules\graphics.cpp:206] in ddraw (0x0031f6a8)
0x1107b60b sfall::ResetDevice+0x23b [d:\a\sfall-extended\sfall-extended\sfall\modules\graphics.cpp:206] in ddraw: movl  0x0(%eax),%ecx
Unable to access file 'd:\a\sfall-extended\sfall-extended\sfall\modules\graphics.cpp'
Modules:
Module  Address         Debug info  Name (32 modules)
PE    400000-  6f0000   Deferred        fallout2
PE    6f0000-  b74000   Deferred        ole32
PE   1810000- 1a57000   Deferred        msvcrt
PE  10000000-101ff000   Deferred        d3dx9_43
PE  11000000-11125000   PDB             ddraw
PE  61740000-61829000   Deferred        advapi32
PE  62b80000-62b8c000   Deferred        api-ms-win-core-localization-l1-2-1
PE  62fc0000-631f2000   Deferred        rpcrt4
PE  63480000-6349c000   Deferred        version
PE  63bc0000-63c02000   Deferred        shcore
PE  64a40000-64b5e000   Deferred        shlwapi
PE  67840000-6784e000   Deferred        psapi
PE  67c80000-67de9000   Deferred        d3d9
PE  682c0000-6844c000   Deferred        dsound
PE  68500000-6864b000   Deferred        combase
PE  6a040000-6a0a3000   Deferred        msacm32
PE  6a400000-6a571000   Deferred        winmm
PE  6ac80000-6ac8b000   Deferred        api-ms-win-core-fibers-l1-1-1
PE  6bc00000-6bca1000   Deferred        sechost
PE  6bcc0000-6be9c000   Deferred        setupapi
PE  6c9c0000-6cf40000   Deferred        gdi32
PE  6de80000-6de8c000   Deferred        api-ms-win-core-synch-l1-2-0
PE  6ed00000-6f392000   Deferred        user32
PE  70b40000-70df3000   Deferred        ucrtbase
PE  71200000-71248000   Deferred        imm32
PE  7b000000-7b30c000   Deferred        kernelbase
PE  7b600000-7b928000   Deferred        kernel32
PE  7bc00000-7bedf000   Deferred        ntdll
PE  7c630000-7cf07000   Deferred        shell32
PE  7dcc0000-7dcc4000   Deferred        opengl32
PE  7de10000-7de14000   Deferred        wined3d
PE  7e340000-7e344000   Deferred        winex11
FakelsHub commented 2 years ago

Что? На русском пиши. У тебя вообще работает режим sfall dx9 в wine? В других версиях. В каком режиме ты обычно запускаешь игру dx7 или dx9 в hrp?

FakelsHub commented 2 years ago

У вас там в wine похоже отсутствует компилятор шейдеров, типа вот это: https://docs.microsoft.com/ru-ru/windows/win32/direct3dtools/fxc

egornovivan commented 2 years ago

У вас там в wine похоже отсутствует компилятор шейдеров, типа вот это: https://docs.microsoft.com/ru-ru/windows/win32/direct3dtools/fxc

А он там должен быть? Старый hrp и sfall вроде же работали на вайне без бубна

FakelsHub commented 2 years ago

В sfall dx9 ничего не менялось, я уже слышал где-то что lunix не имеет компилятора для HLSL шейдеров. (вроде какую-то фигную надо ставить). HRP использует уже скопилированный шейдер.

NovaRain commented 2 years ago

I tested the build in my Ubuntu 18.04 VM, and both DD7 and DX9 modes work normally. Do you have d3dcompiler_43.dll installed in Wine? scr

В sfall dx9 ничего не менялось, я уже слышал где-то что lunix не имеет компилятора для HLSL шейдеров. (вроде какую-то фигную надо ставить).

It's the same for Windows. If for some reason d3dcompiler_43.dll (HLSL compilation functions) is missing, the game will crash/hang at start. https://walbourn.github.io/whats-up-with-d3dcompiler_xx-dll/ https://walbourn.github.io/hlsl-fxc-and-d3dcompile/

burner1024 commented 2 years ago

I don't have compiler, but can install it if necessary. Game now launches, with this message

Captura de pantalla de 2022-01-17 15-26-39

NovaRain commented 2 years ago

I don't have compiler, but can install it if necessary. Game now launches, with this message

Before today's commit, the game would just crash/hang at start if you're using sfall DX9 but don't have d3dcompiler_xx.dll installed. I've already updated the DLL requirement in the readme of 4.3.2, as the result from my earlier post in issue 411.

As for the warning message, it's expected for the current build. I'll include pre-compiled HLSL headers later so one shouldn't need d3dcompiler_xx.dll anymore (at least it works on Windows).

FakelsHub commented 2 years ago

I don't have compiler, but can install it if necessary. Game now launches, with this message

Captura de pantalla de 2022-01-17 15-26-39

У тебя без компилятора при игре с dx9 hrp, случайно не появляются какие-нибудь лог файлы с ошибкой, hrp создает лог с ошибкой, и переходит в режим сpu.

burner1024 commented 2 years ago

Да вроде не появляются. Какое имя должно быть у файла? Если нажать Accept то потом игра нормально запускается.

FakelsHub commented 2 years ago

Да вроде не появляются. Какое имя должно быть у файла?

а не попутал, в HRP тоже такое окошко с сообщением выскакивает. просто NovaRain пишет что с пред компилированными шейдерами тоже требуется компилятор. вобщем непонятная ситуация c этим. вот попробуй с "предкомилированными". ddraw.zip

NovaRain commented 2 years ago

I've already added the precompiled HLSL shader files to phobos build as well, now the new binary should work without d3dcompiler_xx.dll.

burner1024 commented 2 years ago

With precompiled shaders, I get screwed colors in menu. Captura de pantalla de 2022-01-17 16-13-10