Thread: [634+] World map decoding / encoding

Results 1 to 3 of 3
  1. #1 [634+] World map decoding / encoding 
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,556
    Thanks given
    654
    Thanks received
    640
    Rep Power
    358
    Managed to decode all of this so far, not sure what the unique file inside all the archives 0-44 (except 1, which is details) is supose to hold. What's the purpose of this data?

    Code:
    public static void main(String[] args) {
            try {
                ProgramArguments.addOption(CommandLineOption.DEV_MODE);
                ProgramArguments.addOption(CommandLineOption.LOG_LEVEL);
                ProgramArguments.processArgs(args);
    
                long start = GameTime.currentTimeMillis();
                Cache.init(Settings.CACHE_PATH, Settings.CLIENT_BUILD);
    
                int archiveId = Cache.getCache().getIndex(23).getArchiveId("details");//getArchiveName(45, 56, (char)i));
                if (archiveId != -1) {
                    Set<Integer> validFileIds = Cache.getCache().getIndex(23).getTable().getArchive(archiveId).getFiles().keySet();
                    if (validFileIds != null) {
                        for (int fileId : validFileIds) {
                            byte[] fileData = Cache.getCache().getIndex(23).getFile(archiveId, fileId);
                            InputStream stream = new InputStream(fileData);
                            String a = stream.readString(); // archive name when doing hash search (0-44)
                            String b = stream.readString();
                            int c = stream.readInt(); // high value number, like an hash?
                            int d = stream.readInt();
                            byte e = stream.readByte();
                            byte f = stream.readUByte(); // some constant that varies
                            byte g = stream.readByte();
                            byte h = stream.readByte();
                            for (int i = 0; i < h; ++i) {
                                stream.skip(17);
                            }
                            if (Cache.getCache().getIndex(23).getArchiveId(a) != -1) {
                                System.out.println("found archive id " + a + ", " + c + ", " + f + ", " + Cache.getCache().getIndex(23).getArchiveId(a) + ", ");
                                if (Cache.getCache().getIndex(23).getTable().getArchives().containsKey(Cache.getCache().getIndex(23).getArchiveId(a))) {
                                    // what does this file hold?
                                    int subFileId = Cache.getCache().getIndex(23).getFileId(Cache.getCache().getIndex(23).getArchiveId(a), "area");
                                    byte[] test = Cache.getCache().getIndex(23).getFile(Cache.getCache().getIndex(23).getArchiveId(a), subFileId);
                                    InputStream s = new InputStream(test);
    
                                    int i_76_ = s.readUByte();
                                    int[] is = new int[i_76_];
                                    for (int i_77_ = 0; i_77_ < i_76_; i_77_++)
                                        is[i_77_] = s.readUByte();
                                    int i_78_ = s.readUByte();
                                    int[] is_79_ = new int[i_78_];
                                    for (int i_80_ = 0; i_80_ < i_78_; i_80_++)
                                        is_79_[i_80_] = s.readUByte();
                                    while (s.getRemaining() > 0) {
                                        if (s.readUByte() == 0) {
                                            int i_81_ = s.readUByte();
                                            int i_82_ = s.readUByte();
                                            for (int i_83_ = 0; i_83_ < 64; i_83_++) {
                                                for (int i_84_ = 0; i_84_ < 64; i_84_++) {
                                                    int i_85_ = i_81_ * 64 + i_83_ - 12800;
                                                    int i_86_ = i_82_ * 64 + i_84_ - 12800;
                                                    method750(s, i_81_, i_82_, i_85_, i_86_, is, is_79_);
                                                }
                                            }
                                        } else {
                                            int i_87_ = s.readUByte();
                                            int i_88_ = s.readUByte();
                                            int i_89_ = s.readUByte();
                                            int i_90_ = s.readUByte();
                                            for (int i_91_ = 0; i_91_ < 8; i_91_++) {
                                                for (int i_92_ = 0; i_92_ < 8; i_92_++) {
                                                    int i_93_ = i_87_ * 64 + i_89_ * 8 + i_91_ - 12800;
                                                    int i_94_ = i_88_ * 64 + i_92_ + i_90_ * 8 - 12800;
                                                    method750(s, i_87_, i_88_, i_93_, i_94_, is, is_79_);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                System.out.println("done");
                CommonShutdownHook.bind();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    
        private static final void method750(InputStream class348_sub49, int i, int i_21_, int i_22_, int i_23_, int[] is, int[] is_24_) {
            int i_25_ = class348_sub49.readUByte();
            if ((i_25_ & 0x1) == 0) {
                boolean bool = (i_25_ & 0x2) == 0;
                int i_26_ = i_25_ >> 2 & 0x3f;
                if (i_26_ != 62) {
                    if (i_26_ == 63)
                        i_26_ = class348_sub49.readUByte();
                    else if (bool)
                        i_26_ = is[i_26_];
                    else
                        i_26_ = is_24_[i_26_];
                    if (bool) {
                        //aByteArray1273[i_23_ * -12736 + i_22_] = (byte) i_26_;
                        //aByteArray1256[i_22_ + i_23_ * -12736] = (byte) 0;
                    } else {
                        //aByteArray1256[i_23_ * -12736 + i_22_] = (byte) i_26_;
                        //aByteArray1275[i_22_ + i_23_ * -12736] = (byte) 0;
                        //aByteArray1273[i_22_ + i_23_ * -12736] = class348_sub49.readByte();
                        class348_sub49.readByte();
                    }
                }
            } else {
                int i_27_ = (i_25_ >> 1 & 0x3) + 1;
                boolean bool = (i_25_ & 0x8) != 0;
                boolean bool_28_ = (i_25_ & 0x10) != 0;
                for (int i_29_ = 0; i_29_ < i_27_; i_29_++) {
                    int i_30_ = class348_sub49.readUByte();
                    int i_31_ = 0;
                    int i_32_ = 0;
                    if (bool) {
                        i_31_ = class348_sub49.readUByte();
                        i_32_ = class348_sub49.readUByte();
                    }
                    int i_33_ = 0;
                    if (bool_28_)
                        i_33_ = class348_sub49.readUByte();
                    if (i_29_ == 0) {
                        //aByteArray1273[i_23_ * -12736 + i_22_] = (byte) i_30_;
                        //aByteArray1256[i_23_ * -12736 + i_22_] = (byte) i_31_;
                        //aByteArray1275[i_22_ + i_23_ * -12736] = (byte) i_32_;
                        if (i_33_ == 1) {
                            class348_sub49.readUShort();
                            class348_sub49.readByte();
                            //aShortArray1261[i_23_ * -12736 + i_22_] = (short) (class348_sub49.readUShort() + 1);
                            //aByteArray1258[i_23_ * -12736 + i_22_] = class348_sub49.readByte();
                        } else if (i_33_ > 1) {
                            //aShortArray1261[i_23_ * -12736 + i_22_] = (short) -1;
                            short[] is_34_ = new short[i_33_];
                            byte[] is_35_ = new byte[i_33_];
                            for (int i_36_ = 0; i_36_ < i_33_; i_36_++) {
                                is_34_[i_36_]
                                        = (short) class348_sub49.readUShort();
                                is_35_[i_36_] = class348_sub49.readByte();
                            }
                            //aClass356_1271.method3483((byte) 33, (long) (i_22_ << 16 | i_23_), new Class348_Sub39(is_34_, is_35_));
                        }
                    } else {
                        short[] is_37_ = null;
                        byte[] is_38_ = null;
                        if (i_33_ > 0) {
                            is_37_ = new short[i_33_];
                            is_38_ = new byte[i_33_];
                            for (int i_39_ = 0; i_39_ < i_33_; i_39_++) {
                                is_37_[i_39_] = (short) class348_sub49.readUShort();
                                is_38_[i_39_] = class348_sub49.readByte();
                            }
                        }
                        //if ((aClass243ArrayArrayArray1269[i_29_ - 1][i - (anInt1266 >> 6)][i_21_ - (anInt1263 >> 6)]) == null)
                        //    aClass243ArrayArrayArray1269[i_29_ - 1][i - (anInt1266 >> 6)][i_21_ - (anInt1263 >> 6)] = new Class243();
                        //Class318_Sub8 class318_sub8 = new Class318_Sub8(i_22_ & 0x3f, i_23_ & 0x3f, i_30_, i_31_, i_32_, is_37_, is_38_);
                        //aClass243ArrayArrayArray1269[i_29_ - 1][i - (anInt1266 >> 6)][i_21_ - (anInt1263 >> 6)].method1869(-86, class318_sub8);
                    }
                }
            }
        }
    Project thread
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Contributor

    clem585's Avatar
    Join Date
    Sep 2013
    Posts
    3,556
    Thanks given
    654
    Thanks received
    640
    Rep Power
    358
    bump
    Project thread
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. #3  
    Renown Programmer
    Greg's Avatar
    Join Date
    Jun 2010
    Posts
    1,136
    Thanks given
    233
    Thanks received
    798
    Discord
    View profile
    Rep Power
    1575
    Quote Originally Posted by clem585 View Post
    Managed to decode all of this so far, not sure what the unique file inside all the archives 0-44 (except 1, which is details) is supose to hold. What's the purpose of this data?

    Code:
    public static void main(String[] args) {
            try {
                ProgramArguments.addOption(CommandLineOption.DEV_MODE);
                ProgramArguments.addOption(CommandLineOption.LOG_LEVEL);
                ProgramArguments.processArgs(args);
    
                long start = GameTime.currentTimeMillis();
                Cache.init(Settings.CACHE_PATH, Settings.CLIENT_BUILD);
    
                int archiveId = Cache.getCache().getIndex(23).getArchiveId("details");//getArchiveName(45, 56, (char)i));
                if (archiveId != -1) {
                    Set<Integer> validFileIds = Cache.getCache().getIndex(23).getTable().getArchive(archiveId).getFiles().keySet();
                    if (validFileIds != null) {
                        for (int fileId : validFileIds) {
                            byte[] fileData = Cache.getCache().getIndex(23).getFile(archiveId, fileId);
                            InputStream stream = new InputStream(fileData);
                            String a = stream.readString(); // archive name when doing hash search (0-44)
                            String b = stream.readString();
                            int c = stream.readInt(); // high value number, like an hash?
                            int d = stream.readInt();
                            byte e = stream.readByte();
                            byte f = stream.readUByte(); // some constant that varies
                            byte g = stream.readByte();
                            byte h = stream.readByte();
                            for (int i = 0; i < h; ++i) {
                                stream.skip(17);
                            }
                            if (Cache.getCache().getIndex(23).getArchiveId(a) != -1) {
                                System.out.println("found archive id " + a + ", " + c + ", " + f + ", " + Cache.getCache().getIndex(23).getArchiveId(a) + ", ");
                                if (Cache.getCache().getIndex(23).getTable().getArchives().containsKey(Cache.getCache().getIndex(23).getArchiveId(a))) {
                                    // what does this file hold?
                                    int subFileId = Cache.getCache().getIndex(23).getFileId(Cache.getCache().getIndex(23).getArchiveId(a), "area");
                                    byte[] test = Cache.getCache().getIndex(23).getFile(Cache.getCache().getIndex(23).getArchiveId(a), subFileId);
                                    InputStream s = new InputStream(test);
    
                                    int i_76_ = s.readUByte();
                                    int[] is = new int[i_76_];
                                    for (int i_77_ = 0; i_77_ < i_76_; i_77_++)
                                        is[i_77_] = s.readUByte();
                                    int i_78_ = s.readUByte();
                                    int[] is_79_ = new int[i_78_];
                                    for (int i_80_ = 0; i_80_ < i_78_; i_80_++)
                                        is_79_[i_80_] = s.readUByte();
                                    while (s.getRemaining() > 0) {
                                        if (s.readUByte() == 0) {
                                            int i_81_ = s.readUByte();
                                            int i_82_ = s.readUByte();
                                            for (int i_83_ = 0; i_83_ < 64; i_83_++) {
                                                for (int i_84_ = 0; i_84_ < 64; i_84_++) {
                                                    int i_85_ = i_81_ * 64 + i_83_ - 12800;
                                                    int i_86_ = i_82_ * 64 + i_84_ - 12800;
                                                    method750(s, i_81_, i_82_, i_85_, i_86_, is, is_79_);
                                                }
                                            }
                                        } else {
                                            int i_87_ = s.readUByte();
                                            int i_88_ = s.readUByte();
                                            int i_89_ = s.readUByte();
                                            int i_90_ = s.readUByte();
                                            for (int i_91_ = 0; i_91_ < 8; i_91_++) {
                                                for (int i_92_ = 0; i_92_ < 8; i_92_++) {
                                                    int i_93_ = i_87_ * 64 + i_89_ * 8 + i_91_ - 12800;
                                                    int i_94_ = i_88_ * 64 + i_92_ + i_90_ * 8 - 12800;
                                                    method750(s, i_87_, i_88_, i_93_, i_94_, is, is_79_);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                System.out.println("done");
                CommonShutdownHook.bind();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    
        private static final void method750(InputStream class348_sub49, int i, int i_21_, int i_22_, int i_23_, int[] is, int[] is_24_) {
            int i_25_ = class348_sub49.readUByte();
            if ((i_25_ & 0x1) == 0) {
                boolean bool = (i_25_ & 0x2) == 0;
                int i_26_ = i_25_ >> 2 & 0x3f;
                if (i_26_ != 62) {
                    if (i_26_ == 63)
                        i_26_ = class348_sub49.readUByte();
                    else if (bool)
                        i_26_ = is[i_26_];
                    else
                        i_26_ = is_24_[i_26_];
                    if (bool) {
                        //aByteArray1273[i_23_ * -12736 + i_22_] = (byte) i_26_;
                        //aByteArray1256[i_22_ + i_23_ * -12736] = (byte) 0;
                    } else {
                        //aByteArray1256[i_23_ * -12736 + i_22_] = (byte) i_26_;
                        //aByteArray1275[i_22_ + i_23_ * -12736] = (byte) 0;
                        //aByteArray1273[i_22_ + i_23_ * -12736] = class348_sub49.readByte();
                        class348_sub49.readByte();
                    }
                }
            } else {
                int i_27_ = (i_25_ >> 1 & 0x3) + 1;
                boolean bool = (i_25_ & 0x8) != 0;
                boolean bool_28_ = (i_25_ & 0x10) != 0;
                for (int i_29_ = 0; i_29_ < i_27_; i_29_++) {
                    int i_30_ = class348_sub49.readUByte();
                    int i_31_ = 0;
                    int i_32_ = 0;
                    if (bool) {
                        i_31_ = class348_sub49.readUByte();
                        i_32_ = class348_sub49.readUByte();
                    }
                    int i_33_ = 0;
                    if (bool_28_)
                        i_33_ = class348_sub49.readUByte();
                    if (i_29_ == 0) {
                        //aByteArray1273[i_23_ * -12736 + i_22_] = (byte) i_30_;
                        //aByteArray1256[i_23_ * -12736 + i_22_] = (byte) i_31_;
                        //aByteArray1275[i_22_ + i_23_ * -12736] = (byte) i_32_;
                        if (i_33_ == 1) {
                            class348_sub49.readUShort();
                            class348_sub49.readByte();
                            //aShortArray1261[i_23_ * -12736 + i_22_] = (short) (class348_sub49.readUShort() + 1);
                            //aByteArray1258[i_23_ * -12736 + i_22_] = class348_sub49.readByte();
                        } else if (i_33_ > 1) {
                            //aShortArray1261[i_23_ * -12736 + i_22_] = (short) -1;
                            short[] is_34_ = new short[i_33_];
                            byte[] is_35_ = new byte[i_33_];
                            for (int i_36_ = 0; i_36_ < i_33_; i_36_++) {
                                is_34_[i_36_]
                                        = (short) class348_sub49.readUShort();
                                is_35_[i_36_] = class348_sub49.readByte();
                            }
                            //aClass356_1271.method3483((byte) 33, (long) (i_22_ << 16 | i_23_), new Class348_Sub39(is_34_, is_35_));
                        }
                    } else {
                        short[] is_37_ = null;
                        byte[] is_38_ = null;
                        if (i_33_ > 0) {
                            is_37_ = new short[i_33_];
                            is_38_ = new byte[i_33_];
                            for (int i_39_ = 0; i_39_ < i_33_; i_39_++) {
                                is_37_[i_39_] = (short) class348_sub49.readUShort();
                                is_38_[i_39_] = class348_sub49.readByte();
                            }
                        }
                        //if ((aClass243ArrayArrayArray1269[i_29_ - 1][i - (anInt1266 >> 6)][i_21_ - (anInt1263 >> 6)]) == null)
                        //    aClass243ArrayArrayArray1269[i_29_ - 1][i - (anInt1266 >> 6)][i_21_ - (anInt1263 >> 6)] = new Class243();
                        //Class318_Sub8 class318_sub8 = new Class318_Sub8(i_22_ & 0x3f, i_23_ & 0x3f, i_30_, i_31_, i_32_, is_37_, is_38_);
                        //aClass243ArrayArrayArray1269[i_29_ - 1][i - (anInt1266 >> 6)][i_21_ - (anInt1263 >> 6)].method1869(-86, class318_sub8);
                    }
                }
            }
        }
    From a glance looks like it's the list of areas that you pick from on the world map.
    I'd guess the loop is decoding tile heights, followed by regions else chunks. Method284 is applying rotation transforms and adding objects; map scenes and icons most likely.
    I recall the world map stores all pre-rendered tile colours too as it differs from the rendered minimap, so that might be amongst it.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 7
    Last Post: 01-05-2009, 11:38 PM
  2. World Map
    By Profesor Oak in forum Configuration
    Replies: 7
    Last Post: 12-08-2008, 11:58 PM
  3. [503] Better World Map Tutorial
    By cakeordeath2 in forum Tutorials
    Replies: 28
    Last Post: 07-29-2008, 10:30 AM
  4. [B]How to spawn items on world map [tut][/B]
    By i dds i in forum Tutorials
    Replies: 9
    Last Post: 09-25-2007, 01:05 AM
  5. Phate's lost world map xml files !
    By WhiteFang in forum Downloads
    Replies: 16
    Last Post: 08-15-2007, 10:48 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •