SpritesMind.NetSega Megadrive/Genesis development2018-02-21T02:26:50http://gendev.spritesmind.net/forum/app.php/feed2018-02-21T02:26:502018-02-21T02:26:50http://gendev.spritesmind.net/forum/viewtopic.php?t=2719&p=33159#p33159Statistics: Posted by Chilly Willy — Wed Feb 21, 2018 2:26 am
]]>2018-02-21T00:24:152018-02-21T00:24:15http://gendev.spritesmind.net/forum/viewtopic.php?t=2719&p=33158#p33158This routine takes a vector of 16-bit values (unsigned short ints), and returns an Enigma-compressed file in a byte-vector. Make sure you have the typedefs mentioned in the first post of this thread.

Now, here is an added bonus. These two snippets will let you read any file from your computer into a byte vector, or store from a byte vector to a file on your computer.

This piece of code opens a file as a byte vector.

filename1 is the name of your file. It usually begins with "C:"

CODE:

vector<unsigned char> Open_File(string filename1) {// file1 is the byte-vector the file will be stored in// filename1 is the name of the file to storevector<unsigned char> file1;ifstream file; file.open(filename1, std::ifstream::binary);// open filefile.seekg(0, file.end);// point to end of fileunsigned int file_length = (unsigned int) file.tellg();// get file lengthfile.seekg(0, file.beg);// point to beginning of filefor(unsigned int i=0; i<file_length; i++) {file1.push_back(file.get());}// read characters into vectorfile.close();// close filereturn file1;// return file}

That'd explain why Miniplanets crashes at random at least... (it probably breaks NBA Jam too then? or was that just controller access without halting the Z80?)

The hardware bug that causes shortened cycles if certain circumstances occur when accessing IO without stopping the Z80 doesn't matter if the rom is fast enough. That's why virtually no games beyond the first year bother stopping the Z80 to read the controller. I'm unaware of a flash cart that is slow enough to show this bug. It's possible that an emulation trying to be completely anal about timing without giving you an option of faster rom access might show this bug.

768 tiles use about 24KB. The maximum you can update on a vblank is about 4KB. If you try to update that much at once the only thing you will accomplish is a slowdown of 5 or more frames. Not playable.

Well, ofcourse you will only have this at boss explosions and the like. It was just an example of when the sprite engine might crash if you haven't allocated enough.

]]>2018-02-20T15:57:422018-02-20T15:57:42http://gendev.spritesmind.net/forum/viewtopic.php?t=2851&p=33154#p33154On solution is to fragment it into several packets. Other is to upload it during loading. BUT using 768 tiles for a explosion is wasting half of the video memory just for explosions! Remember I said you will learn tricks to consume less memory?

]]>2018-02-20T15:45:462018-02-20T15:45:46http://gendev.spritesmind.net/forum/viewtopic.php?t=2715&p=33153#p33153Statistics: Posted by Sik — Tue Feb 20, 2018 3:45 pm
]]>2018-02-20T09:57:082018-02-20T09:57:08http://gendev.spritesmind.net/forum/viewtopic.php?t=2715&p=33152#p33152Statistics: Posted by Stef — Tue Feb 20, 2018 9:57 am
]]>2018-02-20T09:39:122018-02-20T09:39:12http://gendev.spritesmind.net/forum/viewtopic.php?t=2715&p=33151#p33151Statistics: Posted by cero — Tue Feb 20, 2018 9:39 am
]]>2018-02-19T20:27:332018-02-19T20:27:33http://gendev.spritesmind.net/forum/viewtopic.php?t=2851&p=33150#p33150But if it works in the current state then you can keep it that way for now

I was thinking the same, but it is just twelve 64x64 explosions animating on the same frame, for instance, right?So I think it will be needed, for sure. But sure, if it comes to it that I need that mem I can just make sure the frame updates are divided between frames.Will leave that optimisation for later, though, the sprite engine seems to be handling whatever I throw at it at the moment.

]]>2018-02-19T14:59:462018-02-19T14:59:46http://gendev.spritesmind.net/forum/viewtopic.php?t=2851&p=33145#p33145Also rescomp is wrote in C, trying to use standard methods so it could be compiled on any platform. Later i will probably switch to java though, much ore simpler for me :p