From 0b6d1d000068b78782a5b383703b2fb74f67f452 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 4 Mar 2012 18:45:29 +0400 Subject: [PATCH] Wrap the DF-style custom linked lists into a special container tag. This makes them appear as proper sequences in the gui. --- StructFields.pm | 4 ++++ df-code.lisp | 16 ++++++++++++++++ df.map.xml | 4 ++-- df.world.xml | 6 +++--- linux/all.csv | 11 ++++++----- linux/globals.csv | 15 +++------------ lower-1.xslt | 2 +- windows/all.csv | 11 ++++++----- windows/globals.csv | 15 +++------------ 9 files changed, 44 insertions(+), 40 deletions(-) diff --git a/StructFields.pm b/StructFields.pm index 0657e8c3d..1b76a0299 100644 --- a/StructFields.pm +++ b/StructFields.pm @@ -109,6 +109,10 @@ my %custom_container_handlers = ( my $item = get_container_item_type($_, -void => 'void*'); return "DfArray<$item >"; }, + 'df-linked-list' => sub { + my $item = get_container_item_type($_); + return $item; # Just use the link type + }, ); my %custom_container_inits = ( diff --git a/df-code.lisp b/df-code.lisp index bd0e24f71..b4726644b 100644 --- a/df-code.lisp +++ b/df-code.lisp @@ -9,6 +9,9 @@ (def (class* eas) df-array (array-item data-field concrete-item) ()) +(def (class* eas) df-linked-list (sequence-item data-field concrete-item) + ()) + (in-package :cl-linux-debug.data-info) ;; df-flagarray implementation @@ -43,6 +46,19 @@ (when (< size most-positive-fixnum) (setf ,ptr-var start ,cnt-var size))))) +;; df-linked-list implementation + +(defmethod compute-effective-fields ((type df-linked-list)) + (assert (type-name-of type)) + (list + (make-instance 'compound :name $head :type-name (type-name-of type)))) + +(defmethod sequence-content-items ((type df-linked-list) ref) + (loop for cur = $ref.head.next then $cur.next + while (valid-ref? cur) + collect @cur.item into items + finally (return (coerce items 'vector)))) + (in-package :cl-linux-debug.data-xml) (defun find-entity (key) (find-by-id $global.world.entities.all $id key)) diff --git a/df.map.xml b/df.map.xml index 486000022..05ebf03bd 100644 --- a/df.map.xml +++ b/df.map.xml @@ -137,7 +137,7 @@ - + @@ -254,7 +254,7 @@ - + diff --git a/df.world.xml b/df.world.xml index a0c84c63a..2fa2a2931 100644 --- a/df.world.xml +++ b/df.world.xml @@ -328,9 +328,9 @@ -- Jobs and projectiles - + - + -- Buildings @@ -415,7 +415,7 @@ -- Adventure quests - + -- Unknown diff --git a/linux/all.csv b/linux/all.csv index 660f4e413..91af34b2e 100644 --- a/linux/all.csv +++ b/linux/all.csv @@ -8117,7 +8117,7 @@ "map_block","0","0x0","0x1d78","struct-type","map_block","","" "map_block","1","0x0","0x4","block_flags","flags","","" "map_block","1","0x4","0xc","stl-vector","block_events","block_square_event*","" -"map_block","1","0x10","0xc","block_burrow_link","block_burrows","","" +"map_block","1","0x10","0xc","df-linked-list","block_burrows","block_burrow_link","" "map_block","1","0x1c","0x4","int32_t","local_feature","","" "map_block","1","0x20","0x4","int32_t","global_feature","","" "map_block","1","0x24","0x4","int32_t","unk2","","" @@ -8166,7 +8166,8 @@ "map_block_column::anon2","1","0x10","0x4","static-array","unk2","uint8_t","" "map_block_column","1","0x14","0x2","int16_t","z_base","","" "map_block_column","1","0x18","0xc00","static-array","cave_columns","map_block_column::anon3","" -"map_block_column::anon3","0","0x0","0xc0","static-array","","cave_column_link","" +"map_block_column::anon3","0","0x0","0xc0","static-array","","map_block_column::anon4","" +"map_block_column::anon4","0","0x0","0xc","df-linked-list","","cave_column_link","" "map_block_column","1","0xc18","0xc","stl-vector","column_rectangles","padding*","" "map_block_column","1","0xc24","0x2","int16_t","unk_c2c","","" "map_block_column","1","0xc28","0x8","df-flagarray","flags","flag-bit","" @@ -12972,8 +12973,8 @@ "world","1","0x14098","0x18","compound","artifacts","","" "world","2","0x14098","0xc","stl-vector","artifacts.all","artifact_record*","" "world","2","0x140a4","0xc","stl-vector","artifacts.bad","artifact_record*","" -"world","1","0x140b0","0xc","job_list_link","job_list","","" -"world","1","0x140bc","0xc","proj_list_link","proj_list","","" +"world","1","0x140b0","0xc","df-linked-list","job_list","job_list_link","" +"world","1","0x140bc","0xc","df-linked-list","proj_list","proj_list_link","" "world","1","0x140c8","0x420","compound","buildings","","" "world","2","0x140c8","0xc","stl-vector","buildings.all","building*","" "world","2","0x140d4","0x408","static-array","buildings.other","world::anon5","" @@ -13005,7 +13006,7 @@ "world","2","0x14600","0xc","stl-vector","plants.all","plant*","" "world","2","0x1460c","0x3c","static-array","plants.other","world::anon6","" "world::anon6","0","0x0","0xc","stl-vector","","plant*","" -"world","1","0x14648","0xc","quest_list_link","quests","","" +"world","1","0x14648","0xc","df-linked-list","quests","quest_list_link","" "world","1","0x14654","0x1f4","padding","","","bool array?" "world","1","0x14848","0x3d090","static-array","unk_14818","int8_t","" "world","1","0x518d8","0x4","int32_t","unk_518a8","","" diff --git a/linux/globals.csv b/linux/globals.csv index a44e7ef9a..530bbc9b9 100644 --- a/linux/globals.csv +++ b/linux/globals.csv @@ -3340,14 +3340,8 @@ "world","1","0x958cf58","0x18","compound","world.artifacts","","" "world","2","0x958cf58","0xc","stl-vector","world.artifacts.all","artifact_record*","" "world","2","0x958cf64","0xc","stl-vector","world.artifacts.bad","artifact_record*","" -"world","1","0x958cf70","0xc","struct-type","world.job_list","","" -"world","2","0x958cf70","0x4","pointer","world.job_list.item","job","" -"world","2","0x958cf74","0x4","pointer","world.job_list.prev","job_list_link","" -"world","2","0x958cf78","0x4","pointer","world.job_list.next","job_list_link","" -"world","1","0x958cf7c","0xc","struct-type","world.proj_list","","" -"world","2","0x958cf7c","0x4","pointer","world.proj_list.item","projectile","" -"world","2","0x958cf80","0x4","pointer","world.proj_list.prev","proj_list_link","" -"world","2","0x958cf84","0x4","pointer","world.proj_list.next","proj_list_link","" +"world","1","0x958cf70","0xc","df-linked-list","world.job_list","job_list_link","" +"world","1","0x958cf7c","0xc","df-linked-list","world.proj_list","proj_list_link","" "world","1","0x958cf88","0x420","compound","world.buildings","","" "world","2","0x958cf88","0xc","stl-vector","world.buildings.all","building*","" "world","2","0x958cf94","0x408","static-array","world.buildings.other","world::anon5","" @@ -3468,10 +3462,7 @@ "world","3","0x958d4e4","0xc","stl-vector","world.plants.other[2]","plant*","" "world","3","0x958d4f0","0xc","stl-vector","world.plants.other[3]","plant*","" "world","3","0x958d4fc","0xc","stl-vector","world.plants.other[4]","plant*","" -"world","1","0x958d508","0xc","struct-type","world.quests","","" -"world","2","0x958d508","0x4","pointer","world.quests.item","adv_task","" -"world","2","0x958d50c","0x4","pointer","world.quests.prev","quest_list_link","" -"world","2","0x958d510","0x4","pointer","world.quests.next","quest_list_link","" +"world","1","0x958d508","0xc","df-linked-list","world.quests","quest_list_link","" "world","1","0x958d514","0x1f4","padding","world","","bool array?" "world","1","0x958d708","0x3d090","static-array","world.unk_14818","int8_t","" "world","1","0x95ca798","0x4","int32_t","world.unk_518a8","","" diff --git a/lower-1.xslt b/lower-1.xslt index 66994b596..a3195c1f0 100644 --- a/lower-1.xslt +++ b/lower-1.xslt @@ -237,7 +237,7 @@ - + diff --git a/windows/all.csv b/windows/all.csv index b5a1e87f8..31004e1ae 100644 --- a/windows/all.csv +++ b/windows/all.csv @@ -8117,7 +8117,7 @@ "map_block","0","0x0","0x1d88","struct-type","map_block","","" "map_block","1","0x0","0x4","block_flags","flags","","" "map_block","1","0x4","0x10","stl-vector","block_events","block_square_event*","" -"map_block","1","0x14","0xc","block_burrow_link","block_burrows","","" +"map_block","1","0x14","0xc","df-linked-list","block_burrows","block_burrow_link","" "map_block","1","0x20","0x4","int32_t","local_feature","","" "map_block","1","0x24","0x4","int32_t","global_feature","","" "map_block","1","0x28","0x4","int32_t","unk2","","" @@ -8166,7 +8166,8 @@ "map_block_column::anon2","1","0x10","0x4","static-array","unk2","uint8_t","" "map_block_column","1","0x18","0x2","int16_t","z_base","","" "map_block_column","1","0x1c","0xc00","static-array","cave_columns","map_block_column::anon3","" -"map_block_column::anon3","0","0x0","0xc0","static-array","","cave_column_link","" +"map_block_column::anon3","0","0x0","0xc0","static-array","","map_block_column::anon4","" +"map_block_column::anon4","0","0x0","0xc","df-linked-list","","cave_column_link","" "map_block_column","1","0xc1c","0x10","stl-vector","column_rectangles","padding*","" "map_block_column","1","0xc2c","0x2","int16_t","unk_c2c","","" "map_block_column","1","0xc30","0x8","df-flagarray","flags","flag-bit","" @@ -12972,8 +12973,8 @@ "world","1","0x14348","0x20","compound","artifacts","","" "world","2","0x14348","0x10","stl-vector","artifacts.all","artifact_record*","" "world","2","0x14358","0x10","stl-vector","artifacts.bad","artifact_record*","" -"world","1","0x14368","0xc","job_list_link","job_list","","" -"world","1","0x14374","0xc","proj_list_link","proj_list","","" +"world","1","0x14368","0xc","df-linked-list","job_list","job_list_link","" +"world","1","0x14374","0xc","df-linked-list","proj_list","proj_list_link","" "world","1","0x14380","0x580","compound","buildings","","" "world","2","0x14380","0x10","stl-vector","buildings.all","building*","" "world","2","0x14390","0x560","static-array","buildings.other","world::anon5","" @@ -13005,7 +13006,7 @@ "world","2","0x14a50","0x10","stl-vector","plants.all","plant*","" "world","2","0x14a60","0x50","static-array","plants.other","world::anon6","" "world::anon6","0","0x0","0x10","stl-vector","","plant*","" -"world","1","0x14ab0","0xc","quest_list_link","quests","","" +"world","1","0x14ab0","0xc","df-linked-list","quests","quest_list_link","" "world","1","0x14abc","0x1f4","padding","","","bool array?" "world","1","0x14cb0","0x3d090","static-array","unk_14818","int8_t","" "world","1","0x51d40","0x4","int32_t","unk_518a8","","" diff --git a/windows/globals.csv b/windows/globals.csv index bc4eb1ffe..b17af77ef 100644 --- a/windows/globals.csv +++ b/windows/globals.csv @@ -3226,14 +3226,8 @@ "world","1","0x179a030","0x20","compound","world.artifacts","","" "world","2","0x179a030","0x10","stl-vector","world.artifacts.all","artifact_record*","" "world","2","0x179a040","0x10","stl-vector","world.artifacts.bad","artifact_record*","" -"world","1","0x179a050","0xc","struct-type","world.job_list","","" -"world","2","0x179a050","0x4","pointer","world.job_list.item","job","" -"world","2","0x179a054","0x4","pointer","world.job_list.prev","job_list_link","" -"world","2","0x179a058","0x4","pointer","world.job_list.next","job_list_link","" -"world","1","0x179a05c","0xc","struct-type","world.proj_list","","" -"world","2","0x179a05c","0x4","pointer","world.proj_list.item","projectile","" -"world","2","0x179a060","0x4","pointer","world.proj_list.prev","proj_list_link","" -"world","2","0x179a064","0x4","pointer","world.proj_list.next","proj_list_link","" +"world","1","0x179a050","0xc","df-linked-list","world.job_list","job_list_link","" +"world","1","0x179a05c","0xc","df-linked-list","world.proj_list","proj_list_link","" "world","1","0x179a068","0x580","compound","world.buildings","","" "world","2","0x179a068","0x10","stl-vector","world.buildings.all","building*","" "world","2","0x179a078","0x560","static-array","world.buildings.other","world::anon5","" @@ -3354,10 +3348,7 @@ "world","3","0x179a768","0x10","stl-vector","world.plants.other[2]","plant*","" "world","3","0x179a778","0x10","stl-vector","world.plants.other[3]","plant*","" "world","3","0x179a788","0x10","stl-vector","world.plants.other[4]","plant*","" -"world","1","0x179a798","0xc","struct-type","world.quests","","" -"world","2","0x179a798","0x4","pointer","world.quests.item","adv_task","" -"world","2","0x179a79c","0x4","pointer","world.quests.prev","quest_list_link","" -"world","2","0x179a7a0","0x4","pointer","world.quests.next","quest_list_link","" +"world","1","0x179a798","0xc","df-linked-list","world.quests","quest_list_link","" "world","1","0x179a7a4","0x1f4","padding","world","","bool array?" "world","1","0x179a998","0x3d090","static-array","world.unk_14818","int8_t","" "world","1","0x17d7a28","0x4","int32_t","world.unk_518a8","",""