-
Notifications
You must be signed in to change notification settings - Fork 43
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
amigaos4 (big-endian) port #142
Comments
Hi, OpenClaw was never designed with support for big-endian architectures in mind 😄 The libwap library and zip file library would have to be redesigned with this in mind I think. I am not really sure how much work that would be to be honest. If you could backtrack where exactly does the WAP_LoadRezArchive() return NULL I might be able to make an estimate of the effort it would take. But as I said, it was never designed around support both endiannes types. |
If you mean classic libzip library, that one if i remember right have big endian support already.. For libwap, at moment i tried to do conversion to big endian via SDL_SwapLE32, like this: Changing that in WAP_LoadRezArchive():
on that:
But only that change make it all freezes.. Maybe that 127 bytes header also need adjustements as well as some other stuff too ? I also added few printfs to WAP_LoadRezArchive() , so to see where it return NULL (as i see there just 2 places where return NULLs : 1 in case of no file found and 1 in case wrong data inside). So, file opens fine, but fail when do "if (expectedRezArchiveSize != actualLoadedFileSize)" check. |
Hmm, I guess then what would solve this would be making FileRead and all other reading generics to be endian agnostic. But I don't have any device which has big endian, so there would be no way for me to test it at the moment. I would have to find some VM which has big endian architecture. |
Yeah seems so.. Is only FileRead are real generic function which used offten, or there is more ? I foind only that one at moment:
|
https://github.com/pjasicek/OpenClaw/blob/master/libwap/IO.h This is used for parsing wwd files I think, I did not write this one. |
That part probabaly already endian agnostic , see at top:
and it used in read_write_impl() .. So probabaly roots at least endian aware (i hope :) ) |
Oh yeah, so that's not a problem then. Then just put the same thing in the FileRead method and hope for it to work 😄 |
Ok simple adding that:
Make that loading of game pass futher (so at least it not NULL anymore when load CLAW.REZ data into the memory, so maybe all fine there), but then it fail to load ASSETS.ZIP things with words " [InitializeResources] Failed to initialize resource cachce from resource file: ASSETS.ZIP ". Full log currently looks like this:
|
is the ASSETS.ZIP file in the same folder as CLAW.REZ ? |
Even if it is, it will fail. https://github.com/pjasicek/OpenClaw/blob/master/OpenClaw/Engine/Resource/ZipFile.cpp#L156 Whole ZipFile.cpp is taken from Game Coding Complete 4 book and just modified so it runs under linux by me. It's not really big/little endian agnostic. |
Yeah, file there, and yeah, seems ZipFile.cpp need fixes too .. Probabaly that first fread() before the line you point out need to be fixed, like this maybe swapping the same that &dh structure.. |
If you get stuck let me know, I'll try to help 😉 |
Yeah, help need it,i suck at code expectually when it come to all those conversion things with arrays and co :) One of my friends who help me with some other things back in the past, saying that this FileRead()'s fix probabaly wasn't right, and proper one will be something like this:
But, that If FileRead is only used for single elements that needs Big/Little endian reodoring, and never for Array and things like that (he haven't checked), But that still didn't fix 127 bytes array, if this need to be fixed. As for ZipFile.cpp, currently dunno how to fix it.. |
Also as probabaly we firstly need to be sure that CLAW.REZ opens/reads/etc fine , i was able to build libwap_tests binary too , but when i run just like "$ libwap_tests CLAW.REZ" it says "no tests run". Dunno if i running it run at all ? |
I going a bit futher: in zipfile.cpp, i doing that:
I.e. conver strcuture of zipheader to big endian , and then i go futher. Now i still fail in the !pCustomCache->Init() from BaseGameApp.cpp, and trying to see what it calling next after zip inititialisation.. |
I'd help but I don't have any big endian device / vm ... but what you are doing makes sense to me |
Was away from home, so continue again :) Doing that which in previous post passed things futher, but still i again have error "Failed to initialize resource cachce from resource file ASSETS.ZIP" , while ZipFile::Init() return success now for sure. I.e. BaseGameApp::InitializeResources() starts, going till that part:
And fail with that error. From brief look i not very much understand c++ code, so dunno what functions it call now .. That pCustomCache() declared as :
So its again ResourceCache , which probabaly call something else now ? |
It is still the problem with the ZipFile - it is the pCustomArchive |
What i mean is what function called next after zip:init(). zip:readfile() are next one which need fixing ? I just didnt find any function called pCustomArchive() (if that what you mean) |
pCustomArchive is just a variable, not a function.. The initialization fails in this method: you need to put debug logs there and see where it returns false and figure out why. |
That strange, as zip::init seems passed fine, that what i have in output now, when put bunch of prinfs in zip::init():
I.e. init return success for sure first time, but then, it fail when doing so next time ? It is probabaly something else, not zip::init(), as it should then fail first time too when open ASSETS.ZIP first time.. Will try to invistigate more |
Trying to port OpenClaw to amigaos4 (so PPC cpus, big-endian), and while able to build binary, it runs, but then fail on loading of CLAW.REZ, returning NULL.
I checked and CLAW.REZ is here, opens by main binary, read, etc, but still libwap return NULL in WAP_LoadRezArchive(), which mean that it think its invalid data => probabaly issues with structures and big/little endian differences ?
So question is, any luck libwap have some love and big-endian support ?:) Or at least, some pointing on what is wrong can help too.
Thanks!
The text was updated successfully, but these errors were encountered: