-
Notifications
You must be signed in to change notification settings - Fork 24
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
1264 GTD OPD Map Loading #207
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @UTengine, thanks for the PR.
I'd rather we don't just enforce map headers 12xx. We can make it load all formats by doing simple checks. Reason why, because tools rely on this implementation too, plus it would be nice having the ability to switch between map assets regardless of their versions.
We can try reading the map files header assuming they're 12xx and if the data doesn't make sense, jump back to the beginning of the file and try reading as 10xx.
This is far from complete. Also ideally we store the file version somewhere in CN3BaseFileAccess, so that we can then do this once to save CPU cycles.
That's what I did with the previous commits months ago, those were never merged too >.> |
int TempVersion, TempIntStringLength; | ||
ReadFile(hFile, &(TempVersion), sizeof(int), &dwRWC, NULL); // Read the map version | ||
ReadFile(hFile, &(TempIntStringLength), sizeof(int), &dwRWC, NULL); // Read the map name char length | ||
CHAR * TempGTDMapNamebuffer = new CHAR[TempIntStringLength / sizeof(char) + 1]{}; // Zero-initialized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few things to point out here:
- Not sure why we're using Windows'
CHAR
here instead of justchar
- If this is to be allocated on the heap, it might as well just use std::string like everything else (or well, that aren't the silly
std::vector<char>
implementations). As it is, it's just leaking memory. - The naming here is a bit strange. Why
TempVersion
etc as opposed toMapVersion
or some such, specifically: why are we referring to them as temporary vars?
On this note, the version is being thrown away here -- when it in fact needs to be used byCN3Pond
, which leads me to my next point: - This is incomplete --
CN3Pond
will fail to read its portion of the file correctly, as it is the only other thing updated in this version. Specifically for versions 2+ (which 1.264 does support), which is why it needs to use the version from here.
1264 GTD and OPD Map loading.
1264 Patch.zip
💔Thank you!
This is currently a draft request so please review.