Game not loading when adding new blocks
So i was adding some more blocks (Block.c, Block.h, Player.c), and to my surprise the game showed me a black screen. I ran it through Citra, and it showed an error message: "Failed to load the texture romfs:/textures/entity/steve.png". After removing some blocks it ran again. https://i.imgur.com/aByzTLy.png
can you please show me your source code?
https://github.com/firewolfgames/craftus_reloaded
this might be caused by a buffer overflow.
the inventory size array has a length of 27. But here is l incremented further than the array length. This way you write into memory where some other data could be located which is then overwritten. C can be very nasty when it comes to these things.
Also I wouldn't use so many Block Ids just for the different types of wood, but instead use metadata.
EDIT: reserve 5 entries per log type in the metadata, so that it will be easier to implement block rotations one day
Tried using metadata in the same way as you did with the wool blocks but with textures. Still crashes on boot (changes pushed in my fork)
have you pushed your changes to Github?
Yes EDIT: i did hit commit, forgot to push everything, my bad
https://github.com/firewolfgames/craftus_reloaded/blob/master/source/blocks/Block.c#L22
Problem solved! The problem was that you missed the .png! But what's mysterious about it, is that no error was thrown, eventhough there is proper error handling there. It might be a problem with lodepng or the error handling simply wrong, which wouldn't be a surprise after realising that I used two variables which always contain the exact same content(https://github.com/RSDuck/craftus_reloaded/blob/master/source/rendering/TextureMap.c#L141).
Whatever, I revised the function that I load the file by myself(that's the reason why I found the error) and only using lodepng to decode the buffer. This is also more performant, because the buffer where the file is stored is only allocated a few times(and not everytime).
Anyhow, why have you changed the texture pack? There's a reason why I chose this one(besides that I like it more than the default 😄), namely because it's licensed under CC BY-SA, so there are no copyright infrigements when distributing it, as long you follow it's terms that the author has to be attributed and that the files have to stay under CC BY-SA.
I feel stupid now 😂 anyways thanks! I used the original texture pack just so i can make out whats what, was never actually supposed to get on github (i'll try to include it when pushing to my fork)
Actually it's not quite solved, still the same error