Newbie Spellweaver
- Joined
- Feb 2, 2015
- Messages
- 77
- Reaction score
- 53
[Guide] How to trying to fix some Bug or Modify in source (C++)
Hi. if you found some glitch and no idea how to fix. maybe this topic will guide you. :w00t:
first i recommend tool "Windows Grep 2.3". this tool can search reference text in source. example you see text like "Please enter new character's name". you can try to search in source folder for know where file location.
how to use this ?
1. click on Seach icon
2. put the Keyword. if you don't have Regex basic. i suggest to select Quick (no regular expressions).
3. select which folder you search suggest like this
Game Folder
- Res-Tex
ProjectAtum
- Common*
- DataRenderLib
- DirectXLib
- EtcLib
- InterfaceLib
- ProjectAtum
- SkinnedMeshLib
- SocketLib
ProjectServer
- CommonGameServer*
- FieldServer
- IMServer
- LogServer
- NPCServer
- PreServer
*some source will have only one Common folder (because they merge Client and Server into one)
GroupTex (if you know GroupTex you can add this. if no just skip)
4. Filter file extension
- *.cpp
- *.h
- ToolTipList.tex
- *.bin (if you know GroupTex you can add this. if no just skip)
5. Check Result example i search that text and get "STRMSG_C_CARD_0008" i can try check in visual studio (this text is from Client then i will goto Client source)**if have many result with can't manual filter let try filter with Regex like Case sensitive
6. when you found that line try use Visual Studio function like Find All References. this will show where this variable is using.
** if your Visual studio show "A definition for the symbol '(null)' could not be located." it mean that version is not intelligent enough. you can find again with Wingrep or lead way to your Visual Studio. ex go to main file like ProjectAtum/AtumApplication.cpp find with "STRMSG_C". if you find one STRMSG_C_XXXXXXX just right click the Go to Definition. after that try find you main again "STRMSG_C_CARD_0008" use Find All References it will work now.
ending how you use this tool.
=============================================================
Let's try on real situation
=============================================================
now i will try with real glitch with this tool. there have a little glitch in Factroy. that make player confuse. when you put Equipment item with Contour for mix it together. result item it will disappear. but you still click Reedem for get that item back.
1. i saw the "Redeem" text when hover on that accept button. then i try use Win Grep to find which file is using that text. so i found it on ToolTipList.tex. that file is store text for use it on hover something like button. then i get "STRTOOLTIP108"
2. i try Win Grep again with keyword that we got. i found 2 files but i looking for Factory. by reading their name we know it is INFItemMixFactoryWnd.cpp then i open it from visual studio.
(*you can setting open this app by admin and visual open by admin too then you can click file list to direct open on you VS)
3. i find which line is i looking. so i found m_pFactoryGetItemBtn. by reading with my eyes it's mean that variable is Redeem button. i want to know more about this. so i find m_pFactoryGetItemBtn with VS Find All Reference.
Additional Info : SetTooltipType is function for setting tooltip text 1st when button is active. 2nd when button is disable.
4. i found many data. so i try to filter by that process. the button will show when item was ready to Redeem it mean normally not showing. and there are have one ShowWindow(TRUE). that was i looking for. follow the clue
5. i read the code what situation make this Reedem button show. i think it is "if(pVecTaget->size() > 0)". so i debug this function. i know know pVecTaget is Result item. if have result item so show Redeem button. that how it work. i know the point. it is "pVecTaget->size()" but i didn't found about Icon because it just make Redeem button show. i looking for make Icon showing. so i looking into
the GetvecTarget() look like it give that we need info. so let find is there any function use this too.
* if you don't know how to debug just put this code with your text then try in-game that menu if it happen that mean you closer that you want.
6. i found 3 of function use GetvecTarget() there are
- UpdateMakeBtn() is what we 1st found and there any make icon show then no.
- RenderSourceItem() seem to be have many line code there have some variable use name Icon
- GetTargetVecItemCount() this function Prefix name is Get by looking it have 15 line code with just return only number then no
then we focus at RenderSourceItem() and use GetvecTarget() for lead us.
this line mean it declare pVecTarget. so what we wait just find which line is use pVecTarget
* Vector is like array put many variable at once like put 10 people in one room.
7. we found 2 condition it is if and else. but no idea what it does.
we know pVecTarget it is when have result item.
how about itTarget ? then right click > Peek Definition
*::iterator it mean declare this variable is for 1 data of all vector (like array)
it's like you put 10 people to 1 room right. then ::iterator is mean 1 people data.
now we can translate that condition to human logic. it mean if have ready for Redeem item use 1st condition or 2nd condition
so if you on in-game when you put item without click Combine it go to Condition 2
and after click Combine it will go to Condition 1
** if you can't read by eyes just use ChatChild debug. then see what is it different in-game.
8. we skip Condition 2 because we no need to do anything there.
and looking deeper. now have 3 condition it easier to in-game debug by put ChatChild text and try put item into factory then Combine it will show what condition you got.
- Condition 1 is pTargetItem it came from FindItemFromTarget() function by ItemUID. like when you combine Countable. such as SP Repair Kit, Search Eye.
- Condition 2 is Uncountable item like equipment but it should have from Database Recipe
- Condition 3 is Uncountable item and cant find result item from Database Recipe
there is we are. the glitch should happen here. we closer to fix.
9. next in condition 3 we found RenderMixSourceItemInfo
look at code in this Condition is seem fine. why it not show item?? so let Right click on that function for know more detail.
so we know know 1st parameter is ItemNum that point. maybe this situation can't use the right item.
10. next point is find the right ItemNum. then we look back into main function. and looking what variable that we can get right ItemNum. so we found itTarget that have ItemNum. this item is result item. (for sure you can try debug that variable is same item you want or not by ChatChild)
11. we got ItemNum now but need new condition for this.
Condition 1 : Item not Countable
Condition 2 : Item not in Recipe
Condition 3 : Item should be Equip item (but it success by condition 1 already)
Condition 4 : Item can be put effect/contour
so we copy else { xxx } condition then insert upper there paste and replace
m_struWillResultTargetMixInfo.TargetItemNum with pTagetItem
code should be like this
*if you source dont have IS_ENABLE_CHANGE_ShapeItemNum just make it like this and put it some where in ProjectAtum/Common/AtumParam.h
12. now let compiler and test in-game. it's working!
by the way. this glitch is not 100% fix because you can't hover them for show detail like normal. it need to fix another point but this guide will end here. if you learn something on this you definite fix by yourself with my guide.
hope this will help newbie to touch c++ with just not wait for copy and paste.
Hi. if you found some glitch and no idea how to fix. maybe this topic will guide you. :w00t:
first i recommend tool "Windows Grep 2.3". this tool can search reference text in source. example you see text like "Please enter new character's name". you can try to search in source folder for know where file location.
how to use this ?
1. click on Seach icon
2. put the Keyword. if you don't have Regex basic. i suggest to select Quick (no regular expressions).
3. select which folder you search suggest like this
Game Folder
- Res-Tex
ProjectAtum
- Common*
- DataRenderLib
- DirectXLib
- EtcLib
- InterfaceLib
- ProjectAtum
- SkinnedMeshLib
- SocketLib
ProjectServer
- CommonGameServer*
- FieldServer
- IMServer
- LogServer
- NPCServer
- PreServer
*some source will have only one Common folder (because they merge Client and Server into one)
GroupTex (if you know GroupTex you can add this. if no just skip)
4. Filter file extension
- *.cpp
- *.h
- ToolTipList.tex
- *.bin (if you know GroupTex you can add this. if no just skip)
5. Check Result example i search that text and get "STRMSG_C_CARD_0008" i can try check in visual studio (this text is from Client then i will goto Client source)**if have many result with can't manual filter let try filter with Regex like Case sensitive
6. when you found that line try use Visual Studio function like Find All References. this will show where this variable is using.
** if your Visual studio show "A definition for the symbol '(null)' could not be located." it mean that version is not intelligent enough. you can find again with Wingrep or lead way to your Visual Studio. ex go to main file like ProjectAtum/AtumApplication.cpp find with "STRMSG_C". if you find one STRMSG_C_XXXXXXX just right click the Go to Definition. after that try find you main again "STRMSG_C_CARD_0008" use Find All References it will work now.
ending how you use this tool.
=============================================================
Let's try on real situation
=============================================================
now i will try with real glitch with this tool. there have a little glitch in Factroy. that make player confuse. when you put Equipment item with Contour for mix it together. result item it will disappear. but you still click Reedem for get that item back.
1. i saw the "Redeem" text when hover on that accept button. then i try use Win Grep to find which file is using that text. so i found it on ToolTipList.tex. that file is store text for use it on hover something like button. then i get "STRTOOLTIP108"
2. i try Win Grep again with keyword that we got. i found 2 files but i looking for Factory. by reading their name we know it is INFItemMixFactoryWnd.cpp then i open it from visual studio.
(*you can setting open this app by admin and visual open by admin too then you can click file list to direct open on you VS)
3. i find which line is i looking. so i found m_pFactoryGetItemBtn. by reading with my eyes it's mean that variable is Redeem button. i want to know more about this. so i find m_pFactoryGetItemBtn with VS Find All Reference.
Additional Info : SetTooltipType is function for setting tooltip text 1st when button is active. 2nd when button is disable.
4. i found many data. so i try to filter by that process. the button will show when item was ready to Redeem it mean normally not showing. and there are have one ShowWindow(TRUE). that was i looking for. follow the clue
5. i read the code what situation make this Reedem button show. i think it is "if(pVecTaget->size() > 0)". so i debug this function. i know know pVecTaget is Result item. if have result item so show Redeem button. that how it work. i know the point. it is "pVecTaget->size()" but i didn't found about Icon because it just make Redeem button show. i looking for make Icon showing. so i looking into
PHP:
vector<CItemInfo*> *pVecTarget = ((CINFCityLab*)m_pParent)->GetvecTarget();
the GetvecTarget() look like it give that we need info. so let find is there any function use this too.
* if you don't know how to debug just put this code with your text then try in-game that menu if it happen that mean you closer that you want.
PHP:
g_pD3dApp->m_pChat->CreateChatChild("Text Here ",COLOR_ERROR);
6. i found 3 of function use GetvecTarget() there are
- UpdateMakeBtn() is what we 1st found and there any make icon show then no.
- RenderSourceItem() seem to be have many line code there have some variable use name Icon
- GetTargetVecItemCount() this function Prefix name is Get by looking it have 15 line code with just return only number then no
then we focus at RenderSourceItem() and use GetvecTarget() for lead us.
PHP:
vector<CItemInfo*> *pVecTarget = ((CINFCityLab*)m_pParent)->GetvecTarget();
this line mean it declare pVecTarget. so what we wait just find which line is use pVecTarget
* Vector is like array put many variable at once like put 10 people in one room.
7. we found 2 condition it is if and else. but no idea what it does.
PHP:
if( itTarget != pVecTarget->end())
we know pVecTarget it is when have result item.
how about itTarget ? then right click > Peek Definition
PHP:
vector<CItemInfo*>::iterator itTarget = pVecTarget->begin();
*::iterator it mean declare this variable is for 1 data of all vector (like array)
it's like you put 10 people to 1 room right. then ::iterator is mean 1 people data.
now we can translate that condition to human logic. it mean if have ready for Redeem item use 1st condition or 2nd condition
so if you on in-game when you put item without click Combine it go to Condition 2
and after click Combine it will go to Condition 1
** if you can't read by eyes just use ChatChild debug. then see what is it different in-game.
8. we skip Condition 2 because we no need to do anything there.
and looking deeper. now have 3 condition it easier to in-game debug by put ChatChild text and try put item into factory then Combine it will show what condition you got.
- Condition 1 is pTargetItem it came from FindItemFromTarget() function by ItemUID. like when you combine Countable. such as SP Repair Kit, Search Eye.
- Condition 2 is Uncountable item like equipment but it should have from Database Recipe
- Condition 3 is Uncountable item and cant find result item from Database Recipe
there is we are. the glitch should happen here. we closer to fix.
9. next in condition 3 we found RenderMixSourceItemInfo
PHP:
RenderMixSourceItemInfo(m_struWillResultTargetMixInfo.TargetItemNum, 0, nIconStartX, nIconStartY, m_pItemListFont, TRUE);
look at code in this Condition is seem fine. why it not show item?? so let Right click on that function for know more detail.
so we know know 1st parameter is ItemNum that point. maybe this situation can't use the right item.
10. next point is find the right ItemNum. then we look back into main function. and looking what variable that we can get right ItemNum. so we found itTarget that have ItemNum. this item is result item. (for sure you can try debug that variable is same item you want or not by ChatChild)
11. we got ItemNum now but need new condition for this.
Condition 1 : Item not Countable
Condition 2 : Item not in Recipe
Condition 3 : Item should be Equip item (but it success by condition 1 already)
Condition 4 : Item can be put effect/contour
so we copy else { xxx } condition then insert upper there paste and replace
m_struWillResultTargetMixInfo.TargetItemNum with pTagetItem
code should be like this
PHP:
else if (IS_ENABLE_CHANGE_ShapeItemNum(pTagetItem->ItemInfo->Kind))
{
RenderItemInfo(pTagetItem, nIconStartX, nIconStartY, m_pItemListFont, 0, TRUE);
}
*if you source dont have IS_ENABLE_CHANGE_ShapeItemNum just make it like this and put it some where in ProjectAtum/Common/AtumParam.h
PHP:
#define IS_ENABLE_CHANGE_ShapeItemNum (IS_WEAPON(_ITEM_KIND) || ITEMKIND_MARK == (_ITEM_KIND) || ITEMKIND_DEFENSE == (_ITEM_KIND) || ITEMKIND_RADAR == (_ITEM_KIND) || ITEMKIND_PET_ITEM == (_ITEM_KIND))
12. now let compiler and test in-game. it's working!
by the way. this glitch is not 100% fix because you can't hover them for show detail like normal. it need to fix another point but this guide will end here. if you learn something on this you definite fix by yourself with my guide.
hope this will help newbie to touch c++ with just not wait for copy and paste.