Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
I need someone to write a simple utility to grab all the coordinates of every s˙st resource in a file and output them to a text file. Please send email to the address below if you can do this for me.
diordna@silvernetwork.net
------------------
Here is some C code that might help you:
#include <stdio.h> static FSSpec get_spec_from_filename(char *) { OSErr err; CFURLRef url; FSRef fs; FSSpec spec; url=CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFURLGetFSRef(url,&fs;); CFRelease(url); err = FSGetCatalogInfo(&fs;,kFSCatInfoNone,NULL,NULL,&(spec),NULL); sprintf(&(spec.name(1)), "%s", filename); spec.name(0) = strlen(&(spec.name(1))); return spec; } #define get_16(r, w) ((SInt16)((((unsigned char)(*(r))(w)) << 8) + ((unsigned char)((*(r))((w)+1))))) int main(int argc, char **argv) { Handle resource; long i; FILE *fp; SInt16 refnum; FSSpec spec = get_spec_from_filename("Nova Data 1"); refnum = FSpOpenResFile(&spec;, fsRdPerm); fp = fopen("system coordinates.txt", "w"); for(i = 0; i < 2048; i++) { resource = GetResource('s˙st', i + 128); if(resource != NULL) { fprintf(fp, "%ld, %ldn", get_16(resource, 0), get_16(resource, 2)); ReleaseResource(resource); } } fclose(fp); CloseResFile(refnum); return 0; }
Kidglove (edit) Made it write to a file instead of the console, and also open a resource file. Can't remember if it's the right one. Probably not. (/edit) ------------------ Compilers - the ultimate god games.
(This message has been edited by Kidglove II (edited 08-14-2002).)
Quote
Originally posted by diordna: **I need someone to write a simple utility to grab all the coordinates of every s˙st resource in a file and output them to a text file. Please send email to the address below if you can do this for me.
**
see I told you.
KidGlove - yes that will do it, but it doesn't appear that he would have a compiler, so I think you'll have to compile it for him. If you do, you might as well add a scanf line to ask for a file name. Then all he would have to do is place the program in the folder with the files he wants to grab info from.
Jeffrey - Arios SoftWare
------------------ (url="http://"http://www.ariossoftware.com/upcoming")EVONE 1.0.0 - the plugin editor for EV/EVO/EVN(/url)
Originally posted by AriosSw: it doesn't appear that he would have a compiler, so I think you'll have to compile it for him.
I think that peice of code I posted more or less needs to be compiled on and for OS X, in which case anyone can use the command line tool "cc" to compile it like so: "cc -o coords coords.c" will compile it, given that the file is called "coords.c".
If you change the line
FSSpec spec = get_spec_from_filename("Nova Data 1");
to
FSSpec spec = get_spec_from_filename(argv(1));
you could also make it take the data file's name as a command-line parameter.
I'm not particularly interested in making a program with this code, and having to support it. If anyone wants to use it as part of a program, go ahead.
Kidglove
------------------ Compilers - the ultimate god games.
XKooz me for a second. I don't program in C, I use BASIC and some Java. I don't know how to use a C compiler just yet. I'd write the program myself but the tools I have aren't powerful enough. I need someone to make a version for both OS 9 and OS X because I need them for a utility I'm writing for Nova and we can't leave the Classic users out
Originally posted by diordna: I don't program in C, I use BASIC and some Java.
Then I'd say it's time for you to switch.
Originally posted by diordna: **I need someone to make a version for both OS 9 and OS X because I need them for a utility I'm writing for Nova and we can't leave the Classic users out:) **
The only thing in the source code that I wrote that kinda requires OS X is the get_spec_from_filename function. The other part should work fine on both platforms. I don't do much of Java or BASIC programming, and wouldn't know how to get at the resources in those environments, but the algorithm should work. It did for my EV Map program.
Originally posted by Kidglove II: **I think that peice of code I posted more or less needs to be compiled on and for OS X, in which case anyone can use the command line tool "cc" to compile it like so: "cc -o coords coords.c" will compile it, given that the file is called "coords.c". **
How exactly is one supposed to go about doing this (step by step procedure, please)? I keep getting an error.
------------------ I am mormon. I am mormon by choice. If you have any questions about the LDS religion, go (url="http://"http://www.mormon.org/")here(/url).
Originally posted by P-Psycho: **How exactly is one supposed to go about doing this (step by step procedure, please)? I keep getting an error. **
Heh - oops. Sorry about the bugs. I was kinda tired yesterday, and mainly copied from old files. (url="http://"http://w1.182.telia.com/~u18219788/coords.hqx")Here(/url) is a compiled version along with it's source code. It's all for OS X, for classic, you would want to change the get_spec_from_filename function. I know CodeWarrior 3 had a function called __path2fss which does the same thing, maybe newer versions of CodeWarrior still has it, I don't know. It might be worth looking into. The program opens a file in it's own directory called "Nova Data 2", and dumps the coordinates of all s˙st resources to "system coordinates.txt".
Standard disclaimer (though still valid): I take no responsibility whatsoever for any action or inaction, harmful or otherwise, done by the code or application.
I would also like to apologize if I seemed cranky in any way. I didn't mean to.
Kidglove (edit) Now that I think about it: take a look at the last entry on (url="http://"http://www.AmbrosiaSW.com/cgi-bin/vftp/show.pl?product=evn&category;=utilities&display;=date&page;=1")this(/url) page. Helpful? :redface: (/edit) ------------------ Compilers - the ultimate god games.
(This message has been edited by Kidglove II (edited 08-15-2002).)
Umm...if you guys remember what I asked for, I needed A FULLY COMPILED VERSION of a program FOR MAC OS 9 AND OS X that converts every system in a file's coordinates to a text file.
Alright, alright. I will make some changes to the code (add drag and drop support and Open and Save dialogs) and send it to you when I'm done. It may be a couple days because I am busy with EVONE. It will be a full Carbon application for OS 9 and X.
How patient everyone here is.
Oh, and why not C++ instead of C? (Not that I know anything like enough to write a program to do this in any language :/)
I have sent the program to the email address in your profile, bytebouncer@yahoo.com.
I decided to drop the open and save dialogs because they only made the program more difficult (both to write and to use). Instead, you simply drag and drop the file you want onto the program, and it outputs a text file into the same folder the program is in.
Why not C++? Mainly because I don't know C++ as well as I know C, and also because for a program this simply, C++ doesn't make it any easier. Now, for a program the size of EVONE, C++ would have made it much easier, but I didn't know C++ at all when I started.
Edit: Perhaps I should have sent the email to the address you gave above. I didn't see that until now, tell me if you want it sent there too.
(This message has been edited by AriosSw (edited 08-16-2002).)
Originally posted by AriosSw: **I have sent the program to the email address in your profile, bytebouncer@yahoo.com.
How about making it so that the program outputs the system name next to the coordinates, and then posting it on the addons page?
------------------ "The day microsoft makes something that doesn't suck will be the day they make vacuum cleaners." -White Lightning
Originally posted by P-Psycho: **How about making it so that the program outputs the system name next to the coordinates, and then posting it on the addons page?
You would have to ask KidGlove II to modify the source he gave to do that. I am not familiar with the s˙st editor (I will be when this blasted mission editor is done and I start on the s˙st/spöb editor) and simply built the program around the source he gave. If he posts new source, I will put that into the program and post it on the addons page. Otherwise, I will add that capability when I start working on the s˙st/spöb editor for EVONE.
Jeffrey