MasterToma Posted July 17, 2018 Posted July 17, 2018 (edited) I think there is no point to be so pathetic. I'm trying to help you to complete this big work finally, since you've made it public, and probably you want it to be as much usable as it could be. Have to remove your smile mod, since it's done for all cases, instead of doing it properly, where it's needed. But let's skip it finally. I don't know which diff you are using, and don't want to know, but it's obvious that this diff is not right. Ors are missed in about 20 classes (corpse_of_kurtz 1 of them) More complicated case fairy_mymyu Empty parameers here and in quest_0503_imperial_gravekeeper , rodd class party_leader_ag_casting_curse : party_leader_casting_curse parameter_define_begin parameter_define_end Edited July 17, 2018 by MasterToma
MasterToma Posted July 17, 2018 Posted July 17, 2018 (edited) Const pushing looks like in wrong place (tor) tutorial_quest_npc original: push_const 4194304 push_const 2097152 bit_or push_const 8388608 bit_or not bit_and assign recompiled push_const 4194304 not bit_and push_const 2097152 bit_or push_const 8388608 bit_or assign Edited July 17, 2018 by MasterToma
MasterToma Posted July 17, 2018 Posted July 17, 2018 Some of them are not crucial (like empty parameters), some - might be, deeper check is needed. But there is not "only jump" :)
verbrannt Posted July 17, 2018 Author Posted July 17, 2018 Yeah. Associativity & precedence was broken. Fix in master. 1
MasterToma Posted July 18, 2018 Posted July 18, 2018 Great! 1. I've decompiled C1 ai.obj from leaked CHN server using @verbrannt's decompiler (branch c1-support) 2. Compiled back ai.nasc without any changes, using my C1 AI compiler 3. Splited compiled AI classes from original ai.obj and recompiled ai_decompiled.obj in separate files 4. Compared 2 directories (with ignore L\d* and fetch_i\s*//\s*(npc_)class_id Here is result https://ibb.co/jSNsBy Original obj code 1. extra jump is present in 10 files. This jump jumps to next line, so it's completely useless. Don't know, why compiler generates it 2. empty parameters in 4 classes (selected ones on picture) are present in original obj and missed after recompilation. This also could be ignored class party_leader_ag_casting_curse : party_leader_casting_curse parameter_define_begin parameter_define_end ... So, I could say, it's first decompiler for ai.obj, which works (I mean it) at least for C1. But in general, code syntax wasn't changed much in NAS language (I've checked compiler from C4 - only diagnostics were improved and few minor generator changes, but lexer/parser are the same).
MasterToma Posted July 18, 2018 Posted July 18, 2018 (edited) I would like to request minor (is it?) improvement. There are a lot of cases, where strings are present inside decompiled NAS file. E.g. TelPosList Position = { {"古鲁丁城镇"; -80749; 149834; -3043; 18000; 0} }; But actually, there should be ID from fstring.txt file. Originally, NAS Lexer translates ID from fstring.txt for TelPosList, and Code-Generator inserts string in ai.obj So, this should be like this TelPosList Position = { {1000003; -80749; 149834; -3043; 18000; 0} }; It allowed NCSoft to do script language-agnostic. Similar for AddChoise, but case is more complicated there, since it requires QuestDataChecker.exe Edited July 18, 2018 by MasterToma
verbrannt Posted July 18, 2018 Author Posted July 18, 2018 (edited) 9 hours ago, MasterToma said: I would like to request minor (is it?) improvement. There are a lot of cases, where strings are present inside decompiled NAS file. E.g. TelPosList Position = { {"古鲁丁城镇"; -80749; 149834; -3043; 18000; 0} }; But actually, there should be ID from fstring.txt file. Originally, NAS Lexer translates ID from fstring.txt for TelPosList, and Code-Generator inserts string in ai.obj So, this should be like this TelPosList Position = { {1000003; -80749; 149834; -3043; 18000; 0} }; It allowed NCSoft to do script language-agnostic. Similar for AddChoise, but case is more complicated there, since it requires QuestDataChecker.exe I've added issue for this. Result should have comment with original string like this: {1000003; -80749; 149834; 0} // 1000003 - 古鲁丁城镇 Edited July 18, 2018 by verbrannt 1
verbrannt Posted July 20, 2018 Author Posted July 20, 2018 (edited) New release: https://github.com/madyanov/nasc-decompiler/releases/tag/v1.5 Fixed broken precedence & associativity (thx @master-toma for feedback) Recompiled AI now almost the same as original AI (at least C1, thx @master-toma for feedback) GF AI now decompiles without errors (no ignored classes) C1 datapack by @master-toma GD datapack updates by @ChaosPaladin Datapack format changes (enums.json -> pch.json, manual_pch.txt now parsed automatically) AI chronicles now detected automatically Added --output, --ignore & --config options --chronicle option renamed to --chronicles Decompiled AI examples: MEGA Your feedback & PRs are welcome. Edited July 20, 2018 by verbrannt
zconll Posted July 20, 2018 Posted July 20, 2018 Thanks you for the new update, for c1 support we have download c1-support branch from repository?
verbrannt Posted July 20, 2018 Author Posted July 20, 2018 46 minutes ago, zconll said: Thanks you for the new update, for c1 support we have download c1-support branch from repository? Yeah, wrong release title :) C1 support now only in c1-support branch.
zconll Posted July 20, 2018 Posted July 20, 2018 Thank you, I see on decompiled code something weird, i use options "--chronicles=c1 --tree=0 --utf16le=1", as can you see show some KR/JP string on beginning all classes after "default_npc" class. This don't happen if use default encoded utf8 " --utf16le=0". Quote class default_npc { parameter: int DesirePqSize = 50; int FavorListSize = 30; float IdleDesire_DecayRatio = 0.0; float MoveAround_DecayRatio = 0.0; float DoNothing_DecayRatio = 0.0; float Attack_DecayRatio = 0.0; float Chase_DecayRatio = 0.0; float Flee_DecayRatio = 0.0; float GetItem_DecayRatio = 0.0; float Follow_DecayRatio = 0.0; float Decaying_DecayRatio = 0.0; float MoveToWayPoint_DecayRatio = 0.0; float UseSkill_DecayRatio = 0.0; float MoveTo_DecayRatio = 0.0; float EffectAction_DecayRatio = 0.0; float IdleDesire_BoostValue = 0.0; float MoveAround_BoostValue = 0.0; float DoNothing_BoostValue = 0.0; float Attack_BoostValue = 0.0; float Chase_BoostValue = 0.0; float Flee_BoostValue = 0.0; float GetItem_BoostValue = 0.0; float Follow_BoostValue = 0.0; float Decaying_BoostValue = 0.0; float MoveToWayPoint_BoostValue = 0.0; float UseSkill_BoostValue = 0.0; float MoveTo_BoostValue = 0.0; float EffectAction_BoostValue = 0.0; handler: EventHandler NO_DESIRE() { } EventHandler TALK_SELECTED(talker) { ShowPage(talker, "noquest.htm"); } } 挊氀愀猀猀 挀椀琀椀稀攀渀 㨀 搀攀昀愀甀氀琀开渀瀀挀 笀瀀愀爀愀洀攀琀攀爀㨀ऀ猀琀爀椀渀最 昀渀䠀椀 㴀 ∀挀栀椀⸀栀琀洀∀㬀ऀ栀愀渀搀氀攀爀㨀ऀ䔀瘀攀渀琀䠀愀渀搀氀攀爀 吀䄀䰀䬀䔀䐀⠀琀愀氀欀攀爀⤀ 笀ऀऀ匀栀漀眀倀愀最攀⠀琀愀氀欀攀爀Ⰰ 昀渀䠀椀⤀㬀ऀ紀紀class ticket_inspector : citizen { } 挊氀愀猀猀 渀瀀挀开攀氀搀攀爀 㨀 挀椀琀椀稀攀渀 笀紀class ruler : citizen { }
verbrannt Posted July 20, 2018 Author Posted July 20, 2018 12 minutes ago, zconll said: Thank you, I see on decompiled code something weird, i use options "--chronicles=c1 --tree=0 --utf16le=1", as can you see show some KR/JP string on beginning all classes after "default_npc" class. This don't happen if use default encoded utf8 " --utf16le=0". Fixed.
verbrannt Posted July 21, 2018 Author Posted July 21, 2018 (edited) On 7/18/2018 at 3:12 PM, MasterToma said: I would like to request minor (is it?) improvement. There are a lot of cases, where strings are present inside decompiled NAS file. E.g. TelPosList Position = { {"古鲁丁城镇"; -80749; 149834; -3043; 18000; 0} }; But actually, there should be ID from fstring.txt file. Originally, NAS Lexer translates ID from fstring.txt for TelPosList, and Code-Generator inserts string in ai.obj So, this should be like this TelPosList Position = { {1000003; -80749; 149834; -3043; 18000; 0} }; It allowed NCSoft to do script language-agnostic. Similar for AddChoise, but case is more complicated there, since it requires QuestDataChecker.exe After I've impletented this, I found, that compiler (GF by @eressea) doesn't work properly with {int, int, int, int} syntax of TelPosList property. I've got many errors during compilation: [d:\vss\globalbranch\work\overseas\ct2_final_0109\program\server\l2npc\fstring.h][112] Can't allocate buffer for fstring Compiler allocates buffer only for first 38 strings, any next string in OBJ file is empty. NASC that I'm trying to compile: https://mega.nz/#!WeA1WQKQ!2UxWCjQ8x6Y1IBFlJ7nvj8oIYQM6tKyESGleUmaOPhs Edited July 21, 2018 by verbrannt
eressea Posted July 22, 2018 Posted July 22, 2018 14 hours ago, verbrannt said: After I've impletented this, I found, that compiler (GF by @eressea) doesn't work properly with {int, int, int, int} syntax of TelPosList property. I've got many errors during compilation: [d:\vss\globalbranch\work\overseas\ct2_final_0109\program\server\l2npc\fstring.h][112] Can't allocate buffer for fstring Compiler allocates buffer only for first 38 strings, any next string in OBJ file is empty. NASC that I'm trying to compile: https://mega.nz/#!WeA1WQKQ!2UxWCjQ8x6Y1IBFlJ7nvj8oIYQM6tKyESGleUmaOPhs Fixed - download http://download.l2shrine.com/MyExt64.dll I'm getting errors about undefined variable talker - it's missing in handler arguments so compiler doesn't see it - first error I get for your AI is 07/22/2018 12:07:04.931, ERROR(780692) : Undeclared variable [talker] Can you fix it somehow? :)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now