Jump to content

Recommended Posts

Posted (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)

 

image.thumb.png.d766045fc82ba21a21591c0da2396e37.png

 

More complicated case fairy_mymyu

image.thumb.png.0cf4bb1a4cba64aec10871763cbe01b0.png

 

image.thumb.png.2ab4c73e7de97d043718ba6eaa60b5ae.png

Empty parameers here and in quest_0503_imperial_gravekeeper , rodd

 

image.thumb.png.095b382c5c26269ccf994009b36f7de3.png

class party_leader_ag_casting_curse : party_leader_casting_curse

parameter_define_begin

parameter_define_end

 

 

Edited by MasterToma
Posted (edited)

Const pushing looks like in wrong place (tor)

image.thumb.png.41e926900d1e38d167215ed89fd40f04.png

 

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 by MasterToma
Posted

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).

 

 

 

Posted (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 by MasterToma
Posted (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 by verbrannt
  • Upvote 1
Posted (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 by verbrannt
Posted
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.

Posted

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 {
}

 

Posted
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.

Posted (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 by verbrannt
Posted
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? :)
 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




×
×
  • Create New...