Jump to content

Metin2 TitleBar Move Frezze


Recommended Posts

  • Premium

Sure, one way would be to edit:

	m_hWnd = CreateWindow(
						c_szClassName,
						c_szName,
						ws, 
						0, 0, 0, 0, 
						NULL,
						NULL, 
						ms_hInstance,
						NULL);

with:

	m_hWnd = CreateWindow(
						c_szClassName,
						c_szName,
						WS_POPUPWINDOW, 
						0, 0, 0, 0, 
						NULL,
						NULL, 
						ms_hInstance,
						NULL);

but then you wouldn't be able to move the window. There are no other options, it's not something Metin2 related. Example with League of Legends: https://metin2.download/picture/rtHUIDMCI46GWea92kVDLh526CQLDs52/.gif

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites

  • Active Member
9 hours ago, xXIntelXx said:

Sure, one way would be to edit:

	m_hWnd = CreateWindow(
						c_szClassName,
						c_szName,
						ws, 
						0, 0, 0, 0, 
						NULL,
						NULL, 
						ms_hInstance,
						NULL);

with:

	m_hWnd = CreateWindow(
						c_szClassName,
						c_szName,
						WS_POPUPWINDOW, 
						0, 0, 0, 0, 
						NULL,
						NULL, 
						ms_hInstance,
						NULL);

but then you wouldn't be able to move the window. There are no other options, it's not something Metin2 related. Example with League of Legends: https://metin2.download/picture/rtHUIDMCI46GWea92kVDLh526CQLDs52/.gif

Is possbile to fix freeze https://metin2.download/picture/EqE25nM629xiDD2Dh8Bvh86Q7Cg4QbJG/.gif

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Premium
17 minutes ago, Vaynz said:

Legit every game (new or old, DirectX9/10/11/12/Vulkan) I've tried freezes (the only exception was Forza Horizon but they use UWP). And rightly so, what's the point to even fix it? Obviously, only on Metin (because of the stupid fly).

What's the server's name btw? (in DM if you want to)

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Active Member
18 minutes ago, xXIntelXx said:

Legit every game (new or old, DirectX9/10/11/12/Vulkan) I've tried freezes (the only exception was Forza Horizon but they use UWP). And rightly so, what's the point to even fix it? Obviously, only on Metin (because of the stupid fly).

What's the server's name btw? (in DM if you want to)

The point of this fix is for PvP, if you have someone in hit, and hold the bar after he escape and u release the top bar, literally enemy is pulled up to you.

Link to comment
Share on other sites

  • Premium
1 minute ago, Vaynz said:

The point of this fix is for PvP, if you have someone in hit, and hold the bar after he escape and u release the top bar, literally enemy is pulled up to you.

Yeah, no, I know about that (I edited the post later). The real fix is to actually nuke the fly to the moon, but players just got accustomed to that bug, so, here we are.

Edited by xXIntelXx
Link to comment
Share on other sites

  • Premium

So, I said "it's not something Metin2 related." which, it's half true, half false. I still stand by the fact that the fly it's a bug and there are better ways to legalize it (for example: Riven, a LoL character, used animation cancels, derived by bugs, to maximize her damage. Riot at some point decided to fix her, and keep her gameplay the same. The real fix to this nasty fly bug, should be to actually make the fly an actual character state controlled by the server, but that's a whole other discussion).

 

So, after reading some Microsoft docs and trying to find anything meaningful, I stumbled across the holy grail, stackoverlow.

At the end of the answer, it was pointed out "That is, are people really going to be dragging the window WHILE playing, unlikely.", rightly so, I'd say. It doesn't surprise me that no game, and I mean, not a single goddamn game, does not freeze if you move around the window. I mean, why a developer would take time even thinking about that, it doesn't make sense. But this is Metin2, and this bug, it's somehow a core mechanic that, if removed, you can expect your players at your house with trucks and pitchforks.

The answer on the stackoverflow discussione stated:

Your application is most likely "freezing" because it has a WinMain loop similar to this:

while (true) 
{
    if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
    {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    else
    {
       TickGame();
    }
}

and guess effing what, there's a very similar looking function in the client


One solution would be to handle the Windows messages about the moving/clicking on the toolbar:

WM_ENTERSIZEMOVE

WM_EXITSIZEMOVE

WM_MOVE

 

WM_MOVE, if the hWnd is available, otherwise it crashes while opening the client, can call directly the main rendering function of the client, while ENTERSIZEMOVE and EXITSIZEMOVE needs to handle a special timer, which will call the rendering function when Windows sends the TIMER message. In pseudocode:

if (event_is_resize_start)
{
    Start_Win32Timer();
}
if (event_is_resize_end)
{
    Kill_Win32Timer();
}


WindowsMessages
{
  	//[...]
 	WM_TIMER:
  		render();
}

 

The only "issue" will be a small delay when clicking the titlebar, but the character will still keep performing whatever action it was doing, instead of standing still in position (keeping the enemy "flyed bugged down"). Normally, one shouldn't be able to do that, therefore we could really not care about the smoothness of it.

 

 

  • Good 1
Link to comment
Share on other sites

  • Premium

PythonApplicationProcedure.cpp

 

Search for the function:
 

LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)

 

 

Inside it, go over to the switch cases, and add the following:
 

		case WM_MOVE:
			if (hWnd == GetCapture())
				Process();
			break;

		case WM_CONTEXTMENU:
				return 0;
			break;

 

After doing so, the client won't be freezed while the context menu is open (you can't even open it anymore) and, it will render while you move it.

However, if you still keep the click pressed on the titlebar, the game will freeze.

  • Good 2
  • Love 2
Link to comment
Share on other sites

  • Active Member
9 minutes ago, dumita123 said:

PythonApplicationProcedure.cpp

 

Search for the function:
 

LRESULT CPythonApplication::WindowProcedure(HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)

 

 

Inside it, go over to the switch cases, and add the following:
 

		case WM_MOVE:
			if (hWnd == GetCapture())
				Process();
			break;

		case WM_CONTEXTMENU:
				return 0;
			break;

 

After doing so, the client won't be freezed while the context menu is open (you can't even open it anymore) and, it will render while you move it.

However, if you still keep the click pressed on the titlebar, the game will freeze.

Aswell can be moved on multi threading, like a hint. Not a bad ideea Corky ! 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.