-
Notifications
You must be signed in to change notification settings - Fork 793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpqapi cleanup #624
mpqapi cleanup #624
Conversation
d8f59ec
to
45178cf
Compare
@AJenbo Do the tests run on Windows in CI? |
@glebm no, but it probably wouldn't be hard to add. |
Mmm....latest changes/fixes/ works for debian, but still not saves for Morphos. Opens old single files. Also there are some problems with std::free not being recognized for a Warpos build (for Morphos is ok). Basically what an earlier mpqapi log frame said;
|
I guess |
AMIGA defines are by default included for warpos/morphos: stdlib.h for warpos (gcc 6.4 - newlib): void free (void *) _NOTHROW; No bebbo/libnix: This is Amiga-like powerpc ecosystem and nothing to do with 68k new gcc's. Thinking about doing some stream tests by my own before going to look out for the Morphos team developers. Warpos can't test it because of the std::free (it uses basically gcc/g++ from Morphos but not the full SDK). Anyways do your own thing. LOL, adding this:
before
Works ! :) But then cannot read if I save later:( Got to fix that,,,,,, Ok. Seems to work now: A simple bool inside InitDefaultMpqHeader to control if a new stream is created and then a check if I had to write this buffer or not. |
This reverts commit e080076.
1. Do not rely on stream positions for getting the initial file size. 2. Remove most `seek` calls that were unnecessary. 3. Replace magic numbers with constants. 4. A class to manage archive lifetime and all associated data.
Works around bebbo/libnix#30
This fixes fstream logging on Amiga
@Cowcat5150 I've replaced the uses of
It's exactly what this block does (but without using 60 KiB of stack): #ifndef __AMIGA__
// Amiga currently cannot seekp beyond end-of-file, so we fill up the space.
// The data is incorrect at this point, it will be overwritten on Close.
// See https://github.com/bebbo/libnix/issues/30
if (!cur_archive.exists)
cur_archive.WriteHeaderAndTables();
#endif May no longer be necessary on Amiga with the latest bebbo/libnix though. |
This reduces log noise and reliance on `tellp`.
Previously I enabled it for use with Amiga but got same problems. Will try your new changes today. Tested. New delete compiles but still the save problem: Using my buffer hack kinda works but now saving sets the system in bad situation that leads to crash sooner or later. Forget to mention: The use of truncate in file_util.h/ResizeFile function can be changed by ftruncate or is totally different ?. "truncate" not available in Warpos and I use "ftruncate"......;( |
Crashes for me when trying to create a character in x64 release/x64 debug builds in visual studio on windows |
b6bbc5d
to
fc4368e
Compare
@Cowcat5150 OK, I've added some code to ensure that we do not Regarding |
<3 SourceT/file_util_test.cpp |
Seems to work as expected for Morphos, hope is good for rest of Amiga's . :) On a previous, previous mpqapi fix, due to a buggy/old MOS sdl library (I think) I ended with a single_0.sv file impossible to open even on debian. Supposedly files are "safe" against problems when game fails to continue but "MPQ free list error" was the message. Hope that this is also fixed (was source from a couple of days ago). Good work anyways. |
Can't create new characters, crashes while saving on windows |
well I'm not a git god, but I pulled changes from master to my light branch then even tested with just the master 🤷♂ |
seek
calls that were unnecessary.@Cowcat5150, could you please test this?