Premium Speachless 759 Posted February 20, 2020 Premium Share Posted February 20, 2020 (edited) In EterPackManager.cpp update this: bool CEterPackManager::Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData) { if (m_iSearchMode == SEARCH_PACK_FIRST) { if (GetFromPack(rMappedFile, c_szFileName, pData)) return true; if (c_szFileName[1] != ':' && GetFromFile(rMappedFile, c_szFileName, pData)) { TraceError("%s", c_szFileName); // only for log. it's not an error. return true; } } if (m_iSearchMode == SEARCH_FILE_FIRST) { if (GetFromFile(rMappedFile, c_szFileName, pData)) return true; return GetFromPack(rMappedFile, c_szFileName, pData); } return false; } And bool CEterPackManager::isExist(const char * c_szFileName) { return isExistInPack(c_szFileName); } In CEterPackManager::GetFromFile comment if(m_bTryRelativePath) {.....} (not sure necessary, i did it in the past) In UserInterface set bPackFirst to true to not load from d:/ and false to load from d:/ bool bPackFirst = TRUE; bPackFirst = TRUE; There is a common problem on all metin2 sources. The game will first load the files which are in d:/ymir work folder and if you have a dvd/cd-rom with letter D the game will load very slow and have big fps drops (for some players the game can be unplayable). I know many players who had a dvd-rom with letter D and reported me how bad the client works. Using this solution: 1. The game will no longer load d:/ymir files. 2. Client will open faster, load the files faster. 3. Less fps drop. Normal metin2 client without fix and with a dvd-rom that has letter D assigned: https://metin2.download/picture/aXN97muX99n16ND113M1dJnfV0Ol6E93/.gif After fix: https://metin2.download/picture/WdjkrLm505Z9pf0JBzQ0772oXiNhMnI1/.gif Check this video: Edited August 27, 2022 by Metin2 Dev Core X - External 2 Internal 19 1 2 15 1 35 Link to comment Share on other sites More sharing options...
ElRenardo 25 Posted February 20, 2020 Share Posted February 20, 2020 Hey, Nice to see that this problem is being treated ! I'm asking myself why you're searching for "ymir" in the file name and not just compare the second letter with ":" Then, your function: bool CEterPackManager::isExist(const char * c_szFileName) { if (m_iSearchMode == SEARCH_PACK_FIRST) { if (isExistInPack(c_szFileName)) return true; } return isExistInPack(c_szFileName); } Can be shorten as: bool CEterPackManager::isExist(const char * c_szFileName) { return isExistInPack(c_szFileName); } Have you done some testings yet ? Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted February 20, 2020 Author Premium Share Posted February 20, 2020 (edited) I've done the test of course. No more slow loading if i have a dvdrom with letter D. No file is loaded from d:/ymir work I had no time to shorten the code, i just wanted to get it work and after it worked i posted for everyone. Everyone can make it better after. ########## Edited February 20, 2020 by Speachless Link to comment Share on other sites More sharing options...
ElRenardo 25 Posted February 20, 2020 Share Posted February 20, 2020 Haha, you're not a noob, that was not what I was saying. Here's what I may suggest you to not takeof some functionalities of the eterpack: In the function: bool CEterPackManager::Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData) Adding a condition to check if the filename redirect in a drive in the condition that check if we search from client file first instead of pack file as following: if (m_iSearchMode == SEARCH_FILE_FIRST && c_szFileName[1] != ':') { if (GetFromFile(rMappedFile, c_szFileName, pData)) return true; return GetFromPack(rMappedFile, c_szFileName, pData); } if (GetFromPack(rMappedFile, c_szFileName, pData)) return true; return GetFromFile(rMappedFile, c_szFileName, pData); and using this same structure we can then write the isExist function as following: bool CEterPackManager::isExist(const char * c_szFileName) { if (m_iSearchMode == SEARCH_FILE_FIRST && c_szFileName[1] != ':') { if (_access(c_szFileName, 0) == 0) return true; return isExistInPack(c_szFileName); } if (isExistInPack(c_szFileName)) return true; return _access(c_szFileName, 0) == 0 ? true : false; } What do you think ? 1 Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted February 20, 2020 Author Premium Share Posted February 20, 2020 (edited) You're way doesn't fix the slow loading when a dvdrom is connected. Edited February 20, 2020 by Speachless Link to comment Share on other sites More sharing options...
HITRON 694 Posted February 20, 2020 Share Posted February 20, 2020 (edited) @Speachless This is a simple solution. About the (D:) you could just create a different partition in your HDD called (D:) instead to bought a external dvd-roam to test the problem. You can also check if the Game is running in (D:) and after use the ":" method from @ElRenardo. This could be done much more easier with FoxFS cause in FoxFS there is just almost 8 - 10 files with d:/ymir work/ instead of the normal (Client) that have multiple patches and you can put the check only for them by name instead. Edited February 20, 2020 by HITRON Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted February 20, 2020 Author Premium Share Posted February 20, 2020 (edited) 42 minutes ago, HITRON said: @Speachless This is a simple solution. About the (D:) you could just create a different partition in your HDD called (D:) instead to bought a external dvd-roam to test the problem. You can also check if the Game is running in (D:) and after use the ":" method from @ElRenardo. This could be done much more easier with FoxFS cause in FoxFS there is just almost 8 - 10 files with d:/ymir work/ instead of the normal (Client) that have multiple patches and you can put the check only for them by name instead. Problem happens on a cd/dvd-rom not on a hard drive. ElRenardo code doesn't fix this problem. As long as you do my tutorial the problem is permanently solved with no visible performance loss or crashes. Please run some test first. Edited February 20, 2020 by Speachless 1 Link to comment Share on other sites More sharing options...
ElRenardo 25 Posted February 20, 2020 Share Posted February 20, 2020 So, for better comprehension I changed that: bool CEterPackManager::Get(CMappedFile & rMappedFile, const char * c_szFileName, LPCVOID * pData) { //TimeChecker timeChecker(c_szFileName); //Logf(1, "Load %s\n", c_szFileName); if (m_iSearchMode == SEARCH_PACK_FIRST || c_szFileName[1] == ':') { if (GetFromPack(rMappedFile, c_szFileName, pData)) return true; return GetFromFile(rMappedFile, c_szFileName, pData); } if (GetFromFile(rMappedFile, c_szFileName, pData)) return true; return GetFromPack(rMappedFile, c_szFileName, pData); } [...] bool CEterPackManager::isExist(const char * c_szFileName) { if (m_iSearchMode == SEARCH_PACK_FIRST || c_szFileName[1] == ':') { if (isExistInPack(c_szFileName)) return true; return _access(c_szFileName, 0) == 0 ? true : false; } if (_access(c_szFileName, 0) == 0) return true; return isExistInPack(c_szFileName); } So now it's working exactly as your fix even if SEARCH_FILE_FIRST is false but instead of doing nothing if the file is not found in the pack, it will try to find it in the file directory. Let me explain it a bit better: if the filename we're looking for contains ":" as second letter (for exemple "D:\Ymir Work\monster\barbarian_boss\00.gr2") then it will try to find it in packs first. If it's not found then it will try to load the file from the file directory and that will eventually cause some lags if you have as you say a dvd player as D drive, but this shouldn't occur except if you have some paths errors in your client. If this cause some lasg to your client, you maybe have some paths error and your client with your fix is certainly not loading everything. Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted February 20, 2020 Author Premium Share Posted February 20, 2020 (edited) You're confusing a thing. All metin2 sources are configured to load the files from d:/ymir work. It's only for test-environment not for release. Still my way has less performance loss. and there is no point to change. See the videos above. This is my last time i enter any forum. Same shit happened in the past and i have no patience to argue like in the old days. Run tests before post. Edited February 20, 2020 by Speachless Link to comment Share on other sites More sharing options...
Matteo 47 Posted February 20, 2020 Share Posted February 20, 2020 28 minutes ago, Speachless said: You're confusing a thing. All metin2 sources are configured to load the files from d:/ymir work. It's only for test-environment not for release. Still my way has less performance loss. and there is no point to change. See the videos above. This is my last time i enter any forum. Same shit happened in the past and i have no patience to argue like in the old days. Run tests before post. I've tested it, and works great! Why are you caring about someone else's opinion? Who cares what he/she thinks... I've implemented it, and works well, lags are gone. Big thanks! 1 System Administrator @ Hungarian Government System Administrator @ Vibestro Freelancer Developer @ Various projects Link to comment Share on other sites More sharing options...
ElRenardo 25 Posted February 20, 2020 Share Posted February 20, 2020 You misunderstood me, I didn't wanted to criticize your work in any way. I just wanted to achieve this without losing the functionality that search the file in the file directory if not found in the packs. But as you said, it should only be used in test env. Quote This is my last time i enter any forum. Same shit happened in the past and i have no patience to argue like in the old days. Run tests before post. Why couldn't we talk about other options or improving options ? As you said before: Quote I had no time to shorten the code, i just wanted to get it work and after it worked i posted for everyone. Everyone can make it better after. I don't understand your reaction. Maybe you had a hard day. 1 Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted February 20, 2020 Author Premium Share Posted February 20, 2020 (edited) I did multitasking and I burned my brain that's why i reacted like that. Posting on dev, writing on discord, answering to questions in the game, fixing a post on server's forum, checking the code, configuring a vps. all in the same time. #include <iostream> using namespace std; int main() { std::string FileNameStr = "d:/ymir work"; if (FileNameStr.find("ymir") == string::npos) cout<<"Hello World"; else cout<<"it is ymir"; } CPU Time: 0.00 sec(s), Memory: 3236 kilobyte(s) #include <iostream> using namespace std; int main() { std::string FileNameStr = "d:/ymir work"; if (FileNameStr[1] != ':') cout<<"Hello World"; else cout<<"it is ymir"; } CPU Time: 0.00 sec(s), Memory: 3240 kilobyte(s) And there is no performance difference between "ymir" and : It is more acurate with : i know. But both works in metin2 case and once i will test with : i will update the post. Edited February 20, 2020 by Speachless Link to comment Share on other sites More sharing options...
Morpheus™ 47 Posted February 20, 2020 Share Posted February 20, 2020 Hi guys! For me, these changes won't start the client (marty src) Link to comment Share on other sites More sharing options...
Evo 6 Posted February 20, 2020 Share Posted February 20, 2020 3 minutes ago, Morpheus™ said: Hi guys! For me, these changes won't start the client (marty src) I'm guessing a solution for you index file -> change if you have all "d:/ymir work" to -> "pack/" Link to comment Share on other sites More sharing options...
Morpheus™ 47 Posted February 20, 2020 Share Posted February 20, 2020 (edited) 12 minutes ago, Evo said: I'm guessing a solution for you index file -> change if you have all "d:/ymir work" to -> "pack/" Thanks, but the error still exists (no syserr) edit: If these 2 values are FALSE, the client will not start bool bPackFirst = TRUE; bPackFirst = TRUE; Edited February 20, 2020 by Morpheus™ Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted February 21, 2020 Author Premium Share Posted February 21, 2020 (edited) Topic updated. Should work ok for marty now too and you can chose if you want to load from d or not. Edited February 21, 2020 by Speachless 1 Link to comment Share on other sites More sharing options...
Jimmermania 27 Posted May 1, 2020 Share Posted May 1, 2020 Hello, i did your tutorial. I use martysama client. The game starts and works normally. I have to change something else? i mean to replace d:// with something else? or since i replaced to your functions im ready? Link to comment Share on other sites More sharing options...
Sherer 481 Posted May 1, 2020 Share Posted May 1, 2020 I don't see the point of disabling loading files from pack. As I'm concerned, client built in distribute mode has this option disabled by default. On the other hand you can just disable this option by setting appropriate mode (sometimes reading from disc is useful for debugging stuff). Link to comment Share on other sites More sharing options...
Premium Speachless 759 Posted May 2, 2020 Author Premium Share Posted May 2, 2020 On 5/1/2020 at 3:23 PM, Sherer said: I don't see the point of disabling loading files from pack. As I'm concerned, client built in distribute mode has this option disabled by default. On the other hand you can just disable this option by setting appropriate mode (sometimes reading from disc is useful for debugging stuff). There is a bug when you have CD/DVD-ROM with letter D on some sources the game will work very bad. This is the main reason of the tutorial, however nobody has any obligation to use my code. Link to comment Share on other sites More sharing options...
Sherer 481 Posted May 2, 2020 Share Posted May 2, 2020 (edited) 1 hour ago, Speachless said: There is a bug when you have CD/DVD-ROM with letter D on some sources the game will work very bad. This is the main reason of the tutorial, however nobody has any obligation to use my code. Yeah that's pretty normal. Anyway had one builds its client files should not be read from disk at all (security reason; with exception for whitelist). Edited May 2, 2020 by Sherer Link to comment Share on other sites More sharing options...
Premium DemOnJR 564 Posted May 5, 2020 Premium Share Posted May 5, 2020 any version for foxfs? 1 Link to comment Share on other sites More sharing options...
iShadoW 3 Posted November 5, 2020 Share Posted November 5, 2020 fix for foxfs? 1 Link to comment Share on other sites More sharing options...
flww 1 Posted November 6, 2020 Share Posted November 6, 2020 foxfs pls Link to comment Share on other sites More sharing options...
szotyizz 61 Posted February 13, 2021 Share Posted February 13, 2021 0213 22:17:28880 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:17:28880 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:17:30100 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:17:30100 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:17:31008 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:17:31008 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:17:31916 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:17:31916 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:17:32822 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:17:32822 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:17:33731 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:17:33731 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:18:40907 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:18:40907 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:18:43086 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:18:43086 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:18:45281 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:18:45281 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:18:46187 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:18:46187 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) 0213 22:18:52211 :: Not a valid .WAV file: sound/pc2/assassin/bow/attack1.wav 0213 22:18:52211 :: CSoundManager3D::GetInstance (filename: sound/pc2/assassin/bow/attack1.wav) Client syserr. Link to comment Share on other sites More sharing options...
DevGcc 0 Posted February 3, 2022 Share Posted February 3, 2022 Does anyone have a solution to 2 syser drops right after this system is added? 0203 14:09:13641 :: mark\10_0.tga 0203 14:09:13665 :: BGM/enter_the_east.mp3 Link to comment Share on other sites More sharing options...
Recommended Posts