Jump to content
×
×
  • Create New...

Fix Camera when Minimize Client


Recommended Posts

  • Moon

An annoying bug which need a fix.

Gif with the problem (from ѕeмa™) https://i.gyazo.com/db1258c3801207dc8f1ff5b15d25d1c0.gif

// PythonApplicationProcedure.cpp
// After:
					if (m_isWindowFullScreenEnable)
					{
						__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
					}
// Just add:
					OnMouseMiddleButtonUp(0, 0);

 

Edited by Abel(Tiger)
  • Metin2 Dev 20
  • Love 32
  • Love 1
  • Good 4
Link to comment
  • 7 months later...
  • 4 weeks later...
  • 4 months later...
On 8/27/2017 at 8:41 PM, lordsas61 said:

this guy is right ,  this fix creates an error which execute when you exit the game . and it only happens if you're still on the game .

 

the ??????????????? ???? error thing pops up . 

 

its not a big deal but yeah its not also a proper fix . 

Link to comment
  • 2 months later...
  • 8 months later...
  • 2 years later...

I am reviving this discussion to say, yeah this just causes a crash during the closing of the client. I was trying to finally tackle all the .dmp files generated and everytime they pointed to "SetCursorNum".

a2qby8l.png

 

As I fix, I did something a little bit dirty but effective.

in PythonApplicationCursor.cpp, in the function bool CPythonApplication::CreateCursors(), under:

m_bLiarCursorOn = false;

add:

m_bCursorsDestroyed = false;

 

at the end of the function void CPythonApplication::DestroyCursors(), add:

m_bCursorsDestroyed = true;

 

then modify the void CPythonApplication::__ResetCameraWhenMinimize() like this:

void CPythonApplication::__ResetCameraWhenMinimize()
{
	CCameraManager& rkCmrMgr = CCameraManager::Instance();
	CCamera* pkCmrCur = rkCmrMgr.GetCurrentCamera();
	if (pkCmrCur)
	{
		pkCmrCur->EndDrag();
	}
	if(!m_bCursorsDestroyed)
	{
		SetCursorNum(NORMAL);
		if (CURSOR_MODE_HARDWARE == GetCursorMode())
			SetCursorVisible(TRUE);
	}
}

and finally declare m_bCursorsDestroyed in PythonApplication.h under m_bCursorVisible:

NcvwlLF.png

 

 

Result:

 

daCRM8f.png

Edited by xXIntelXx
and -> under
Link to comment
Just now, ReFresh said:

You mean under DestroyCursor((HCURSOR) itor->second);?

Yeah, outside the for loop of course:

void CPythonApplication::DestroyCursors()
{
	TCursorHandleMap::iterator itor;
	for (itor = m_CursorHandleMap.begin(); itor != m_CursorHandleMap.end(); ++itor)
	{
		DestroyCursor((HCURSOR) itor->second);
	}
	m_bCursorsDestroyed = true;
}

 

Link to comment
  • Moon

The tutorial is very old 😅

New tutorial:

// PythonApplicationProcedure.cpp
// After:
					if (m_isWindowFullScreenEnable)
					{
						__MinimizeFullScreenWindow(hWnd, m_dwWidth, m_dwHeight);
					}
// Just add:
					OnMouseMiddleButtonUp(0, 0);

That's all! 😬

  • Love 3
  • Good 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


  • Read our Rules
  • Similar Content

    • By Karbust
      Sup bois and grils
      I still see a lot of people not being able to select the character when using a local server for friends or VPS behind a internal router or firewall.
      Disclaimer: This code wasn't made by me, it was originally posted on the metin2dev's French brother Funky-Emu by @Veltor88.
       
      On service.h add this:
      #define ENABLE_PROXY_IP  
      On char.cpp:
      After:
      p.lAddr = lAddr; Add:
      #ifdef ENABLE_PROXY_IP if (!g_stProxyIP.empty()) p.lAddr = inet_addr(g_stProxyIP.c_str()); #endif Like this:

       
      On config.cpp:
      After (or anywhere within the global variables definition): 
      char g_szInternalIP[16] Add:
      #ifdef ENABLE_PROXY_IP std::string g_stProxyIP = ""; #endif Like this:

       
      Still on config.cpp:
      After: the last TOKEN
      Add:
      #ifdef ENABLE_PROXY_IP TOKEN("proxy_ip") { g_stProxyIP = value_string; } #endif Like this:

       
      On config.h:
      After (or anywhere in the file):
      extern char g_szInternalIP[16]; Add:
      #ifdef ENABLE_PROXY_IP extern std::string g_stProxyIP; #endif Like this:

       
      On desc.cpp:
      Within the function:
      void DESC::SendLoginSuccessPacket() Inside: 
      for (int i = 0; i < PLAYER_PER_ACCOUNT; ++i)
      Add in the beginning:
      #ifdef ENABLE_PROXY_IP if (!g_stProxyIP.empty()) rTable.players[i].lAddr=inet_addr(g_stProxyIP.c_str()); #endif Like this:

       
      On input_db.cpp:
      Withing the function:
      bool GetServerLocation(TAccountTable & rTab, BYTE bEmpire) After:
      rTab.players[i].szName); Add:
      #ifdef ENABLE_PROXY_IP if (!g_stProxyIP.empty()) rTab.players[i].lAddr=inet_addr(g_stProxyIP.c_str()); #endif
                      
      Still on input_db.cpp and within the same function:
      After:
      struct in_addr in; Add:
      #ifdef ENABLE_PROXY_IP if (!g_stProxyIP.empty()) rTab.players[i].lAddr=inet_addr(g_stProxyIP.c_str()); #endif Like this:

       
      Still on the same file:
      Within the function:
      void CInputDB::PlayerCreateSuccess(LPDESC d, const char * data) After:
      pack.player = pPacketDB->player; Add:
      #ifdef ENABLE_PROXY_IP if (!g_stProxyIP.empty()) pack.player.lAddr=inet_addr(g_stProxyIP.c_str()); #endif Like this:

       
      Done on the source, you can compile.

      On every channel config, add this:
      BIND_IP: <Private IPv4 IP> (it will be something within a private IP class. Check the IP of the machine using the "ifconfig" command) PROXY_IP: <Public IPv4 IP> (check out something like https://www.whatismyip.com) Private IPv4 classes:

      On some sources (like the one from vanilla, BIND_IP was renamed to PUBLIC_IP, just check which TOKEN is responsible to set the value on the variable g_szPublicIP.
      You will need to open the ports on your router, even for yourself on localhost with the virtual machine because the game server will try to "proxy" you through the public IP you defined.
      This wasn't tested using a VPN, like Hamachi or ZeroTier.
    • By Draveniou1
      Hidden Content
      Give reaction to this post to see the hidden content.
      Metin2 Download
       
      I do this topic for those who have a problem with Unknown Header operating server in France with 800-1k player online and it has been working for 5 days without problems and without kick

      Hidden Content
      Give reaction to this post to see the hidden content.  
      If you have provlem :
      Open in game.py
      search and remove:
              if constInfo.SEQUENCE_PACKET_ENABLE:
                  net.SetPacketSequenceMode()
       
      Now open constinfo.py and search and remove
      SEQUENCE_PACKET_ENABLE = 1
      ----------------------------------------------------------------------------------------------
       
      Source Client:
      Search 
      return SendSequence();
      change with
      // return disable;
       
    • By Gurgarath
      Hello! Many people complained about a "7 pixel bug" on some clients. For example the client will open a few pixels too far from the left-side of the screen. Usually between 7 and 9 pixel on the right.
      I still do not know why it happens for some people and not for other. I thought about a visual studio toolset, a screen configuration or whatever but it turns out to be harder to know why it actually happens, I also had only two people talking about this so I cannot get accurate data. Anyway, let's get started it's really easy.
      The bug looks like this, take from the official client it looks like 1 or 2 pixels only. But it looks almost exactly like it at some moments.
      First, make sure your metin2.cfg is correct and does not display a weird resolution (like 1913 * 1080).

      Then just add this small line in PythonApplication.cpp:
      SetPosition(-8, 0); Right after this one:
      AdjustSize(m_pySystem.GetWidth(), m_pySystem.GetHeight()); EDIT:
      If you happen to have it on the second window as well, move the line under the bAnotherWindow check. Just like this:
      And voilà, it's fixed. Don't hesistate to add or remove one pixel if needed.
      It's really small and looks like a workaround but I did it really quickly. I didn't test this fix on clients / computers not having the actual bug. If it is a client issue it shouldn't cause any problems, if it's a computer issue, I might need more data to fine-tune the fix. Don't forget to share some data if you have.
    • By Helia01
      Hey m2dev

      You summon a lot of monsters, they attack your character and then you kill or purge monsters, but the damage still continues to be shown visually. Is this a familiar situation?
      In addition, the damage is shown visually even after the death of the character... I love this game. 🥰


       
      I haven't seen a fix for this problem, let's try to fix this sh..


      Hidden Content
      Give reaction to this post to see the hidden content.
      I'm not saying that this is an ideal solution. If you have any ideas, please write comments.


      Best regards, Masha
    • By Shang
      M2 Download Center
      Hidden Content
      Give reaction to this post to see the hidden content. ( Internal )
      Hi devs, today I will release the fix I made for the skill cooldown, already fixed on official servers, this is the bug it self:

      And this is the fix:

      Regards!

      Hidden Content
      Give reaction to this post to see the hidden content. ### root/ui.py ### Search: def SetSlotCoolTimeColor(self, slotIndex, r, g, b, a): wndMgr.SetSlotCoolTimeColor(self.hWnd, slotIndex, r, g, b, a) ### Add after: def StoreSlotCoolTime(self, key, slotIndex, coolTime, elapsedTime = 0.0): wndMgr.StoreSlotCoolTime(self.hWnd, key, slotIndex, coolTime, elapsedTime) def RestoreSlotCoolTime(self, key): wndMgr.RestoreSlotCoolTime(self.hWnd, key)  
      Thanks to @Horinna for report that bug.
      Here's the fix:
      """ Find this: elif (not self.__CanUseSkillNow()) or (skillGrade != j): skillPage.SetSlotCount(realSlotIndex, 0) skillPage.DisableCoverButton(realSlotIndex) Add this under:""" skillPage.DeactivateSlot(realSlotIndex) # After the else, paste this: if player.IsSkillActive(slotIndex) and (skillGrade == j): # fix001 skillPage.ActivateSlot(realSlotIndex) # The if should look like this: if (skillGrade == skill.SKILL_GRADE_COUNT) and j == (skill.SKILL_GRADE_COUNT-1): skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel) elif (not self.__CanUseSkillNow()) or (skillGrade != j): skillPage.SetSlotCount(realSlotIndex, 0) skillPage.DisableCoverButton(realSlotIndex) skillPage.DeactivateSlot(realSlotIndex) # fix else: skillPage.SetSlotCountNew(realSlotIndex, skillGrade, skillLevel) if player.IsSkillActive(slotIndex) and (skillGrade == j): # fix skillPage.ActivateSlot(realSlotIndex)  
    • By Distraught
      Introduction
      I think everyone know about this famous bug. I profiled the game and checked granny documentation why it happens because we also faced this on MAP1s since we have a lot of offline shops. Actually the game not even freezes, it runs well and the updates happen. What eventually happens there is just that update time takes too long so it will skip rendering.
      What makes update times longer?
      The answer is granny controls. When you minimize your game, the completed controls never get freed. It's because the game frees them in CGrannyModelInstance::UpdateWorldPose which is called from CPythonApplication::RenderGame in a long way. There are just more and more of them that are never freed and that makes GrannySetModelClock take more and more time so when you open up your client from the minimized state it will never finish the update fast enough to call RenderGame in which they would be freed again.

      Hidden Content
      Give reaction to this post to see the hidden content. Thats all, you won't face the "black screen bug" again!
      Good luck guys! 😄
  • Activity

    1. 15

      Chest Item Info

    2. 424

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    3. 424

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    4. 424

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    5. 15

      Chest Item Info

  • Recently Browsing

    • No registered users viewing this page.

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.