Tilengine - The 2D retro graphics engine forum

Full Version: Read Access Violation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have a Tile tmx file that is just the sonic_md_bg1.tmx background and sonic_md_fg1.tmx foreground on separate layers (1st screenshot). The problem occurs with the "FG" layer. loading the tilemap seems to be fine since Tilengine isn't giving me any errors. However, when trying to set the layer the program throws a read access violation (2nd screenshot). I'm not sure what exactly I'm doing wrong, I'll attach me code as well as my tiled tmx file. I was trying ot get TLN_LoadWorld working but that was also throwing a read access violation.


[Image: unknown.png][Image: unknown.png]


Code:
Code:
#include "include/Tilengine.h"

void main(void) {
TLN_Tilemap tilemap_fg;
TLN_Tilemap tilemap_bg;

TLN_Init(400, 240, 4, 0 ,0);

TLN_SetLoadPath("assets/sonic");
tilemap_bg = TLN_LoadTilemap("Sonic_md_full.tmx", "BG");
tilemap_fg = TLN_LoadTilemap("Sonic_md_full.tmx", "FG");
printf(TLN_GetErrorString(TLN_GetLastError()));

TLN_SetLayerTilemap(0, tilemap_fg);
//TLN_SetLayerTilemap(1, tilemap_bg);

TLN_CreateWindow(NULL, CWF_VSYNC);
TLN_SetBGColor(36, 73, 219);

while (TLN_ProcessWindow()) {
TLN_DrawFrame(0);
}

TLN_DeleteTilemap(tilemap_fg);
//TLN_DeleteTilemap(tilemap_bg);
TLN_Deinit();
}


TMX File (This is the raw text data because I can't just attach the file for some reason, you should be able to just put this in a text file and change the type to tmx):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.8" tiledversion="1.9.2" orientation="orthogonal" renderorder="right-down" width="480" height="42" tilewidth="8" tileheight="8" infinite="0" backgroundcolor="#2449db" nextlayerid="4" nextobjectid="1">
<editorsettings>
  <export target="Sonic_md_full.tmx" format="tmx"/>
</editorsettings>
<tileset firstgid="1" source="Sonic_md_bg1.tsx"/>
<tileset firstgid="305" source="Sonic_md_fg1.tsx"/>
<layer id="3" name="FG" width="480" height="42">
  <data encoding="base64" compression="zlib">
  eJztXXe0HkUVf99aiN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P4qVrzHg8TS+V98W7tuc7n7eukq9OPP6OtP+rU1L8MVFcn/Vc3/dWq7aN9F+Ltl1XMH9c3iueN/LfY+djvvkff6/SJX3vZcbOj2Pr9+nn7w/m1k+PtP2l1selT3/Z9ZO+emNlW/XT/SnTHzqu4etqXdJlR7br13r1mL1vNr0dZd9nduWtux7/Drv/o+Nrs+p/+5vbm7puk+KPidx90eXWDtqh6w1d38Wla70X11NWv2texOdT+nfb+5Ch86X8/K/Me5W+djR1flkp9lesjx9P3V7f7676Yp+jsu1rqv7Y/nC1r2r/xK57rUuS32tg/B1p/5da2vJvE7m/C1jOa73NRZLPi/h8yvc+pG++RPrKvFeZl22fX0GK/YkU2THZdPzbtv9q0f8llSHxBzuv9TYXST4vmmnzoRkgk+ocNvsTKbIN2XT82/b1DosMiD9ab6PITsmkOiX+FSmyumw6/m37eodFBsQfrbdRZKdkUp0S/8bJ/wNYPJWm
  </data>
</layer>
<layer id="1" name="BG" width="480" height="42">
  <data encoding="base64" compression="zlib">
  eJztWQeUZEUV7V7YJewCCyy7C7tLWBUUFLMoKLaCYhbFrJizmDErPHPCiDnniAFzXEfMOeec85pzvL+rr/Pmna75/0//390zfe8599SvX++9W/Wq3vyamU5HEARBEIRxozvgKnAXcFdw9SL2GDPYWNX4VeNWRV192mMOtmqI3xpwtxH8q6Kp9Ue0ld+y9Xq7Qn93cI8lzK8s/03Pu65+0/mNUP2p/jxUfwux0usPe2bYO9sTz2vBdeBe4N7gPs4Oz4Z3hjFbl3yG7nfduFVRVz/ar01zKfVryp9gHkZdfy5uW/ktW+96cF9wv6Q5V7T7tzi/puZdFeOav+qvHX9C9af6a0KnrfrDnhn2zjZ0+vtpB6DdCG7q9PfYaLc+vbONycbifkdUjVsVdfWjfXFWN1Twa8qfYB5GXX8ubll+cbe0NRX0mlpv3flF5O71uXty0/Ne6vyZZ9Zd1fu66q8df0L1p/prQqet+otnYzN4IHjQkJh4ZxizzQOf3J4MO3OLxa2Kqvo5e6Lq31xG9fd5a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26x319154d1zpbr47y/BpuvO33QMAcbteU66saN6/8G+M2Us2KPDTmw89z8UTt2jtt/f17PDedB9af6U/3NVv19C/w2+B3wu+D3wO+DPwB/CP4I/DH4E/Cn4M8GfYwZ3lnR/7kbZzzGYfsL8Jfgr8Bfg78Z+Elf+tKXvvSlP4v6O8Hfgr8Df5+e7Q9o/wj+Cfwz+JchfTwb3lkcZzzG8e3O5LMgjvSlL33pS1/6s6j/V/Bv4N/Bf4D/BP/Vmb8P/Bv8D/hfsNPtf9sN33jj/aDb7X/jrfi+r+r2fW0XtLuCqwftGtfSroizW1f60pe+9KUv/dnU99/9nYkL7gNsQcOzxe947ntPv92hsUd3vs3ZSV/60pe+9KU/S/p74t1a973mfYDv2a4D93Lfcd4PaL833u3jxum3PrQcp730pS996Utf+rOoz+9y/N7H73Zsoz2/52V+8R4gfelLX/rSl/4s6hfYF/39uqmN3+0C+PYb7fie9kVbjOMOYKu78/G8//7hfdFGe+lLX/rSl770Z0l/A3iAa+N3eiO4KY0ZbIzv2ed4Ls5m8EBnvyn5WLSXvvSlL33pS3+W9A8Ct4BbB2383m8DD05jttW9L/rwNY7Tn/H4nS/sDnH+sLVDh9hLX/rSl770pT9L+vF7HL/3uXtCtIvfd7ZxPPpJX/rSl770pT+L+sX3GN9w4/c4fu/5PrbRzn/ft7k2jkc/6Utf+tKXvvRnUf+wbvqdO9duH7SDd/+3H4xZmV1s6VdmJ33pS1/60pf+StbvCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCIIgCMIY8T8kK8dB
  </data>
</layer>
</map>
Hi,
Seems that the last release that introduced support fot multiple tilesets per layer is still a bit buggy. I've seen that your sample makes the engine crash when referencing the wrong tileset. Thanks for providing this useful test case, with this I'll be able to debug and solve the problem tomorrow morning. I expect to release the fix soon.
Sorry for the inconvenience,
(10-25-2022, 05:18 AM)megamarc Wrote: [ -> ]Hi,
Seems that the last release that introduced support fot multiple tilesets per layer is still a bit buggy. I've seen that your sample makes the engine crash when referencing the wrong tileset. Thanks for providing this useful test case, with this I'll be able to debug and solve the problem tomorrow morning. I expect to release the fix soon.
Sorry for the inconvenience,
ok, great! Thanks!  Biggrin
I've having a similar issue. You can see details here: https://github.com/megamarc/Tilengine/issues/99
Hi guys,
I've just pushed release 2.11.3 to github that fixes the issues found in your test cases, and some more. Please update your build and let me know if it works for you too.
Regards,
(10-26-2022, 12:35 AM)megamarc Wrote: [ -> ]Hi guys,
I've just pushed release 2.11.3 to github that fixes the issues found in your test cases, and some more. Please update your build and let me know if it works for you too.
Regards,

My issues was fixed, thanks! Not sure about the other guys problem though.
Yup, works for me. Thanks Marc!
Thanks for your feedback guys!
I've pushed the fix to the multi-palette issue to github, you an update your builds to release 2.11.3. As it's an important fix I'll later push it to itch.io, too.
Now your tilesets with different palettes on the same layer should play nicely.
(10-27-2022, 03:15 AM)megamarc Wrote: [ -> ]Thanks for your feedback guys!
I've pushed the fix to the multi-palette issue to github, you an update your builds to release 2.11.3. As it's an important fix I'll later push it to itch.io, too.
Now your tilesets with different palettes on the same layer should play nicely.

Hi, can one tileset uses multiple palettes? (Like Palette attribute per tile in old consoles) Thanks for your answer
By the way, this is a pretty exciting update! the CRT filter is also way better!
(10-27-2022, 03:47 AM)System64 Wrote: [ -> ]Hi, can one tileset uses multiple palettes? (Like Palette attribute per tile in old consoles) Thanks for your answer
By the way, this is a pretty exciting update! the CRT filter is also way better!

Hi!
Each tileset can have a single palette, there's no per-tile palette as in classic 2D chipsets. However, as you can now have several tilesets on the same layer, and each one have its palette, that's several palettes per layer.

Thanks for your feedback! I'm glad you like the new CRT effect :-) better looking and much more efficient in terms of CPU usage
Pages: 1 2