reman3/game_re/gh_fix/setupWindow.cxx

106 lines
3.2 KiB
C++

// AUTO-GENERATED FILE, MOVE TO 'gh_fix' FOLDER PREVENT OVERWRITING!!!!!
#include <r3/binders/auto.h>
#include <gh_global.h>
extern "C" {
long CALLBACK r3_windowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); // 004025e0 // r3_windowProc
undefined fn_bCreateMainDisplayScreen(void); // 004022f0 // fn_bCreateMainDisplayScreen
void loadSplashBitmap(HWND unused); // 00402450 // loadSplashBitmap
void setGameHWND3(HWND wnd); // 0043e620 // setGameHWND3
// 00402140
int setupWindow(HINSTANCE instance,undefined4 param_2,int windowedParam)
{
ATOM AVar1;
int windowHeight;
int yCaption;
HWND hWnd;
HWND pHVar2;
int r0;
BOOL success;
bool windowed;
GLD_DeviceAttributes *windowParams;
DWORD dwStyle;
WNDCLASSA wndClass;
int showWindow;
int windowWidth;
g_windowInitialized = 1;
/* WindowClassA (overlaps usage below) */
wndClass.style = 0x3003;
wndClass.lpfnWndProc = r3_windowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = instance;
wndClass.hIcon = LoadIconA(instance,(LPCSTR)0x65);
wndClass.hCursor = LoadCursorA((HINSTANCE)0x0,(LPCSTR)0x7f00);
wndClass.hbrBackground = (HBRUSH)COLOR_WINDOWFRAME;
wndClass.lpszMenuName = (LPCSTR)0x0;
wndClass.lpszClassName = g_windowTitle;
AVar1 = RegisterClassA(&wndClass);
if (AVar1 != 0) {
windowed = windowedParam == 0;
if (windowed) {
/* SM_CXSIZEFRAME */
windowWidth = GetSystemMetrics(32);
/* x*2 + 320 */
windowWidth = windowWidth * 2 + 320;
/* SM_CYSIZEFRAME, retrieves the size of the vertical resizing border */
windowHeight = GetSystemMetrics(33);
/* SM_CYCAPTION, The height of a caption area, in pixels */
yCaption = GetSystemMetrics(4);
/* ebp still 0 at this point */
windowHeight = yCaption + 240 + windowHeight * 2;
dwStyle = 0x90cf0000;
}
else {
windowHeight = 0xf0;
windowWidth = 0x140;
dwStyle = 0x91000000;
}
hWnd = CreateWindowExA(0,g_windowTitle,g_windowTitle,dwStyle,(uint)windowed,(uint)windowed,
windowWidth,windowHeight,(HWND)0x0,(HMENU)0x0,instance,(LPVOID)0x0);
g_gameHWND1 = hWnd;
if (hWnd != (HWND)0x0) {
g_gameHWND = hWnd;
SetWindowTextA(hWnd,s_windowTitle);
if (windowedParam == 0) {
/* SW_NORMAL */
showWindow = 1;
}
else {
/* SW_MAXIMIZE */
showWindow = 3;
}
ShowWindow(hWnd,showWindow);
SetWindowPos(hWnd,(HWND)0x0,0,0,0,0,0x43);
EnableWindow(hWnd,1);
SetFocus(hWnd);
UpdateWindow(hWnd);
SetForegroundWindow(hWnd);
pHVar2 = GetFocus();
while (pHVar2 != hWnd) {
SetWindowPos(hWnd,(HWND)0x0,0,0,0,0,0x43);
EnableWindow(hWnd,1);
SetFocus(hWnd);
UpdateWindow(hWnd);
SetForegroundWindow(hWnd);
pHVar2 = GetFocus();
}
setGameHWND3(hWnd);
loadSplashBitmap(hWnd);
/* unused? */
g_windowInitialized = 1;
r0 = fn_bCreateMainDisplayScreen();
return r0;
}
}
/* Failed */
return 0;
}
}