Recent Posts

Pages: [1] 2 3 4 5 6 7 8 9 10
1
Storage / Re: Adaptec PowerDomain 2940UW files are no longer available :(
« Last post by ssp3 on Today at 07:48:38 AM »
joevt, I don't think it is worth it.  ;)
It was looong time ago, but, if I remember correctly, flashing Adaptecs was "one way ticket". Protection or something like that.
Also, it looks to me that the firmware is already compressed. I moved the v2.5 rom part from resources to data, chopped off extras before Joy!peffpwpc, so that certain disassembler could recognize it as pef file, but was greeted with "illegal compressed data" alert. If you're curious, try it for yourself (attached).

* A bit OT. Can you help me with figuring out what kind of checksum method is used in one particular firmware file? It is ARM.
2
Storage / Re: Adaptec PowerDomain 2940UW files are no longer available :(
« Last post by joevt on Yesterday at 09:52:07 PM »
Or, you could ask me to do it, if you are willing to test a un-tested ROM.

You can probably get the PC rom using flashrom in OS X https://forums.macrumors.com/threads/question-how-powerful-of-a-graphics-card-will-work-in-a-beige-power-macintosh-g3.2303689/post-32937887
using the anypci option.

Which Mac rom do you need?
3
CPU Upgrades / Re: Mac Mini G4 Overclock just because its fun.
« Last post by joevt on Yesterday at 09:47:31 PM »
You can get the Mac mini boot rom using https://forums.macrumors.com/threads/question-how-powerful-of-a-graphics-card-will-work-in-a-beige-power-macintosh-g3.2303689/post-32937887
If you post it here, then I can see if there's fcode for R9200 in there.
4
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by joevt on Yesterday at 09:16:21 PM »
A Str255 is a fixed size field of 256 bytes. The string inside the Str255 is variable length but a Str255 is not variable length.

TheRest could be up to 64K since the length for the comment is two bytes. I think in C you would define it like this:
Code: [Select]
char theRest[];

or this (if the compiler doesn't like flexible arrays):
Code: [Select]
char theRest[0];

or this (if the compiler doesn't like zero sized arrays):
Code: [Select]
char theRest[1];

With an array size of 1, You would have to use sizeof(CKIDRec) - sizeof(CKIDRec.theRest) to calculate the size of the non-string data.
Or use offsetof(CKIDRec, theRest) to calculate the size of the non-string data.
If the compiler doesn't have offsetof, then #define it. https://en.wikipedia.org/wiki/Offsetof

If the data is in a locked resource, then you don't need to copy it to a local or global variable.
Code: [Select]
HLock(ResHandle);
CKIDPtr ckid = *(CKIDHandle)ResHandle;
char* p = &ckid->theRest;
char* projectPath = p; p += *p + 2;
char* userName    = p; p += *p + 2;
char* revisionNum = p; p += *p + 2;
char* fileName    = p; p += *p + 2;
char* taskDesc   = p; p += *p + 2;
char* comment   = p; p += *(unsigned short *)p + 3;
long size = p - (char*)ckid;
printf("size:%ld handlesize:%ld\n", size, GetHandleSize(ResHandle));
printf("username:\"%s\"\n", username+1);
printf("revisionNum:\"%s\"\n", revisionNum+1);
printf("fileName:\"%s\"\n", fileName+1);
printf("taskDesc:\"%s\"\n", taskDesc+1);
printf("comment:\"%s\"\n", comment+2);

A char pointer is defined for each string. Since the strings have one or two size bytes, you need to add 1 or 2 when passing it to functions that expect a C string.

p needs to be changed to unsigned char * if char is not unsigned.

You have to recalculate the pointers if you unlock the handle. You need to unlock the handle if you want to increase the size.
5
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by Daniel on Yesterday at 08:47:55 PM »
As it seems you have found out, C doesn't support having variable-length data in the middle of a struct. You have to use pointer arithmetic.

Fortunately, none of the fixed-size data is broken up by variable-length data. So you don't have to have multiple structs (or go with the extreme solution of having a separate pointer variable for every single value you want to extract from that resource). You just need a buffer big enough to hold the max length of everything, plus a bunch of pointer variables (one for the struct at the front, and then one per string).

If my guess is right and the strings in the resource have both length bytes and null terminators (making them both C and Pascal strings), then this code will work. Though it might need stylistic tweaking (the typedefs don't have Ptr & Handle varients, for instance).

Code: [Select]

typedef struct {
uLong checkSum; // checkSum
long LOC; // location identifier
short version; // ckid version number
short readOnly; // checkout state; 0=modifiable
char branch; // if modifiable & byte not 0, then branch was made on checkout
Boolean modifyReadOnly; // Did user execute "ModifyReadOnly"?
uShort history; //  1 if history present, 0 if not
uShort commentLength; // length of current comment if history is present
time_t checkoutDate; // date and time of checkout
time_t modificationDate; // modification date of file
uLong PIDa; // PID.a
uLong PIDb; // PID.b
short userID; // user ID
short fileID; // file ID
short revisionID; // revision ID
} FixedSizeData;

typedef struct {
FixedSizedData  * fixedSizeData;
Str255 * projectPath;
Str255 * userName;
Str255 * revisionNum;
Str255 * fileName;
Str255 * taskDesc;
Str255 * comment;
} CKIDRecPStr;

typedef struct {
FixedSizedData  * fixedSizeData;
char * projectPath;
char * userName;
char * revisionNum;
char * fileName;
char * taskDesc;
char * comment;
} CKIDRecCStr;

void parseCKIDPStr(CKIDRecPstr * ckidRec, void * ckidBuf) {
  unsigned char * buf = (char *) ckidBuf;
  ckidRec->fixedSizeData = (FixedSizedData *) buf; buf +=sizeof FixedSizedData;
  ckidRec->projectPath = (Str255 *) buf; buf += 1 + buf[0] + 1;//deal with the len byte + string + null term sandwich
  ckidRec->userName = (Str255 *) buf; buf += 1 + buf[0] + 1;
  ckidRec->revisionNum = (Str255 *) buf; buf += 1 + buf[0] + 1;
  ckidRec->fileName = (Str255 *) buf; buf += 1 + buf[0] + 1;
  ckidRec->taskDesc = (Str255 *) buf; buf += 1 + buf[0] + 1;
  ckidRec->comment = (Str255 *) buf; buf += 1 + buf[0] + 1;
}

void parseCKIDCStr(CKIDRecCstr * ckidRec, void * ckidBuf) {
  unsigned char * buf = (char *) ckidBuf;
  ckidRec->fixedSizeData = (FixedSizedData *) buf; buf +=sizeof FixedSizedData;
  ckidRec->projectPath = (char *) buf+1; buf += 1 + buf[0] + 1;//deal with the len byte + string + null term sandwich
  ckidRec->userName = (char *) buf+1; buf += 1 + buf[0] + 1;
  ckidRec->revisionNum = (char *) buf+1; buf += 1 + buf[0] + 1;
  ckidRec->fileName = (char *) buf+1; buf += 1 + buf[0] + 1;
  ckidRec->taskDesc = (char *) buf+1; buf += 1 + buf[0] + 1;
  ckidRec->comment = (char *) buf+1; buf += 1 + buf[0] + 1;
}
6
Storage / Re: Adaptec PowerDomain 2940UW files are no longer available :(
« Last post by ssp3 on Yesterday at 10:47:36 AM »
Sure. Why do it in a simple way if you can do it complicated. Let the mickeyratt become a full time programmer, learn about the compression method(s), learn how to debug the damn thing and then, maybe, possibly, pehaps one day that thing will work. But maybe not.  ;D

All that instead of one empty EEPROM chip, soldering iron and about half an hour of work.
7
Ah, thank you joevt, that was really enlightening.  I didn't think to look at it with Resourcerer. 

Yes, the strings can be variable length, that's what I meant when I said the doc says they're Pascal strings, which the Mac OS includes represent as Str255.  So when you say the pad can be used to treat it like a C string, how does that deal with the first part where the string length is coded?  Can we still do this with the struct?

Another option I had was something like this:

Code: [Select]
#include <time.h>

typedef unsigned long uLong;
typedef unsigned short uShort;
typedef struct{
uLong checkSum; // checkSum
long LOC; // location identifier
short version; // ckid version number
short readOnly; // checkout state; 0=modifiable
char branch; // if modifiable & byte not 0, then branch was made on checkout
Boolean modifyReadOnly; // Did user execute "ModifyReadOnly"?
uShort history; //  1 if history present, 0 if not
uShort commentLength; // length of current comment if history is present
time_t checkoutDate; // date and time of checkout
time_t modificationDate; // modification date of file
uLong PIDa; // PID.a
uLong PIDb; // PID.b
short userID; // user ID
short fileID; // file ID
short revisionID; // revision ID
char theRest[1536] // We have to parse this out manually due to pstrings
} CKIDRec, *CKIDPtr, **CKIDHandle;

Then taking CkidRecord.theRest and parsing it out.  Not entirely sure how to do that though... I've taken a few stabs at it and I usually end up crashing the whole machine.  Have a suggestion?

Thank you much!
8
News, Information & Feedback / Re: We're hiring (and have some ideas)!
« Last post by Knezzen on Yesterday at 05:21:23 AM »
So, does anyone feel like writing some condensed articles based on the threads posted here? Would greatly appreciate the help! :)
10
Software / Re: MacTorrent - BitTorrent for Mac OS 9
« Last post by Knezzen on Yesterday 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 ;)
Pages: [1] 2 3 4 5 6 7 8 9 10