Recent Posts

Pages: [1] 2 3 4 5 6 7 8 9 10
2
Software / Re: MacTorrent - BitTorrent for Mac OS 9
« Last post by Knezzen on Today at 03:02:02 AM »
Btw, I should use MacTorrent more. :)

Poke a bit at the sources and see if you can make it better ;)
3
Software / Re: MacTorrent - BitTorrent for Mac OS 9
« Last post by Jubadub on Yesterday at 11:35:18 PM »
it turns out true once more: it is important to question anything, including the primary source and myself. ;)

Yes! Questioning is caring! There's no such thing as an actual "Ministry of Truth", as some say. Sometimes we are wrong, sometimes (most of the time) "authority" (Apple in this case) is wrong, sometimes there are lies, deceits and so on, sometimes not. For instance, Apple since Jobs' return, and to this day, loves lying all the time, so this case might just be another instance of that.

I found yet another Apple page the other day with Apple preaching the same wrong info again.

Either Apple mistakenly wrote that stuff, OR purposefully lied so that people would "keep on buying" newer stuff even if for false reasons (which sadly summarizes most of marketing people).

Btw, I should use MacTorrent more. :)
4
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by joevt on Yesterday at 10:38:53 PM »
It appears the filler bytes between strings allow the strings to be treated as C strings.

The comment string has a two byte length and is therefore not a pascal string.

Since the ckid is variable length, I would maybe copy only the non-variable part from the resource to CkidRecord (everthing before projectPath).

C in classic Mac OS may have an option to print pascal strings. Is it "%p" instead of "%s"? I forget. That's not going to work for the comment which as a two-byte length.

Since the strings always have a terminating null character, you can treat them as C strings (unless you think someone might try putting a null character inside the string).

If you need to modify a string, you need to remember to update the length. If you update the length, you need to move all the following strings. If you make a string longer, then you need to move all the strings before making it longer.

5
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by joevt on Yesterday at 10:36:52 PM »
The Resorcerer template says the strings are variable length, not fixed length.
6
Str255 is defined in MacTypes.h as:

Code: [Select]
typedef unsigned char        Str255[256];

That being said, I based the struct in my first post on the Pascal structure defined in the PDF I referenced.  It definitely has pad bytes, and you can see them in ResEdit too, where there appears to be two ^^'s between each data field.

Still not sure what to do here... should I be able to get this to work with C structures, or should I try and parse through it one character at a time?

Thank you!
7
Software / Re: MacTorrent - BitTorrent for Mac OS 9
« Last post by IIO on Yesterday at 06:21:54 PM »

No, it doesn't: the footnote states "3) Under Mac OS 9.", with a full stop right after saying "9", meaning anything that is not 9 is excluded.


no idea.

if that would be true you couldn´t even copy a DVD oder BD image - i´ve also had audio recordings and videos >2GB since OS 8.1 times.

mabye apple should take more care about who they let write such things.

it turns out true once more: it is important to question anything, including the primary source and myself. ;)
8
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by joevt on Yesterday at 05:48:26 PM »
Is a Str255 defined as char[256] in C? (char should be unsigned)

The first byte is the length. The length is followed by room for 255 characters.

The total length is 256 bytes, so you don't need padding bytes.
9
Hi Daniel!
   Thank you very much for the reply!

   I'm not certain how to incorporate those. 

   Looking at the struct I posted, I'm first of all not quite certain it's right, but let's assume it is for the purposes of this question.  In C, a Str255 is really just a 256-byte string, right?  Ok, so let's say we have some data in projectPath that's not quite that long.  Now we want to access the next relevant field, userName.  How does C know where to get it from, because according to the struct that should be 257 bytes later, right?  But it's not, because projectPath is a Pascal string and starts with the length, then the data, then the \0, and then the pad, right?

   Is it even possible to use a C struct to handle this data?

Thank you so much for the help!
10
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by Daniel on Yesterday at 10:40:33 AM »
Here's all 4 possible string moves. Pick whichever one makes sense for your situation (and maybe add bounds checks or null pointer checks if needed). BlockMoveData is backward compatible with BlockMove (it sets a flag in the A-Line trap which is ignored by BlockMove implementations which don't check it) but is only for data guaranteed to not be 68k code. This means it doesn't have to flush caches (for later 680x0 CPUs) or invalidate the 68k Emulator's JIT cache (for PowerMacs). Which can speed things up.

Code: [Select]
void CStrToCStr(char * src, char * dst) {
 int len = strlen(src);
 BlockMoveData(src, dst, len+1);
}

void PStrToPStr(Str255 src, Str255 dst) {
 int len = src[0];
 BlockMoveData(src, dst, len+1);
}

void CStrToPStr(char * src, Str255 dst) {
 int len = strlen(src);
 BlockMoveData(src, dst+1, len);
 dst[0] = (char)len;
}

void PStrToCStr(Str255 src, char * dst) {
 int len = src[0];
 BlockMoveData(src+1, dst, len);
 dst[len] = 0;
}
Pages: [1] 2 3 4 5 6 7 8 9 10