Page 1 of 3 123 LastLast
Results 1 to 20 of 41

Thread: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

  1. #1

    Default (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    The DBEditor 1.6.1 has bug in saving patch.pack. When the user click the save menuitem, it throws an OutOfMemory exception.

    The code location for the exception is in below:
    Code:
    ...
    //The value of numFiles will be a huge number,
    //so it reaches the maximum size of array
    fileList.Capacity = (int)numFiles;
    ...
    The array overrun due to number of bytes mismatch in reading/writing the header of patch.pack file.

    The reading method:
    Code:
    PackFile.cs
    public void Open(string filepath)
    {
    ......
                char[] signature = reader.ReadChars(4); //4 chars
    ......
                int packType = reader.ReadInt32();  //4 bytes
    ......
                version = reader.ReadInt32(); //4 bytes
    ......
                int mysteryInt = reader.ReadInt32(); //4 bytes
    ......
                fileList.Capacity = (int)numFiles;    //Throws an exception
    ......
    }
    Except the first 4 chars, The reading method has read 4+4+4=12 bytes totally.

    The writing method:
    Code:
    PackFile.cs
    private void writeToFile(string filepath)
    {
    ......
                writer.Write("PFH0".ToCharArray()); //4 chars
    ......
                writer.Write((short)type); //2 bytes
    ......
                writer.Write(version); //4 bytes,the type of version is Int32
    ......
                writer.Write((long)0); //8 bytes
    ......
    }
    Except the first 4 chars, The writing method has write 2+4+8=14 bytes totally.

    Got idea? The DBEditor read 12 bytes but write 14 bytes, it brokes the patch.pack file. When DBEditor reopen the patch.pack, it gots an incorrect number of files.

    We can fix it easy:
    Code:
    PackFile.cs
    private void writeToFile(string filepath)
    {
    ......
                writer.Write("PFH0".ToCharArray()); //4 chars
    ......
                writer.Write((short)type); //2 bytes
    ......
                writer.Write(version); //4 bytes
    ......
                //writer.Write((long)0); //remove this line
                writer.Write((int)0); // write 4 bytes first
                writer.Write((short)0); //and write 2 bytes
    ......
    }
    It is works fine in saving patch.pack now.

    ps: The DBEditor has a potential bug in writing method. After writing the first 4 chars, it writes the pack type [writer.Write((short)type);]. The type variable is a short numeric, 2 bytes. But the reading method reads 4 bytes for the pack type [writer.Write((short)type);].

    The download link (updated for patch2.pack):
    http://www.minehe.net/shares/files/D...MineHe_new.zip
    Last edited by minehe; October 08, 2009 at 01:25 AM.

  2. #2

    Default Re: An unofficial DBEditor 1.6.1 with saving bug fixed

    Thanks for this! I went in (as a test) and edited the Technologies. I changed the research points all to 1 so it should only take one turn for each tech. I tried loading and no crashes but the changes weren't recognized. I went into PackFileManager and changed my modified file to a patch and still nothing. Lastly, I changed it to a movie file and everything loaded and changes took effect!

  3. #3

    Default Re: An unofficial DBEditor 1.6.1 with saving bug fixed

    thnx for the mini fix miniehe, im glad some pple understand more about how these tools are structured than i do hehe.

    Interesting find ahedgpe, the latest mini patch makes even more headache for LtChambers i suspect.

  4. #4

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    i found more bugs in writeToFile(string) method, this new bugs will brokes the patch2.pack, so i fixed it.

    To Chamber and ETWModdingTools team, The writeToFile(string) should be:

    Code:
            private void writeToFile(string filepath)
            {
                using (BinaryWriter writer = new BinaryWriter(new FileStream(filepath, FileMode.Create), Encoding.ASCII))
                {
                    // write the pack file signature
                    writer.Write("PFH0".ToCharArray());
                    // write the pack type
                    writer.Write((int)type);
                    // write version
                    writer.Write(version);
                    // write 4 byte zero pad
                    if (version == 1)
                        writer.Write((int)11); //The patch2.pack has a new mystery number
                    else
                        writer.Write((int)0);
                    // determine final count of files and index size
                    int numFiles = 0;
                    int indexSize = 0;
                    foreach (PackedFile packedFile in fileList.Values)
                    {
                        if (packedFile.Action is PackedFile.RenamePackAction)
                        {
                            ++numFiles;
                            indexSize += (packedFile.Action as PackedFile.RenamePackAction).filepath.Length + 5; // null terminated w/ 4 byte file length
                        }
                        else if (!(packedFile.Action is PackedFile.DeleteFilePackAction))
                        {
                            ++numFiles;
                            indexSize += packedFile.Filepath.Length + 5; // null terminated w/ 4 byte file length
                        }
                    }
                    // write number of files
                    writer.Write(numFiles);
                    // write index size
                    writer.Write(indexSize);
                    if (version == 1)
                    {
                        writer.Write("patch.pack".ToCharArray());
                        writer.Write('\0');
                    }
    ......
    }

  5. #5

    Default Re: An unofficial DBEditor 1.6.1 with saving bug fixed

    Quote Originally Posted by ahedgpe View Post
    Thanks for this! I went in (as a test) and edited the Technologies. I changed the research points all to 1 so it should only take one turn for each tech. I tried loading and no crashes but the changes weren't recognized. I went into PackFileManager and changed my modified file to a patch and still nothing. Lastly, I changed it to a movie file and everything loaded and changes took effect!

    Thanks very much for that! I can now finally edit the naval stats for Darth3.1 and AuM using DB Editor 6.1. Good troubleshooting , who would have thought of saving the mod pack as a movie file, lol

    PS Keeping Steam(ing) pile of crap automatic update turned off!

  6. #6

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Thanks a lot, grate work, +rep!!




  7. #7

    Icon14 Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Excellent work. I usually only edit unit stats and naval stats, and your fix allows me to do both once again. Thank you for your great work, I am happy with the game once more.

  8. #8

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    I may be kinda dense but with this all I should have to do is open it change what i want and then save it? Like i was using the DBEditor before patch? nothing special right?

  9. #9

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Quote Originally Posted by Gustav55 View Post
    I may be kinda dense but with this all I should have to do is open it change what i want and then save it? Like i was using the DBEditor before patch? nothing special right?
    At least in my case...one extra step...go into PackFileManager and select the mod file you created (dont try to open each moded file up or it will give you errror) and change the .pack file from a mod to a movie file...

    By doing this I was able to change some of the building/tech stats and also unit sizes and stats...no crashes in campaign or custom battles!

    Edit: was able to change stats but can't get rid if fire and adv/platoon fire...what files am I supposed to edit...have done it before but can't remember?
    Last edited by ahedgpe; October 08, 2009 at 12:07 PM.

  10. #10

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Ok I'm new. In about every aspect.

    I tried the previous version of DBEeditor and it crashed my game. I re-downloaded it now and it works.

    This time, all I need to do is to open up the editor, copy what I want edited in a new table (I tried editing an old one last time), put whatever changes in that table, then somehow enforce it?

    I really wouldn't like to have to re-download my game.

  11. #11

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Quote Originally Posted by ahedgpe View Post
    At least in my case...one extra step...go into PackFileManager and select the mod file you created (dont try to open each moded file up or it will give you errror) and change the .pack file from a mod to a movie file...

    By doing this I was able to change some of the building/tech stats and also unit sizes and stats...no crashes in campaign or custom battles!

    Edit: was able to change stats but can't get rid if fire and adv/platoon fire...what files am I supposed to edit...have done it before but can't remember?
    unit_to_unit_abilities. I don't think is necessary the extra step.




  12. #12

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Quote Originally Posted by husserlTW View Post
    unit_to_unit_abilities. I don't think is necessary the extra step.
    Was not able to get all changes to take effect without changing the file from mod to movie. At least yet!

  13. #13

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    i downloaded this but i still get the same error when editing patch2. any help?

  14. #14
    Alex1987's Avatar Tiro
    Join Date
    Apr 2009
    Location
    Russia, Krasnodar region
    Posts
    247

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    minehe,
    excellent work! +rep

  15. #15

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Quote Originally Posted by matekaitis View Post
    i downloaded this but i still get the same error when editing patch2. any help?
    Make a backup of the mod you are using and then edit whatever your changing in the DB file by opening it with pack File manager and saving the entire mod pack as a movie file instead of a mod file.

    Save it in data and then rename it to the original mod name and voila. it will show up at the bottom of the DB editor under "movie mods" and changes will take effect.

    I'm not sure if patch.pack 2 is editable yet.

    Hope that helps.

  16. #16

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Ok, this is driving me crazy....which files do I need to edit to get rid of fire and adv/platoon fire? I have edited the unit_to_unit_ablities_junctions_table and removed these two but they still do it!

  17. #17

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    guys, i did some editing tests to patch.pack and patch2.pack (add a projectile, change some units and set the campaign variables), and these changes is in effect. i think it is work fine.

    but some guys may still got problems to edit patch*.pack, i guess these problems related to the third party mods, dirty game files etc. make your game files clear and then edit it.

  18. #18

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Actualy a lot of the errors have nothing to do with mods but rather some format mis-reading on the table formats for patch2.pack

    Even opening the original patch2.pack (ie with no mods) and trying to edit most of the building or technology tables will result in an error:

    Code:
    unknown db schema version
    
    Stack trace:
       at DBEditor.DBDataSet.readTableVersion(BinaryReader reader)
       at DBEditor.DBDataSet.readTable(DataTable table, BinaryReader reader)
       at DBEditor.DBDataSet.ReadDB(DataTable table, Byte[] DBByteArray)
       at DBEditor.DBEditorForm.readPackedDB(PackedFile file, DataTable table, Boolean initialize)

  19. #19

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    I get this error with the other DB Editor too......

  20. #20

    Default Re: (Updated!!!) An unofficial DBEditor 1.6.1 with all saving bug fixed includes patch2.pack

    Quote Originally Posted by myros View Post
    Actualy a lot of the errors have nothing to do with mods but rather some format mis-reading on the table formats for patch2.pack

    Even opening the original patch2.pack (ie with no mods) and trying to edit most of the building or technology tables will result in an error:

    Code:
    unknown db schema version
     
    Stack trace:
       at DBEditor.DBDataSet.readTableVersion(BinaryReader reader)
       at DBEditor.DBDataSet.readTable(DataTable table, BinaryReader reader)
       at DBEditor.DBDataSet.ReadDB(DataTable table, Byte[] DBByteArray)
       at DBEditor.DBEditorForm.readPackedDB(PackedFile file, DataTable table, Boolean initialize)
    em, i found no bug in some technology and building tables testing, but maybe it fail in others.
    post the table name which get exceptions, i try to fix it.
    Last edited by minehe; October 09, 2009 at 11:11 AM.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •