mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Updated the code for DirectDraw graphics mode
This commit is contained in:
+2
-2
@@ -110,8 +110,8 @@ static bool DisableExtHRP(const char* runFileName, std::string &cmdline) {
|
||||
// 0x4FE1C0 - 0x4FE1E7
|
||||
std::fseek(ft, 0xEE5C0, SEEK_SET);
|
||||
|
||||
DWORD restore1[10] = {0};
|
||||
_fwrite_nolock(restore1, 4, sizeof(restore1), ft);
|
||||
BYTE restore1[39] = {0};
|
||||
_fwrite_nolock(restore1, 1, sizeof(restore1), ft);
|
||||
|
||||
std::fclose(ft);
|
||||
cmdline.append(" -restart");
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include "..\main.h"
|
||||
#include "..\FalloutEngine\Fallout2.h"
|
||||
//#include "..\InputFuncs.h"
|
||||
#include "..\WinProc.h"
|
||||
#include "LoadGameHook.h"
|
||||
#include "ScriptShaders.h"
|
||||
@@ -37,7 +36,7 @@ namespace sfall
|
||||
#define UNUSEDFUNCTION { return DDERR_GENERIC; }
|
||||
#define SAFERELEASE(a) { if (a) { a->Release(); a = nullptr; } }
|
||||
|
||||
typedef HRESULT (__stdcall *DDrawCreateProc)(void*, IDirectDraw**, void*);
|
||||
//typedef HRESULT (__stdcall *DDrawCreateProc)(void*, IDirectDraw**, void*);
|
||||
//typedef IDirect3D9* (__stdcall *D3DCreateProc)(UINT version);
|
||||
|
||||
#if !(NDEBUG) && !(_DEBUG)
|
||||
@@ -56,7 +55,7 @@ static DWORD gHeight;
|
||||
|
||||
DWORD Graphics::GPUBlt;
|
||||
DWORD Graphics::mode;
|
||||
bool Graphics::IsWindowMode;
|
||||
bool Graphics::IsWindowedMode;
|
||||
|
||||
bool Graphics::PlayAviMovie = false;
|
||||
bool Graphics::AviMovieWidthFit = false;
|
||||
@@ -70,8 +69,8 @@ static DDSURFACEDESC mveDesc;
|
||||
static D3DSURFACE_DESC movieDesc;
|
||||
|
||||
static DirectDraw::PALCOLOR* palette;
|
||||
static bool paletteInit = false;
|
||||
|
||||
static bool windowInit = false;
|
||||
static HWND window;
|
||||
|
||||
static DWORD ShaderVersion;
|
||||
@@ -137,7 +136,7 @@ int __stdcall Graphics::GetShaderVersion() {
|
||||
}
|
||||
|
||||
static void WindowInit() {
|
||||
windowInit = true;
|
||||
paletteInit = true;
|
||||
rcpres[0] = 1.0f / (float)Graphics::GetGameWidthRes();
|
||||
rcpres[1] = 1.0f / (float)Graphics::GetGameHeightRes();
|
||||
ScriptShaders::LoadGlobalShader();
|
||||
@@ -871,7 +870,7 @@ public:
|
||||
0x4CB36B GNW95_SetPaletteEntries_
|
||||
*/
|
||||
HRESULT __stdcall SetEntries(DWORD a, DWORD b, DWORD c, LPPALETTEENTRY d) { // used to set palette for splash screen, fades, subtitles
|
||||
if (!windowInit || (long)c <= 0) return DDERR_INVALIDPARAMS;
|
||||
if (!paletteInit || (long)c <= 0) return DDERR_INVALIDPARAMS;
|
||||
//palCounter++;
|
||||
|
||||
fo::PALETTE* destPal = (fo::PALETTE*)d;
|
||||
@@ -1177,12 +1176,10 @@ void Graphics::init() {
|
||||
int gMode = IniReader::GetConfigInt("Graphics", "Mode", 4);
|
||||
if (gMode >= 4) Graphics::mode = gMode;
|
||||
|
||||
if (Graphics::mode == 6) {
|
||||
//windowStyle = WS_OVERLAPPED;
|
||||
} else if (Graphics::mode < 0 && Graphics::mode > 5) {
|
||||
if (Graphics::mode < 0 && Graphics::mode > 6) {
|
||||
Graphics::mode = 0;
|
||||
}
|
||||
//IsWindowMode = (mode == 2 || mode == 5 || mode == 6);
|
||||
IsWindowedMode = (mode == 2 || mode == 3 || mode == 5 || mode == 6);
|
||||
|
||||
// DirectX9 mode
|
||||
if (Graphics::mode >= 4) {
|
||||
@@ -1222,7 +1219,7 @@ void Graphics::init() {
|
||||
};
|
||||
} else {
|
||||
DDInit:
|
||||
if (HRP::Setting::IsEnabled()) DirectDraw::init(Graphics::mode);
|
||||
if (HRP::Setting::IsEnabled()) DirectDraw::init();
|
||||
}
|
||||
|
||||
if (HRP::Setting::IsEnabled()) HRP::MoviesScreen::SetDrawMode(Graphics::mode < 4);
|
||||
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
static DWORD mode;
|
||||
static DWORD GPUBlt;
|
||||
static bool IsWindowMode;
|
||||
static bool IsWindowedMode;
|
||||
|
||||
static long GetGameWidthRes();
|
||||
static long GetGameHeightRes();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@ namespace sfall
|
||||
|
||||
class DirectDraw {
|
||||
public:
|
||||
static void init(long);
|
||||
static void init();
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct PALCOLOR {
|
||||
|
||||
+11
-1
@@ -17,6 +17,7 @@ namespace sfall
|
||||
|
||||
static HWND window;
|
||||
static Rectangle win;
|
||||
static POINT client;
|
||||
|
||||
static long moveWindowKey[2];
|
||||
static long windowData;
|
||||
@@ -38,6 +39,11 @@ static int __stdcall WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||
__asm call fo::funcoffs::exit_;
|
||||
return 1;
|
||||
|
||||
case WM_MOVE:
|
||||
client.x = LOWORD(lParam);
|
||||
client.y = HIWORD(lParam);
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if (bkgndErased || !window) return 1;
|
||||
bkgndErased = true;
|
||||
@@ -135,7 +141,7 @@ void WinProc::SetHWND(HWND _window) {
|
||||
|
||||
void WinProc::SetSize(long w, long h) {
|
||||
win.x = 0;
|
||||
win.x = 0;
|
||||
win.y = 0;
|
||||
win.width = w;
|
||||
win.height = h;
|
||||
}
|
||||
@@ -260,6 +266,10 @@ void WinProc::SavePosition(long mode) {
|
||||
}
|
||||
}
|
||||
|
||||
const POINT* WinProc::GetClientPos() {
|
||||
return &client;
|
||||
}
|
||||
|
||||
void WinProc::init() {
|
||||
// Replace the engine WindowProc_ with sfall one
|
||||
MakeJump(0x4DE9FC, WindowProc); // WindowProc_
|
||||
|
||||
+4
-2
@@ -16,10 +16,10 @@ public:
|
||||
static void SetWindowProc();
|
||||
|
||||
static void SetHWND(HWND _window);
|
||||
static void SetSize(long w, long h);
|
||||
static void SetTitle(long gWidth, long gHeight);
|
||||
static void SetSize(long w, long h);
|
||||
|
||||
//Sets the window style and its position
|
||||
// Sets the window style and its position
|
||||
static void SetStyle(long windowStyle);
|
||||
|
||||
static void SetMoveKeys();
|
||||
@@ -28,6 +28,8 @@ public:
|
||||
static void SetToCenter(long wWidth, long wHeight, long* outX, long* outY);
|
||||
static void LoadPosition();
|
||||
static void SavePosition(long mode);
|
||||
|
||||
static const POINT* GetClientPos();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user