GithubHelp home page GithubHelp logo

podecaradox / gm1konvertercrossplatform Goto Github PK

View Code? Open in Web Editor NEW
26.0 8.0 7.0 15.87 MB

A tool to convert strongholds gm1 and tgx files to png.

License: MIT License

C# 100.00%
crusader gm1-exporter converter decode-gm1-files stronghold gm1-converter gm1

gm1konvertercrossplatform's People

Contributors

juggernaunt avatar podecaradox avatar randomanonymousperson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gm1konvertercrossplatform's Issues

Crash reproduction

I was able to reproduce this crash.

  1. Select tile_land3.gm1 item
  2. Select tile_land8.gm1 item
  3. Once again select tile_land3.gm1 item
  4. Once again select tile_land8.gm1 item
  5. Keep switching between those items. It takes like 10-20 switches until it crash.

It isn't managed .net exception, so there is no callstack. Only this error if I run program under debugger

An unhandled exception of type 'System.AccessViolationException' occurred in SkiaSharp
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Sprite info request

It would be nice to be able to watch gm1 sprite info by clicking on image. Info like sprite index, its width and height and all other info that game uses. Like this:

private ushort width;
private ushort height;
private uint tgxwidth;
private uint tgxheight;
private ushort offsetX;
private ushort offsetY;
private byte imagePart;
private byte subParts;
private ushort tileOffset;
private byte direction;
private byte horizontalOffsetOfImage;
private byte buildingWidth;
private byte animatedColor;//if alpha 1

Maybe show this info only under some kind of advanced or debug mode.

Export Images as one big Texture like asset and Import for easier Editing?

Hello Guys,

if you have some ideas for the Gm1Converter you can write it here Down.
Monsterfish had the idea to export Gm1 Files like tile_sea8 as one big image for editing, i can add this feature for the next update if you want. Also the bug with the black bars in the preview got a fix, i can implement that too.

problem

Hi dude !
an error occurs when I want to run program .
"object reference not set to an instance of an object ."
how can I solve this ?

Possible color conversion issues

For example when manually editing colortable, color is capped at value 248.
When editing, you are allowed to select any value between 0-255, but after you click save and then select the color again, the value is rounded and capped at 248, though it probably doesnt reflect how game works with the colors.

The color is encoded as A1R5G5B5, which means 5 bytes per color, which means 32 possible values (0-31).
It is assumed that the translation between 0-31 and 0-255 is linear, where 0-31 is simply divided by 8 (or 0-255 divided by 8).

The game renders colors from 0 to 255 though, which means the mapping of values is not as stated above, where 31*8 = 248.

I took some screenshots from game and created a map of rendered values.
The map is not 100% complete, but i think it is already clear how the colors are actually mapped and we can safely assume unknown values.

This should not be an issue as long as the conversion doesnt alter appearance of identical file in game through export/import, though i think we should reflect the colors better when exporting the image or displaying color table editor.

Luckily i dont think exporting and then importing an original image will result in color shift in game, as the maximum difference (7) is less than an unit (8) so the value should be rounded back to what it was.
I will do some tests later to see if there are any issues with the conversion, the above is just an assumption.

Color rendered in game - rrr / ggg / bbb - only found values displayed
rrr / ggg / bbb | linear color value | difference r-g-b | bytes | value

255 / 251 / 255 | 248 | 7-3-7 | 11111 | 31
247 / 243 / 247 | 240 | 7-3-7 | 11110 | 30
239 / 235 / 239 | 232 | 7-3-7 | 11101 | 29
231 / 227 / ? | 224 | 7-3-7 | 11100 | 28

222 / 219 / 222 | 216 | 6-3-6 | 11011 | 27
214 / 211 / 214 | 208 | 6-3-6 | 11010 | 26
? / 203 / 206 | 200 | 6-3-6 | 11001 | 25
? / ? / ? | 192 | 6-3-6 | 11000 | 24

189 / 186 / 189 | 184 | 5-2-5 | 10111 | 23
181 / ? / 181 | 176 | 5-2-5 | 10110 | 22
173 / 170 / 173 | 168 | 5-2-5 | 10101 | 21
165 / 162 / 165 | 160 | 5-2-5 | 10100 | 20

156 / 154 / 156 | 152 | 4-2-4 | 10011 | 19
148 / 146 / 148 | 144 | 4-2-4 | 10010 | 18
140 / 138 / 140 | 136 | 4-2-4 | 10001 | 17
132 / ? / 132 | 128 | 4-2-4 | 10000 | 16

123 / ? / 123 | 120 | 3-1-3 | 01111 | 15
115 / 113 / 115 | 112 | 3-1-3 | 01110 | 14
? / 105 / 107 | 104 | 3-1-3 | 01101 | 13
99 / 97 / 99 | 96 | 3-1-3 | 01100 | 12

90 / 89 / ? | 88 | 2-1-2 | 01011 | 11
82 / 81 / 82 | 80 | 2-1-2 | 01010 | 10
? / 73 / 74 | 72 | 2-1-2 | 01001 | 9
66 / 65 / 66 | 64 | 2-1-2 | 01000 | 8

57 / 56 / 57 | 56 | 1-0-1 | 00111 | 7
49 / 48 / 49 | 48 | 1-0-1 | 00110 | 6
41 / ? / 41 | 40 | 1-0-1 | 00101 | 5
? / 32 / 33 | 32 | 1-0-1 | 00100 | 4

24 / 24 / 24 | 24 | 0-0-0 | 00011 | 3
16 / 16 / 16 | 16 | 0-0-0 | 00010 | 2
8 / 8 / 8 | 8 | 0-0-0 | 00001 | 1
0 / 0 / 0 | 0 | 0-0-0 | 00000 | 0

Import Animation

Hi! You have mentioned that you know how to do it, but the process of importing goes very slow. So I wanna say you: if it's working with no bugs, I would wait a whole day. Just please release it. We all thank you and wish you best luck. ^_^

load offset values correctly to prevent continues manual inputs

after patching the game with the ucp the offsets for the overlays resets to the vanilla value it would be great to have the program remember the previously set values or make it so that it has a config that can can be applied via button
(talking about these values) image

This is not an issue

Good day to you, i noticed that your readme file is poorly translated (as well as containing some broken links). I can fix it if you want.

Great tool btw

Crash

After some time of switching between gm1 file program crashes. There is no specific pattern and it happens on random file.
PS: game - Stronghold Crusader HD

Every change in tile_buildings2 crash the game

Problem is in a subject. I don't see any log file so I will describe my actions one by one.

  1. I've extracted images from tile_buildings2.gm1.
  2. I've changed 2 pictures of granary in the "Images" folder on my custom ones.
  3. I've imported images and created a new gm1 file.

After all that my game crashes while loading. What have i done wrong? ¯_(ツ)_/¯

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.