Ultimate Editor

Ultimate Editor; support/discussion/questions

Moderator: thunderchero

User avatar
Lathon
Lieutenant-Commander
Lieutenant-Commander
Posts: 116
Joined: Thu Oct 15, 2009 2:00 am

Re: Ultimate Editor

Post by Lathon »

Floke,

After merging in your changes to my local, whenever I make any kind of save (even unrelated to my changes) I am getting the below error when I try to reopen stbof.res file

Image
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3179
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Ultimate Editor

Post by Flocke »

Lathon wrote: Sun Apr 18, 2021 9:20 am After merging in your changes to my local, whenever I make any kind of save (even unrelated to my changes) I am getting the below error when I try to reopen stbof.res file
I just gave it a try with my own build and changed some building stats, saved, closed and reopened stbof.res and all was fine, guess this came by the merge then, I'll have a look.


Further I had a glance on what UE is doing wrong.
First, if I remember correct it once just switched the sector map locations, but this is not what it does by now. Instead
it also changes the write order of the sectors so all sectors are now written in a sorted manner again, row by row and column by column. However the sectors are indexed by their storage order, and so all the references must be updated as well.

Analysing the source code for the main "Move" operation, which calls the "SwitchSectors" routine, UE applies the following:
  • It swaps the map position of the two sectors in Sector.lst.
  • It sorts the written sector list so the swapped are in order of their map position again - which very well might break any indexing to the previous sector if there are.
  • For outposts of that sector in StarBaseInfo it mistakenly overwrites the outpostId by the new sectorId. (unless my wiki documentation is wrong) it computes a new outpostId, which is calculated based on the sector coordinates for not to conflict with other starbase ids, and updates sector.lst for the new id - with further analysis and testing I found no other references so I hope this will be fine
  • It updates the outpost map position in StarBaseInfo, which is for image rendering I guess, see below
  • It updates the stellar object map icon animation positions in StellInfo.
  • It updates the system map positions in SystInfo for map.tga icon rendering.
  • It updates the Fleet icon map positions in the GTForceList (current turn) and GWTForce (last turn) and thereby discards that the pervious turn the ships might have been positioned different.
  • For the moved fleets and in case they were set to move to the previous sector location, which is likely not the currently moved sector, in OrderInfo it updates the targetSectorColumn and -Row to the new sector position.
Checking on my documentation, I don't find any indexing on the sectors, but like all know there is alot data still not analysed, and for stellar objects, they have no written id either, but are indexed by the write order. But by my guess this is fine and even necessary when the game calculates the sector index by the postion like UE does.

I'll do some testing on that some other day.

edit: reviewed the outpost id change
Last edited by Flocke on Sun Apr 25, 2021 3:39 am, edited 1 time in total.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3179
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Ultimate Editor

Post by Flocke »

Flocke wrote: Sun Apr 18, 2021 10:55 am
Lathon wrote: Sun Apr 18, 2021 9:20 am After merging in your changes to my local, whenever I make any kind of save (even unrelated to my changes) I am getting the below error when I try to reopen stbof.res file
I just gave it a try with my own build and changed some building stats, saved, closed and reopened stbof.res and all was fine, guess this came by the merge then, I'll have a look.
I can confirm this bug, I tested this by adding one name to the last unpatched naming group 61. But re-opening the saved file only fails with the changes you pushed, not with my previuos commit 9f9b983db3be6acea2b61a6fede2386314ed9ca2!
So I guess you have a hidden bug in your changes.

Further it would be great when you allowed to add more shipname groups even without having the exe patched! You really shouldn't enforce this, specially given the patch might change and then not be detected anymore even though the new format is supported if not required.
A notification or question whether it is really meant to change does perfectly fine. Users still can mess their files in so many ways, you'll never succeed to prevent them to corrupt their files if they wanted, you just hamper people who like me don''t have their exe patched. :mrgreen:

However entering some numbers in some other menus I found a casting error that might be by my changes. But I will check on this another day.
ue_casting_error.jpg
ue_casting_error.jpg (19.53 KiB) Viewed 3540 times
User avatar
Lathon
Lieutenant-Commander
Lieutenant-Commander
Posts: 116
Joined: Thu Oct 15, 2009 2:00 am

Re: Ultimate Editor

Post by Lathon »

Flocke wrote: Sun Apr 18, 2021 11:37 am
Flocke wrote: Sun Apr 18, 2021 10:55 am
Lathon wrote: Sun Apr 18, 2021 9:20 am After merging in your changes to my local, whenever I make any kind of save (even unrelated to my changes) I am getting the below error when I try to reopen stbof.res file
I just gave it a try with my own build and changed some building stats, saved, closed and reopened stbof.res and all was fine, guess this came by the merge then, I'll have a look.
I can confirm this bug, I tested this by adding one name to the last unpatched naming group 61. But re-opening the saved file only fails with the changes you pushed, not with my previuos commit 9f9b983db3be6acea2b61a6fede2386314ed9ca2!
So I guess you have a hidden bug in your changes.

Further it would be great when you allowed to add more shipname groups even without having the exe patched! You really shouldn't enforce this, specially given the patch might change and then not be detected anymore even though the new format is supported if not required.
A notification or question whether it is really meant to change does perfectly fine. Users still can mess their files in so many ways, you'll never succeed to prevent them to corrupt their files if they wanted, you just hamper people who like me don''t have their exe patched. :mrgreen:

However entering some numbers in some other menus I found a casting error that might be by my changes. But I will check on this another day.
ue_casting_error.jpg
Figured it out. For some reason, on my installation, it is not moving the stbof.tmp file and replacing the stbof.res file I am using (nor is it deleting the .tmp file)
Image

If I manually move the stbof.tmp file and rename it stbof.res, it works correctly within UE. So probably a bug in your code, Floke :wink:
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3179
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Ultimate Editor

Post by Flocke »

Lathon wrote: Mon Apr 19, 2021 10:04 am If I manually move the stbof.tmp file and rename it stbof.res, it works correctly within UE. So probably a bug in your code, Floke :wink:
Ah, I indeed can reproduce this with my former commit:

Code: Select all

Ultimate Editor 0.7.2dev5c - 16:44:55 19.04.2021
java.io.IOException: Failed to delete file: stbof.tmp
	at ue.edit.res.Stbof$SaveTask.replaceStbofFile(Stbof.java:2491)
	at ue.edit.res.Stbof$SaveTask.writeZipOutputStream(Stbof.java:2459)
	at ue.edit.res.Stbof$SaveTask.doInBackground(Stbof.java:2393)
	at ue.edit.res.Stbof$SaveTask.doInBackground(Stbof.java:2362)
	at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)
Since I previously always stored to a different location it didn't create and rename the temp file, so I didn't notice it. :mad:
I will have a look.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3179
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Ultimate Editor

Post by Flocke »

Lathon wrote: Sun Apr 18, 2021 9:20 am After merging in your changes to my local, whenever I make any kind of save (even unrelated to my changes) I am getting the below error when I try to reopen stbof.res file
Copying over the temp file should be fixed now.
When I cleaned up that code, I basically missed to close the target file prior to overwriting it...
User avatar
Lathon
Lieutenant-Commander
Lieutenant-Commander
Posts: 116
Joined: Thu Oct 15, 2009 2:00 am

Re: Ultimate Editor

Post by Lathon »

Flocke wrote: Tue Apr 20, 2021 3:36 am
Lathon wrote: Sun Apr 18, 2021 9:20 am After merging in your changes to my local, whenever I make any kind of save (even unrelated to my changes) I am getting the below error when I try to reopen stbof.res file
Copying over the temp file should be fixed now.
When I cleaned up that code, I basically missed to close the target file prior to overwriting it...
Confirmed it's fixed now!

I also finished up cleaning up the project warnings. There should not be anymore :)
User avatar
Lathon
Lieutenant-Commander
Lieutenant-Commander
Posts: 116
Joined: Thu Oct 15, 2009 2:00 am

Re: Ultimate Editor

Post by Lathon »

thunderchero wrote: Thu Apr 15, 2021 2:23 pm nice work,

if you want one a little more challenging you could look at fixing extending shipname.bin UE issue.

this was started by Dcer but never completed

viewtopic.php?p=50935#p50935

one other project would be to add the EdificePatcher

UE would need to check if Edifice.bst is edited if so run patcher then when saving rerun patcher? (this might be easiest way)

it might also be possible to make major edits to how UE does Edifice.bst file (if structures above tech 10)

I know there are other edits if you are interested.
Did QD ever give teh source code for EdificePatcher program?

If that's not available, could you share which post has all the documentation I would need to see what the changes are to Edifice.bst file and Trek.exe?
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Ultimate Editor

Post by thunderchero »

Hi Lathon,

this will be a tough one QD never really post detailed info.

here is release of EdificePatcher and source code
EdificePatcher-130122-w32.zip
(612.84 KiB) Downloaded 76 times
EdificePatcher-130122.tar.gz
(15.59 KiB) Downloaded 76 times
here is edifice.bst with and without patch. (from mirror universe mod)
edifice.zip
(24.12 KiB) Downloaded 76 times
these files have completely different formats

I think I have all the trek.exe changes documented but some overlap with the tech patch.

Code: Select all

>> 0x0004f52b 89 d0 c1 e0 04 01 d0
<< 0x0004f52b 69 c2 80 00 00 00 90

>> 0x0004f538 c1 e0 02
>> 0x0004f543 44
>> 0x0004f546 59 5b c3 00 00 00

<< 0x0004f538 90 90 90
<< 0x0004f543 84
<< 0x0004f546 00 00 00 59 5b c3

>> 0x0004f51f 0b
>> 0x0004f545 44
>> 0x0004f822 0b
>> 0x0004fa5a f4 01
>> 0x000d0d1e 0b
>> 0x000d2c70 0b
>> 0x000d577a 0b

<< 0x0004f51f 15
<< 0x0004f545 6c
<< 0x0004f822 15
<< 0x0004fa5a 98 03
<< 0x000d0d1e 15
<< 0x000d2c70 15
<< 0x000d577a 15

>> 0xd5778   80 FB 0B
<< 0xd5778   80 FB 15
Good luck, I am glad I still had a copy of the source code. :grin:

My file hording comes in handy sometimes
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3179
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany
Contact:

Re: Ultimate Editor

Post by Flocke »

Flocke wrote: Sun Apr 18, 2021 11:37 am However entering some numbers in some other menus I found a casting error that might be by my changes. But I will check on this another day.
ue_casting_error.jpg
From further testing, debugging and code investigation, this bug was limited to MaxPopOrBonGUI. In the UE log the error reads like this:

Code: Select all

Ultimate Editor 0.7.2dev5c - 23:51:20 20.04.2021
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.Float (java.lang.Double and java.lang.Float are in module java.base of loader 'bootstrap')
	at ue.gui.stbof.MaxPopOrBonGUI.finalWarning(MaxPopOrBonGUI.java:306)
	at ue.gui.MainWindow.showPanel(MainWindow.java:91)
	at ue.gui.MainMenu$OpenEdit.actionPerformed(MainMenu.java:587)
As I've found, this was not caused by a code change, but likely by the newer compiler or a change in the java.base library.
But I fixed it now.

Lathon wrote: Tue Apr 20, 2021 8:49 pm Confirmed it's fixed now!

I also finished up cleaning up the project warnings. There should not be anymore :)
Cool!

With that project finished, I hope you don't mind me to review your changes and e.g. clean up the tab-space indention mess. :)
For code review btw it is best to work on a separate branch and issue a pull request in GitLab.
But a commit comparison, skipping the stbof save files I touched, works just as well this time:
https://gitlab.com/stbotf/ultimate-edit ... a0a9c42fa9

Regarding the code indention, as I've noticed it is messed in the whole UE project. When viewing the source in the web editor or some git compare, it often becomes quite hard to read when different tab indention is used. Best go either the tab or the space character route.
In UE it looks to be half way either route. :roll:

For myself I am used to use space characters, cause when ppl use different tab-indention, it always breaks when you write a second column of comments or the like. And for editor compatibility I don't like to switch tab indention when e.g. I include some library with a different indention.
I however needed to configure Eclipse for this in the Window-Preferences, and both change the Text-Editor indention and add a new Java Code Style:
eclipse_text_editor_indention.jpg
eclipse_text_editor_indention.jpg (34.39 KiB) Viewed 3469 times
eclipse_java_style_indention.jpg
eclipse_java_style_indention.jpg (63.55 KiB) Viewed 3469 times
As you can see there are lots of other possible style configurations. I suggest we try to match it with what is mostly used in the UE source.
I havn't looked much into this yet though.
On the other hand I am thinking about switching to another IDE. Even though Eclipse is told to be the most used Java IDE, I rather prefer to code with "Visual Studio Code" or something. Not sure on it yet. Luckily with the gradle build tools it should not be much of an issue to work with multiple IDEs. :lol:

edit: Visual Code -> Visual Studio Code I meant
Last edited by Flocke on Thu Apr 22, 2021 1:28 am, edited 1 time in total.
User avatar
Lathon
Lieutenant-Commander
Lieutenant-Commander
Posts: 116
Joined: Thu Oct 15, 2009 2:00 am

Re: Ultimate Editor

Post by Lathon »

thunderchero wrote: Tue Apr 20, 2021 9:57 pm Hi Lathon,

this will be a tough one QD never really post detailed info.

here is release of EdificePatcher and source code
EdificePatcher-130122-w32.zip
EdificePatcher-130122.tar.gz

here is edifice.bst with and without patch. (from mirror universe mod)
edifice.zip
these files have completely different formats

I think I have all the trek.exe changes documented but some overlap with the tech patch.

Code: Select all

>> 0x0004f52b 89 d0 c1 e0 04 01 d0
<< 0x0004f52b 69 c2 80 00 00 00 90

>> 0x0004f538 c1 e0 02
>> 0x0004f543 44
>> 0x0004f546 59 5b c3 00 00 00

<< 0x0004f538 90 90 90
<< 0x0004f543 84
<< 0x0004f546 00 00 00 59 5b c3

>> 0x0004f51f 0b
>> 0x0004f545 44
>> 0x0004f822 0b
>> 0x0004fa5a f4 01
>> 0x000d0d1e 0b
>> 0x000d2c70 0b
>> 0x000d577a 0b

<< 0x0004f51f 15
<< 0x0004f545 6c
<< 0x0004f822 15
<< 0x0004fa5a 98 03
<< 0x000d0d1e 15
<< 0x000d2c70 15
<< 0x000d577a 15

>> 0xd5778   80 FB 0B
<< 0xd5778   80 FB 15
Good luck, I am glad I still had a copy of the source code. :grin:

My file hording comes in handy sometimes
Thanks! I'll start looking into it when I get some free time in the next couple weeks. Personal life/work started getting a little hectic....
User avatar
Lathon
Lieutenant-Commander
Lieutenant-Commander
Posts: 116
Joined: Thu Oct 15, 2009 2:00 am

Re: Ultimate Editor

Post by Lathon »

Flocke wrote: Wed Apr 21, 2021 1:36 am
Flocke wrote: Sun Apr 18, 2021 11:37 am However entering some numbers in some other menus I found a casting error that might be by my changes. But I will check on this another day.
ue_casting_error.jpg
From further testing, debugging and code investigation, this bug was limited to MaxPopOrBonGUI. In the UE log the error reads like this:

Code: Select all

Ultimate Editor 0.7.2dev5c - 23:51:20 20.04.2021
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.Float (java.lang.Double and java.lang.Float are in module java.base of loader 'bootstrap')
	at ue.gui.stbof.MaxPopOrBonGUI.finalWarning(MaxPopOrBonGUI.java:306)
	at ue.gui.MainWindow.showPanel(MainWindow.java:91)
	at ue.gui.MainMenu$OpenEdit.actionPerformed(MainMenu.java:587)
As I've found, this was not caused by a code change, but likely by the newer compiler or a change in the java.base library.
But I fixed it now.

Lathon wrote: Tue Apr 20, 2021 8:49 pm Confirmed it's fixed now!

I also finished up cleaning up the project warnings. There should not be anymore :)
Cool!

With that project finished, I hope you don't mind me to review your changes and e.g. clean up the tab-space indention mess. :)
For code review btw it is best to work on a separate branch and issue a pull request in GitLab.
But a commit comparison, skipping the stbof save files I touched, works just as well this time:
https://gitlab.com/stbotf/ultimate-edit ... a0a9c42fa9

Regarding the code indention, as I've noticed it is messed in the whole UE project. When viewing the source in the web editor or some git compare, it often becomes quite hard to read when different tab indention is used. Best go either the tab or the space character route.
In UE it looks to be half way either route. :roll:

For myself I am used to use space characters, cause when ppl use different tab-indention, it always breaks when you write a second column of comments or the like. And for editor compatibility I don't like to switch tab indention when e.g. I include some library with a different indention.
I however needed to configure Eclipse for this in the Window-Preferences, and both change the Text-Editor indention and add a new Java Code Style:
eclipse_text_editor_indention.jpg
eclipse_java_style_indention.jpg

As you can see there are lots of other possible style configurations. I suggest we try to match it with what is mostly used in the UE source.
I havn't looked much into this yet though.
On the other hand I am thinking about switching to another IDE. Even though Eclipse is told to be the most used Java IDE, I rather prefer to code with "Visual Code" or something. Not sure on it yet. Luckily with the gradle build tools it should not be much of an issue to work with multiple IDEs. :lol:
Ah good you found the issue with the casting. I haven't' had time to go look into it lately.

Yeah go for it. the whole tab/space issue, it doesn't really matter to me. I've always used tabs in my professional life (we usually used tools within Eclipse to compare code, and its never really been an issue there). I'll set mine up for spaces.

I tried setting up Visual code for Java, but it didn't behave. but I only tried for a few minutes. If you want to try another IDE, Intellij has a community version of it's Java ide, and I've heard great things about it. I'm just too used to Eclipse, and don't want to make a switch :lol:

There's always Netbeans....but I always found it slow and cumbersome.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Ultimate Editor

Post by thunderchero »

Lathon wrote: Wed Apr 21, 2021 11:17 pm Thanks! I'll start looking into it when I get some free time in the next couple weeks. Personal life/work started getting a little hectic....
no hurry take care of your personal life first.

one other thing that is part of this, is in edit/starting conditions/starting buildings and starting technology there is a dropdown menus that need to auto adjust to current tech levels (both are limited to level 9 currently)
9a.jpg
9a.jpg (110.31 KiB) Viewed 3447 times
9.jpg
9.jpg (128 KiB) Viewed 3447 times
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Ultimate Editor

Post by thunderchero »

one other request in map generation could we get a warning?

"warning; when editing on any version patched with a larger resolution
you Must run QD's Res_patch to complete code settings.
viewtopic.php?p=30780#p30780"
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7824
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Ultimate Editor

Post by thunderchero »

just an idea here,

in most cases when UE edits the trek.exe it is fine. but I would like to see an option when it asks to "update trek.exe"
to save trek.exe changes to file.
info in file, Hex location, current value, new value (reason for change would be great option also).

this way if any special code has been added the modder can set values to new location or in some cases discard changes.
Post Reply

Return to “Ultimate Editor”