// C Header File // Created 10/20/2002; 9:04:32 PM void FindMyselfAndFolder (SYM_ENTRY * mySelf, SYM_ENTRY * myFolder); extern SYM_ENTRY myFolder; static inline char *GetGameFolder (void); static inline char *FindExePackedGameFolder (void); #ifndef __FINDFOLDER_H__ #define _FINDFOLDER_H__ //void FindMyselfAndFolder (SYM_ENTRY * mySelf, SYM_ENTRY * myFolder); asm(" FindMyselfAndFolder: movem.l %a2-%a5/%d3,-(%a7) move.l 20(%a7),%d3 move.l 24(%a7),%a4 move.l 28(%a7),%a5 and.l #0x3FFFF,%d3 move.l 200,%a3 move.w #6,-(%a7) clr.l -(%a7) move.l 432(%a3),%a0 jsr (%a0) __KeepLooking: move.l %a0,%a2 move.w 10(%a2),%d0 btst #7,%d0 beq __NotFolder move.l %a2,(%a5) /*stash the folder*/ bra __SkipFolder __NotFolder: move.l 12(%a2),(%a7) move.l 600(%a3),%a0 jsr (%a0) cmp.l %a0,%d3 bcs __NotIt move.l 2332(%a3),%a0 jsr (%a0) cmp.l %a0,%d3 bcc __NotIt move.l %a2,%a0 __ReturnNull: move.l %a0,(%a4) /*save the sym_entry of the file, or clear it if not found.*/ addq.l #6,%a7 movem.l (%a7)+,%a2-%a5/%d3 rts __NotIt: __SkipFolder: move.l 436(%a3),%a0 jsr (%a0) move.l %a0,%d0 bne __KeepLooking clr.l (%a5) /*clear the folder*/ bra __ReturnNull "); SYM_ENTRY myFolder; static inline char *GetGameFolder (void) { SYM_ENTRY mySelf; char **ptr = (char **) &myFolder; FindMyselfAndFolder (&mySelf, &myFolder); return *ptr; } static inline char *FindExePackedGameFolder (void) { char *archive; SYM_ENTRY * symptr; static char f[9] = "oblivion\0"; SYM_STR name = SYMSTR_CONST(FOLDER_FILENAME); symptr = DerefSym (SymFind (name)); if (symptr) { archive = (char *) HLock (symptr->handle) + 3; if (archive) strncpy (f, archive, 9); HeapUnlock (symptr->handle); SymDel(name); } return f; } #endif