Segment Swap utility

They go by many names, P01, P59, VPW, '0411 etc. Also covering E38 and newer here.
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

I did some good batch of testing, all works fine except some small bugs I have found.

In the autoconfig settings changing the misspelled xml file is next to impossible, it never gets saved.

When you try to compare 2 same size bins that have no xml defined a crash error is set.

That tabs look nice. Now checksum fix is some deep buried and not clear enough, why not make a fix checksum tab.

Table extraction is also very simply and good to use I want to keep it that way just for table extraction and add separate tab for 2 more types of patches. Table extraction might get better with the option of multiple table extractions in one patch, like extracttable1 and set OS location, add table2 and set os locations and so on. I also couldn`t make a table extraction with fixed location for all OS that will be used with it.


First will be patch extraction from file. It can be set to extract data from multiple locations, and maybe some text file saving for the settings of the extracted area. That way you can extract for example CLosed loop settings for a given file and apply it to other file and so on.

The format might be something like this. 8000-8025, or 8000:2 [2 bytes from 8000] and some other form of syntax you might consider will be needed.


And the last tab can be for manual patch creation with some dialogs for entering data[AN if statement will be very handy for example read byte and bit; x if x=0 apply 000111 if x=1 apply 1111111, read byte x bit7 if =1 apply x if =0 apply y], adding the original unpatched data to the patch will be awesome and print a text if the patch is applied or not in the selected bin.
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

kur4o wrote:I did some good batch of testing, all works fine except some small bugs I have found.

In the autoconfig settings changing the misspelled xml file is next to impossible, it never gets saved.

When you try to compare 2 same size bins that have no xml defined a crash error is set.

That tabs look nice. Now checksum fix is some deep buried and not clear enough, why not make a fix checksum tab.

Table extraction is also very simply and good to use I want to keep it that way just for table extraction and add separate tab for 2 more types of patches. Table extraction might get better with the option of multiple table extractions in one patch, like extracttable1 and set OS location, add table2 and set os locations and so on. I also couldn`t make a table extraction with fixed location for all OS that will be used with it.


First will be patch extraction from file. It can be set to extract data from multiple locations, and maybe some text file saving for the settings of the extracted area. That way you can extract for example CLosed loop settings for a given file and apply it to other file and so on.

The format might be something like this. 8000-8025, or 8000:2 [2 bytes from 8000] and some other form of syntax you might consider will be needed.


And the last tab can be for manual patch creation with some dialogs for entering data[AN if statement will be very handy for example read byte and bit; x if x=0 apply 000111 if x=1 apply 1111111, read byte x bit7 if =1 apply x if =0 apply y], adding the original unpatched data to the patch will be awesome and print a text if the patch is applied or not in the selected bin.
0.9.2
Bug fixes
Added bit-checking rules and bit setting for manual patches.
Patch editor
Autodetect: xml rename and editor for autodetect.xml

I dont see any reason for separate data extraction, you can now extract multiple locations with "extract table", and address:bytes format is now supported.

"Fix checksums" is now in "Modify bin" -tab, is this logical enough or should it have separate tab?
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

I played a lot with the patch extraction and patch config. There are some really nice features you have added. I got one issue on the table extraction.

When you specify the extract data, and don`t specify the OS:address, it extracts the data but doesn`t save the address where the data will be written in the patch.

I have one suggestion that will make data extraction much more easy to work with.

When ALL is specified in the OS field we can extract multiple location with single line for example.

8000-8019,9918-a000,c000:6
ALL

Take each range and save it to a separate patch line and add the all:start address of each range to each line.

It will cure the problem I have now. Maybe if ALL is not specified take the OS from the loaded bin and apply to each line OS:start address.

The bit check is awesome I didn`t check it for functionality but it seems it will work. Can we add also a byte check vs value for example read byte 8000, if equals to xx load patch line, or if not equal to xx load patch line.

One last request when you double click on the patch data to open a bigger dialog box with ok button, since on longer patches it will be really hard to edit or view in the limited field.
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

Something else I forgot, Can you rename the bits to more commonly used terminology as bits 0 to 7 or $01-$02-$04-$08-$10-$20-$40-$80.
The later gives more option to check multiple bits for more comples conditions, example $21 [bit 0 and bit 5]
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

kur4o wrote:Something else I forgot, Can you rename the bits to more commonly used terminology as bits 0 to 7 or $01-$02-$04-$08-$10-$20-$40-$80.
The later gives more option to check multiple bits for more comples conditions, example $21 [bit 0 and bit 5]
0.9.3
Bits are now 0 to 7.
Now you can add multiple blocks in table extraction

Modified patch rule to use bitmask. (Edit: bitlevel AND)
Can be used for all kind of comparing, bit or byte.

There is no separate "else" rule, you can create 2 similar rules, one with "match" rule, another with "not match" rule.

Added doubleclick for patch editor. You can also resize patcher window and columns in editor.
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

Awesome work. Now table extraction works for all kind of range addresses with multiple tables. I also found that you added bit apply patch. I never thought about it but might be very usefull for older bins.

I wonder will it be possible to include bit extractions, For example something like this 8000:1:5 [address 8000 byte 1 extract bit 5]
To avoid confusion we might switch to mask bit extraction and application.

I guess the mask works something like this. 8000:1:20 [mask 20 equals to bit5] if I got it correctly. Or to keep both formats the mask might be defined with $[mask] and the bits can be numbers 0-7.

Another ideas is to make a row edit button and row delete button and row rearange buttons.
The pop up dialog is great but is pitta to read with that single line, caping the line to 16 bytes and make the dialog multi line will be really usefull.
Adding some text file to the patch for detailed description and instructions for usage will be really needed for complex patches with lot of variables.

Is this the correct usage of the mask, you define the address to read the byte the mask of 24 will read bit 2[$04] and bit5[$20] and if zero apply or if not zero apply.
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

kur4o wrote:Awesome work. Now table extraction works for all kind of range addresses with multiple tables. I also found that you added bit apply patch. I never thought about it but might be very usefull for older bins.

I wonder will it be possible to include bit extractions, For example something like this 8000:1:5 [address 8000 byte 1 extract bit 5]
To avoid confusion we might switch to mask bit extraction and application.

I guess the mask works something like this. 8000:1:20 [mask 20 equals to bit5] if I got it correctly. Or to keep both formats the mask might be defined with $[mask] and the bits can be numbers 0-7.

Another ideas is to make a row edit button and row delete button and row rearange buttons.
The pop up dialog is great but is pitta to read with that single line, caping the line to 16 bytes and make the dialog multi line will be really usefull.
Adding some text file to the patch for detailed description and instructions for usage will be really needed for complex patches with lot of variables.

Is this the correct usage of the mask, you define the address to read the byte the mask of 24 will read bit 2[$04] and bit5[$20] and if zero apply or if not zero apply.
I can implement bit extraction, but is it really useful? If you know bits you need, you can directly define them?
Or maybe I don't know where you can use this...

If you want to apply patch if bits 4 and 5 are "1", set
mask: 30
"apply data if result is:" 30
(30 hex = 00110000 bin)

Value: xx11xxxx, And
Mask: 00110000
===> 00110000

If you want to apply patch if bits 4 and 5 are "0", set
mask: 30
"apply data if result is:" 0

Value: xx00xxxx, And
Mask: 00110000
===> 00000000


if you want to apply patch if value is exactly 30, set:
mask: FF
"apply data if result is:" 30

Value: 00110000, And
Mask: 11111111
===> 00110000
kur4o
Posts: 948
Joined: Sun Apr 10, 2016 9:20 pm

Re: Segment Swap utility

Post by kur4o »

Thanks for the great explanation. It is basically mask bits multiply to value bits{AND command] and check if result is 0 or 1.

It will be nice to add ABOUT button, with some dialog containing version, creator, contributors, Thanks and so on. All the info will be valuable for anyone using the program and have no info about it.
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

kur4o wrote:Thanks for the great explanation. It is basically mask bits multiply to value bits{AND command] and check if result is 0 or 1.

It will be nice to add ABOUT button, with some dialog containing version, creator, contributors, Thanks and so on. All the info will be valuable for anyone using the program and have no info about it.
0.9.4
Improved patch-editor.
Added basic about-window.
As usual, all ideas for improvements are welcome.

Edit: 0.9.5
Bug fix for patch load
User avatar
joukoy
Posts: 392
Joined: Tue Dec 17, 2019 3:27 am
cars: Pontiac Firebird 1978

Re: Segment Swap utility

Post by joukoy »

kur4o wrote: Adding some text file to the patch for detailed description and instructions for usage will be really needed for complex patches with lot of variables.
Added in 0.9.6
Post Reply